glfwSetCursorPosCallback

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.

extern (C) @nogc nothrow __gshared
glfwSetCursorPosCallback

Parameters

window GLFWwindow*

The window whose callback to set.

callback GLFWcursorposfun

The new 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 xpos, double ypos);

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 cursor_pos

Meta

Since

Added in version 3.0. Replaces glfwSetMousePosCallback.

Ingroup: input