Sets mouse cursor position programmatically in window coordinates.
Takes x (horizontal pixel coordinate, integer), y (vertical pixel coordinate, integer).
Returns nothing.
Input
Parameters & Returns
Parameters
xInt
yInt
Returns
Void
Quick Summary
Sets mouse cursor position programmatically in window coordinates.
Takes x (horizontal pixel coordinate, integer), y (vertical pixel coordinate, integer).
Returns nothing.
Technical Exegesis...
Sets mouse cursor position programmatically in window coordinates. Takes x (horizontal pixel coordinate, integer), y (vertical pixel coordinate, integer). Returns nothing. Moves system cursor to specified position within window client area, useful for cursor centering and mouse look control.
Sets mouse cursor position programmatically in window coordinates. Takes x (horizontal pixel coordinate, integer), y (vertical pixel coordinate, integer). Returns nothing. Moves system cursor to specified position within window client area, useful for cursor centering and mouse look control.
Coordinate system: x and y in window-relative pixels (0,0=top-left of window client area), x increases rightward (positive direction), y increases downward (standard screen coordinates), coordinates same as inpGetMouseX/Y (window-relative, not screen-absolute).
Use cases: (1) FPS mouse look centering (re-center cursor each frame for infinite rotation), (2) Cursor reset (return cursor to specific position after operation), (3) Forced cursor positioning (move cursor to UI element), (4) Cursor locking (keep cursor at screen center for camera control), (5) Cursor wrapping (wrap cursor to opposite edge when hitting boundary).
Common patterns: center cursor = inpMoveMouse(windowWidth/2, windowHeight/2) (place at center); FPS mouse look = deltaX=inpGetMouseXSpeed(): deltaY=inpGetMouseYSpeed(): rotate camera by delta: inpMoveMouse(centerX, centerY) (re-center after reading delta); cursor lock = inpHidePointer(): inpMoveMouse(centerX, centerY) (hide and center each frame); wrap cursor = If mouseX<0 Then inpMoveMouse(windowWidth-1, mouseY).
Cursor centering: calculate screen center (centerX=windowWidth/2, centerY=windowHeight/2), call inpMoveMouse(centerX, centerY) each frame (maintains center position), combined with inpHidePointer for immersive FPS controls (cursor invisible and always centered).
Delta timing: when centering cursor, next frame's inpGetMouseXSpeed/YSpeed returns movement before centering (system tracks cursor movement between frames correctly), safe to read delta then immediately center (delta captures movement before center operation).
Coordinate validation: coordinates clamped to window bounds automatically (system prevents out-of-bounds positions), negative or excessive coordinates adjusted to valid range (0 to windowWidth-1, 0 to windowHeight-1), safe to pass any integer values (system handles clamping).
Performance: instant operation (~0.001ms, system call), safe to call per-frame (typical for FPS mouse look), generates mouse movement events (next frame's speed functions reflect centering movement).
Window focus: only moves cursor if window has focus (inactive windows can't move cursor), cursor movement respects window boundaries (stays within window client area), fullscreen mode works identically (coordinates relative to fullscreen window).
Cursor visibility: works with hidden or visible cursor (inpMoveMouse moves cursor regardless of visibility), commonly used with inpHidePointer (hide cursor while centering for FPS controls), cursor position updates even when hidden (inpGetMouseX/Y reflect new position).
Use with speed functions: inpMoveMouse affects next frame's inpGetMouseXSpeed/YSpeed (system registers movement from centering), pattern: read delta first, then center (delta=speed(), then moveMouse()), ensures delta captures player movement before reset.
Related: inpGetMouseX/Y read current cursor position, inpGetMouseXSpeed/YSpeed read cursor movement delta, inpHidePointer hides cursor (often used with MoveMouse for FPS controls), inpShowPointer shows cursor.