glfwSetScrollCallback function

GLFWscrollfun glfwSetScrollCallback(
  1. Pointer<GLFWwindow> window,
  2. GLFWscrollfun callback
)

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

@paramin window The window whose callback to set. @paramin 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

GLFWAPI GLFWscrollfun glfwSetScrollCallback(GLFWwindow* window, GLFWscrollfun callback)

Implementation

GLFWscrollfun glfwSetScrollCallback(
    Pointer<GLFWwindow> window, GLFWscrollfun callback) {
  final glfwSetScrollCallbackLookupFunction = libglfw.lookupFunction<
      GLFWscrollfun Function(
          Pointer<GLFWwindow> window, GLFWscrollfun callback),
      GLFWscrollfun Function(Pointer<GLFWwindow> window,
          GLFWscrollfun callback)>('glfwSetScrollCallback');
  return glfwSetScrollCallbackLookupFunction(window, callback);
}