Mouse
Functions for handling mouse input and cursor state.
Get Pos
get_pos() → Vec2
Get the current position of the mouse cursor.
Returns
Vec2
: The current mouse position as a 2D vector.
Get Rel
get_rel() → Vec2
Get the relative mouse movement since the last frame.
Returns
Vec2
: The relative movement of the mouse as a 2D vector.
Is Pressed
is_pressed(button: MouseButton) → bool
Check if a mouse button is currently pressed.
Parameters
button
: The mouse button to check.
Returns
bool
: True if the button is currently pressed.
Is Just Pressed
is_just_pressed(button: MouseButton) → bool
Check if a mouse button was pressed this frame.
Parameters
button
: The mouse button to check.
Returns
bool
: True if the button was just pressed.
Is Just Released
is_just_released(button: MouseButton) → bool
Check if a mouse button was released this frame.
Parameters
button
: The mouse button to check.
Returns
bool
: True if the button is currently pressed.
Lock
lock() → None
Lock the mouse to the center of the window.
Useful for first-person controls where you want to capture mouse movement without letting the cursor leave the window area.
Unlock
unlock() → None
Unlock the mouse from the window, allowing it to move freely.
Is Locked
is_locked() → bool
Check if the mouse is currently locked to the window.
Returns
bool
: True if the mouse is locked.
Hide
hide() → None
Hide the mouse cursor from view.
The cursor will be invisible but mouse input will still be tracked.
Show
show() → None
Show the mouse cursor if it was hidden.
Is Hidden
is_hidden() → bool
Check if the mouse cursor is currently hidden.
Returns
bool
: True if the cursor is hidden.