glfwGetCursorPos function
! @brief 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.
@paramin
window The desired window.
@paramout
xpos Where to store the cursor x-coordinate, relative to the
left edge of the content area, or NULL
.
@paramout
ypos 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
@since Added in version 3.0. Replaces glfwGetMousePos
.
@ingroup input
GLFWAPI void glfwGetCursorPos(GLFWwindow* window, double* xpos, double* ypos)
Implementation
void glfwGetCursorPos(
Pointer<GLFWwindow> window, Pointer<Double> xpos, Pointer<Double> ypos) {
final glfwGetCursorPosLookupFunction = libglfw.lookupFunction<
Void Function(Pointer<GLFWwindow> window, Pointer<Double> xpos,
Pointer<Double> ypos),
void Function(Pointer<GLFWwindow> window, Pointer<Double> xpos,
Pointer<Double> ypos)>('glfwGetCursorPos');
return glfwGetCursorPosLookupFunction(window, xpos, ypos);
}