glfwSetCursorPos function
! @brief Sets the position of the cursor, relative to the content area of the window.
This function sets the position, in screen coordinates, of the cursor relative to the upper-left corner of the content area of the specified window. The window must have input focus. If the window does not have input focus when this function is called, it fails silently.
Do not use this function to implement things like camera controls. GLFW
already provides the GLFW_CURSOR_DISABLED
cursor mode that hides the
cursor, transparently re-centers it and provides unconstrained cursor
motion. See @ref glfwSetInputMode for more information.
If the cursor mode is GLFW_CURSOR_DISABLED
then the cursor position is
unconstrained and limited only by the minimum and maximum values of
a double
.
@paramin
window The desired window.
@paramin
xpos The desired x-coordinate, relative to the left edge of the
content area.
@paramin
ypos The desired y-coordinate, relative to the top edge of the
content area.
@errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref GLFW_PLATFORM_ERROR.
@remark @wayland This function will only work when the cursor mode is
GLFW_CURSOR_DISABLED
, otherwise it will do nothing.
@thread_safety This function must only be called from the main thread.
@sa @ref cursor_pos @sa @ref glfwGetCursorPos
@since Added in version 3.0. Replaces glfwSetMousePos
.
@ingroup input
GLFWAPI void glfwSetCursorPos(GLFWwindow* window, double xpos, double ypos)
Implementation
void glfwSetCursorPos(Pointer<GLFWwindow> window, double xpos, double ypos) {
final glfwSetCursorPosLookupFunction = libglfw.lookupFunction<
Void Function(Pointer<GLFWwindow> window, Double xpos, Double ypos),
void Function(Pointer<GLFWwindow> window, double xpos,
double ypos)>('glfwSetCursorPos');
return glfwSetCursorPosLookupFunction(window, xpos, ypos);
}