glfwSetMouseButtonCallback

Function glfwSetMouseButtonCallback 

Source
pub unsafe extern "C" fn glfwSetMouseButtonCallback(
    window: *mut GLFWwindow,
    callback: Option<unsafe extern "C" fn(*mut GLFWwindow, i32, i32, i32)>,
) -> Option<unsafe extern "C" fn(*mut GLFWwindow, i32, i32, i32)>
Expand description

@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.

@param[in] window The window whose callback to set. @param[in] 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