-
Notifications
You must be signed in to change notification settings - Fork 1
π¦ Input
The Input module provides a unified system to handle user input from the keyboard, mouse, and joystick devices. It simplifies checking for pressed, held, or released states of keys and buttons, as well as retrieving mouse position and joystick axes.
It is built around the singleton INPUT class, with helper namespaces for Keyboard, Mouse, and Joystick.
-
Keyboarddefines a complete set of key codes. -
Mousedefines mouse button codes. -
Joystickdefines common controller buttons and exposes axis values.
The INPUT class manages all states and provides functions to query them.
bool IsKeyPressed(Keyboard::Key key)Checks if a key is currently being pressed.
Parameters:
-
key: Key code.
Returns: True if the key is pressed.
bool IsKeyDown(Keyboard::Key key)Checks if a key was just pressed down (triggers once per press).
Parameters:
-
key: Key code.
Returns: True if the key was pressed in the current frame.
bool IsMouseButtonPressed(Mouse::Button button)Checks if a mouse button is currently being pressed.
Parameters:
-
button: Mouse button.
Returns: True if pressed.
bool IsMouseButtonDown(Mouse::Button button)Checks if a mouse button was just pressed down (triggers once per press).
Parameters:
-
button: Mouse button.
Returns: True if pressed in the current frame.
Vector2 GetMousePosition()Retrieves the mouse position in world coordinates relative to the active window.
Returns: A Vector2 with the mouse coordinates.
Vector2 GetMousePositionOnWindow()Retrieves the mouse position in window pixel coordinates.
Returns: A Vector2 with the raw mouse position on the window.
bool IsButtonPressed(Joystick::Button button)Checks if a joystick button is currently pressed.
Parameters:
-
button: Joystick button.
Returns: True if pressed.
bool IsButtonDown(Joystick::Button button)Checks if a joystick button was just pressed down (triggers once per press).
Parameters:
-
button: Joystick button.
Returns: True if pressed in the current frame.
Vector2 GetXYAxis()Gets the X/Y axis values of the joystick.
Returns: A Vector2 with axis data.
Vector2 GetZRAxis()Gets the Z/R axis values of the joystick.
Returns: A Vector2 with axis data.
Vector2 GetUVAxis()Gets the U/V axis values of the joystick.
Returns: A Vector2 with axis data.
Vector2 GetPovAxis()Gets the POV hat axis values of the joystick.
Returns: A Vector2 with axis data.
Joystick::JoystickPtr GetJoystick(int joystick)Retrieves a joystick object by index.
Parameters:
-
joystick: Joystick ID (0β7).
Returns: A pointer to the joystick, or nullptr if not connected.
bool IsJoystickConnected(int joystick)Checks if a joystick is connected.
Parameters:
-
joystick: Joystick ID (0β7).
Returns: True if connected.