[go: up one dir, main page]

glfwSetScrollCallback

Function glfwSetScrollCallback 

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

@brief Sets the scroll callback.

This function sets the scroll callback of the specified window, which is called when a scrolling device is used, such as a mouse wheel or scrolling area of a touchpad.

The scroll callback receives all scrolling input, like that from a mouse wheel or a touchpad scrolling area.

@param[in] window The window whose callback to set. @param[in] callback The new scroll 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, double xoffset, double yoffset) @endcode For more information about the callback parameters, see the [function pointer type](@ref GLFWscrollfun).

@errors Possible errors include @ref GLFW_NOT_INITIALIZED.

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

@sa @ref scrolling

@since Added in version 3.0. Replaces glfwSetMouseWheelCallback.

@ingroup input