Mouse related functions
get_pos() → Vec2get_pos() → Vec2Get the current position of the mouse cursor.
Returns
Vec2 : The current mouse position as (x, y) coordinates.
get_rel() → Vec2get_rel() → Vec2Get the relative mouse movement since the last frame.
Returns
Vec2 : The relative movement of the mouse as (dx, dy).
is_pressed(button: MouseButton) → boolis_pressed(button: MouseButton) → boolCheck if a mouse button is currently pressed.
Args
button : The mouse button to check (e.g., kn.MOUSE_LEFT).Returns
bool : True if the button is currently pressed.
is_just_pressed(button: MouseButton) → boolis_just_pressed(button: MouseButton) → boolCheck if a mouse button was pressed this frame.
Args
button : The mouse button to check.Returns
bool : True if the button was just pressed.
is_just_released(button: MouseButton) → boolis_just_released(button: MouseButton) → boolCheck if a mouse button was released this frame.
Args
button : The mouse button to check.Returns
bool : True if the button was just released.
lock() → Nonelock() → NoneLock 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() → Noneunlock() → NoneUnlock the mouse from the window, allowing it to move freely.
is_locked() → boolis_locked() → boolCheck if the mouse is currently locked to the window.
Returns
bool : True if the mouse is locked.
hide() → Nonehide() → NoneHide the mouse cursor from view.
The cursor will be invisible but mouse input will still be tracked.
show() → Noneshow() → NoneShow the mouse cursor if it was hidden.
is_hidden() → boolis_hidden() → boolCheck if the mouse cursor is currently hidden.
Returns
bool : True if the cursor is hidden.