glfwSetScrollCallback

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.

extern (C) @nogc nothrow __gshared
glfwSetScrollCallback

Parameters

window GLFWwindow*

The window whose callback to set.

callback GLFWscrollfun

The new scroll callback, or null to remove the currently set callback.

Return Value

The previously set callback, or null if no callback was set or the library had not been initialized.

@callback_signature

void function_name(GLFWwindow* window, double xoffset, double yoffset)

For more information about the callback parameters, see the function pointer type.

Errors: Possible errors include @ref GLFW_NOT_INITIALIZED.

Thread Safety

This function must only be called from the main thread.

@sa @ref scrolling

Meta

Since

Added in version 3.0. Replaces glfwSetMouseWheelCallback.

Ingroup: input