glfwSetCursorPosCallback function

GLFWcursorposfun glfwSetCursorPosCallback(
  1. Pointer<GLFWwindow> window,
  2. GLFWcursorposfun callback
)

! @brief Sets the cursor position callback.

This function sets the cursor position callback of the specified window, which is called when the cursor is moved. The callback is provided with the position, in screen coordinates, relative to the upper-left corner of the content area of the window.

@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, double xpos, double ypos); @endcode For more information about the callback parameters, see the function pointer type(@ref GLFWcursorposfun).

@errors Possible errors include @ref GLFW_NOT_INITIALIZED.

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

@sa @ref cursor_pos

@since Added in version 3.0. Replaces glfwSetMousePosCallback.

@ingroup input

GLFWAPI GLFWcursorposfun glfwSetCursorPosCallback(GLFWwindow* window, GLFWcursorposfun callback)

Implementation

GLFWcursorposfun glfwSetCursorPosCallback(
    Pointer<GLFWwindow> window, GLFWcursorposfun callback) {
  final glfwSetCursorPosCallbackLookupFunction = libglfw.lookupFunction<
      GLFWcursorposfun Function(
          Pointer<GLFWwindow> window, GLFWcursorposfun callback),
      GLFWcursorposfun Function(Pointer<GLFWwindow> window,
          GLFWcursorposfun callback)>('glfwSetCursorPosCallback');
  return glfwSetCursorPosCallbackLookupFunction(window, callback);
}