diff options
author | WBoerenkamps <wrj.boerenkamps@student.avans.nl> | 2024-12-13 08:16:48 +0100 |
---|---|---|
committer | WBoerenkamps <wrj.boerenkamps@student.avans.nl> | 2024-12-13 08:16:48 +0100 |
commit | 193d5bf4d9577e63202cec45b21ed85a76a89f09 (patch) | |
tree | f25e2f1d0efebcb72e3c411f380222a84459e37a /src/crepe/facade/SDLContext.h | |
parent | 6e2aa75019a28c298454f50b7bfb0dca100e0936 (diff) |
keyboard state implemented
Diffstat (limited to 'src/crepe/facade/SDLContext.h')
-rw-r--r-- | src/crepe/facade/SDLContext.h | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/src/crepe/facade/SDLContext.h b/src/crepe/facade/SDLContext.h index feb51f4..b10bcfe 100644 --- a/src/crepe/facade/SDLContext.h +++ b/src/crepe/facade/SDLContext.h @@ -125,16 +125,12 @@ public: /** * \brief Retrieves the current state of the keyboard. * - * This method returns the state of all keys on the keyboard, represented as a - * `std::array` of boolean values. Each element of the array corresponds to a + * This method updates the state of all keys on the keyboard. Each element of the unordered map corresponds to a * specific key defined in the `Keycode` enum, and the value indicates whether * the key is currently pressed (true) or not pressed (false). - * - * \return A `keyboard_state_t` representing the state of - * each key on the keyboard, where `true` means the key is pressed, and - * `false` means it is not pressed. + * */ - keyboard_state_t get_keyboard_state(); + void update_keyboard_state(); /** * \brief Gets the singleton instance of SDLContext. * \return Reference to the SDLContext instance. @@ -296,7 +292,7 @@ private: */ CameraAuxiliaryData cam_aux_data; private: - keyboard_state_t keyboard_state; + std::unordered_map<Keycode, bool> keyboard_state; const std::unordered_map<SDL_Scancode, Keycode> LOOKUP_TABLE = { {SDL_SCANCODE_SPACE, Keycode::SPACE}, {SDL_SCANCODE_APOSTROPHE, Keycode::APOSTROPHE}, |