glfwGetCursorPos

Retrieves the position of the cursor relative to the content area of the window.

This function returns the position of the cursor, in screen coordinates, relative to the upper-left corner of the content area of the specified window.

If the cursor is disabled (with GLFW_CURSOR_DISABLED) then the cursor position is unbounded and limited only by the minimum and maximum values of a double.

The coordinate can be converted to their integer equivalents with the floor function. Casting directly to an integer type works for positive coordinates, but fails for negative ones.

Any or all of the position arguments may be null. If an error occurs, all non-null position arguments will be set to zero.

extern (C) @nogc nothrow __gshared
void
glfwGetCursorPos
(,
double* xpos
,
double* ypos
)

Parameters

window GLFWwindow*

The desired window.

xpos double*

Where to store the cursor x-coordinate, relative to the left edge of the content area, or null.

ypos double*

Where to store the cursor y-coordinate, relative to the to top edge of the content area, or null.

Errors: Possible errors include @ref GLFW_NOT_INITIALIZED and @ref GLFW_PLATFORM_ERROR.

Thread Safety

This function must only be called from the main thread.

@sa @ref cursor_pos @sa @ref glfwSetCursorPos

Meta

Since

Added in version 3.0. Replaces glfwGetMousePos.

Ingroup: input