aboutsummaryrefslogtreecommitdiff
path: root/src/crepe/facade
diff options
context:
space:
mode:
authorWBoerenkamps <wrj.boerenkamps@student.avans.nl>2024-12-09 15:29:51 +0100
committerWBoerenkamps <wrj.boerenkamps@student.avans.nl>2024-12-09 15:29:51 +0100
commitf6633670594e04baf77c14399c9f3bdaa49aecea (patch)
tree128a4e68e7efeba002322b6df34fa9f60a6ab27f /src/crepe/facade
parenta80477f2e7f4c18adcc6441828d17582aad2598f (diff)
make format
Diffstat (limited to 'src/crepe/facade')
-rw-r--r--src/crepe/facade/SDLContext.cpp29
-rw-r--r--src/crepe/facade/SDLContext.h2
2 files changed, 15 insertions, 16 deletions
diff --git a/src/crepe/facade/SDLContext.cpp b/src/crepe/facade/SDLContext.cpp
index 1e8af41..4504b95 100644
--- a/src/crepe/facade/SDLContext.cpp
+++ b/src/crepe/facade/SDLContext.cpp
@@ -191,22 +191,21 @@ Keycode SDLContext::sdl_to_keycode(SDL_Scancode sdl_key) {
return LOOKUP_TABLE[sdl_key];
}
std::array<bool, Keycode::NUM_KEYCODES> SDLContext::get_keyboard_state() {
- // Array to hold the key states (true if pressed, false if not)
- std::array<bool, Keycode::NUM_KEYCODES> keyState{};
- SDL_PumpEvents();
- const Uint8 *current_state = SDL_GetKeyboardState(nullptr);
-
- for (int i = 0; i < SDL_NUM_SCANCODES; ++i) {
- Keycode key = sdl_to_keycode(static_cast<SDL_Scancode>(i));
-
- if (key != Keycode::NONE) {
- keyState[key] = current_state[i] != 0;
- }
- }
-
- return keyState;
-}
+ // Array to hold the key states (true if pressed, false if not)
+ std::array<bool, Keycode::NUM_KEYCODES> keyState{};
+ SDL_PumpEvents();
+ const Uint8 * current_state = SDL_GetKeyboardState(nullptr);
+
+ for (int i = 0; i < SDL_NUM_SCANCODES; ++i) {
+ Keycode key = sdl_to_keycode(static_cast<SDL_Scancode>(i));
+
+ if (key != Keycode::NONE) {
+ keyState[key] = current_state[i] != 0;
+ }
+ }
+ return keyState;
+}
MouseButton SDLContext::sdl_to_mousebutton(Uint8 sdl_button) {
static const std::array<MouseButton, 5> MOUSE_BUTTON_LOOKUP_TABLE = [] {
diff --git a/src/crepe/facade/SDLContext.h b/src/crepe/facade/SDLContext.h
index 5182dca..053aa59 100644
--- a/src/crepe/facade/SDLContext.h
+++ b/src/crepe/facade/SDLContext.h
@@ -165,7 +165,7 @@ private:
* \return The corresponding `Keycode` value or `Keycode::NONE` if the key is unrecognized.
*/
Keycode sdl_to_keycode(SDL_Scancode sdl_key);
-
+
/**
* \brief Converts an SDL mouse button code to the custom MouseButton type.
*