glfwSetMouseButtonCallback function

GLFWmousebuttonfun glfwSetMouseButtonCallback(
  1. Pointer<GLFWwindow> window,
  2. GLFWmousebuttonfun callback
)

! @brief Sets the mouse button callback.

This function sets the mouse button callback of the specified window, which is called when a mouse button is pressed or released.

When a window loses input focus, it will generate synthetic mouse button release events for all pressed mouse buttons. You can tell these events from user-generated events by the fact that the synthetic ones are generated after the focus loss event has been processed, i.e. after the window focus callback(@ref glfwSetWindowFocusCallback) has been called.

@paramin window The window whose callback to set. @paramin callback The new callback, or NULL to remove the currently set callback. @return The previously set callback, or NULL if no callback was set or the library had not been initialized(@ref intro_init).

@callback_signature @code void function_name(GLFWwindow* window, int button, int action, int mods) @endcode For more information about the callback parameters, see the function pointer type(@ref GLFWmousebuttonfun).

@errors Possible errors include @ref GLFW_NOT_INITIALIZED.

@thread_safety This function must only be called from the main thread.

@sa @ref input_mouse_button

@since Added in version 1.0. @glfw3 Added window handle parameter and return value.

@ingroup input

GLFWAPI GLFWmousebuttonfun glfwSetMouseButtonCallback(GLFWwindow* window, GLFWmousebuttonfun callback)

Implementation

GLFWmousebuttonfun glfwSetMouseButtonCallback(
    Pointer<GLFWwindow> window, GLFWmousebuttonfun callback) {
  final glfwSetMouseButtonCallbackLookupFunction = libglfw.lookupFunction<
      GLFWmousebuttonfun Function(
          Pointer<GLFWwindow> window, GLFWmousebuttonfun callback),
      GLFWmousebuttonfun Function(Pointer<GLFWwindow> window,
          GLFWmousebuttonfun callback)>('glfwSetMouseButtonCallback');
  return glfwSetMouseButtonCallbackLookupFunction(window, callback);
}