Input system class responsible for handling input events and updating input components.
More...
#include <InputSystem.hpp>
|
| struct | KeyState |
| | Key state structure. Used to track the state of keyboard keys needed forr held state. More...
|
Input system class responsible for handling input events and updating input components.
Definition at line 30 of file InputSystem.hpp.
◆ InputSystem()
| vex::InputSystem::InputSystem |
( |
vex::Registry & | registry, |
|
|
SDL_Window * | window ) |
Constructor for InputSystem.
- Parameters
-
| vex::Registry& | registry Reference to the entity registry. |
| SDL_Window* | window Pointer to the SDL window. |
Definition at line 10 of file InputSystem.cpp.
◆ getInputMode()
| InputMode vex::InputSystem::getInputMode |
( |
| ) |
const |
|
inline |
◆ processEvent()
| void vex::InputSystem::processEvent |
( |
const SDL_Event & | event, |
|
|
float | deltaTime ) |
Processes raw SDL events and maps them to Game Component actions.
Handles:
- Keyboard: Updates internal keyStates and triggers InputComponent bindings (Pressed/Released/Held).
- Mouse: Accumulates relative motion deltas for axis bindings.
- Gamepad: Handles button presses and axis motion (normalized to 0.0-1.0).
- Parameters
-
| const | SDL_Event& event - The raw SDL_Event to parse. |
| float | deltaTime - Time elapsed, passed to action callbacks. |
Definition at line 32 of file InputSystem.cpp.
◆ setInputMode()
| void vex::InputSystem::setInputMode |
( |
InputMode | mode | ) |
|
Sets the input processing mode.
- Game: Captures the mouse (Relative Mode) and hides the cursor via SDL_SetWindowRelativeMouseMode.
- UI: Releases the mouse and shows the cursor.
- Parameters
-
Definition at line 21 of file InputSystem.cpp.
◆ update()
| void vex::InputSystem::update |
( |
float | deltaTime | ) |
|
Per-frame update for continuous input states.
Specifically checks for and triggers actions bound to InputActionState::Held for both Keyboard and Gamepad buttons.
- Parameters
-
| float | deltaTime - Time elapsed since last frame. |
Definition at line 89 of file InputSystem.cpp.
◆ gamepadAxisStates
| std::unordered_map<SDL_GamepadAxis, float> vex::InputSystem::gamepadAxisStates |
|
private |
◆ gamepadButtonStates
| std::unordered_map<SDL_GamepadButton, KeyState> vex::InputSystem::gamepadButtonStates |
|
private |
◆ keyStates
| std::unordered_map<SDL_Scancode, KeyState> vex::InputSystem::keyStates |
|
private |
◆ m_inputMode
◆ m_registry
◆ m_window
| SDL_Window* vex::InputSystem::m_window |
|
private |
The documentation for this class was generated from the following files: