aboutsummaryrefslogtreecommitdiff
path: root/src/crepe/facade/SDLContext.cpp
diff options
context:
space:
mode:
authorWBoerenkamps <wrj.boerenkamps@student.avans.nl>2024-12-14 13:52:56 +0100
committerWBoerenkamps <wrj.boerenkamps@student.avans.nl>2024-12-14 13:52:56 +0100
commitdbe779ca850ec0bf5d9b5066a7a6df44f3762e4d (patch)
treefe87bdbf86017ee1ee5fe75d89f599f5ae8a5be1 /src/crepe/facade/SDLContext.cpp
parentc17233b10bd8e35bead60c5f44bb8a14836d755f (diff)
make format
Diffstat (limited to 'src/crepe/facade/SDLContext.cpp')
-rw-r--r--src/crepe/facade/SDLContext.cpp9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/crepe/facade/SDLContext.cpp b/src/crepe/facade/SDLContext.cpp
index e5b0284..7ccc243 100644
--- a/src/crepe/facade/SDLContext.cpp
+++ b/src/crepe/facade/SDLContext.cpp
@@ -75,18 +75,17 @@ SDLContext::~SDLContext() {
}
Keycode SDLContext::sdl_to_keycode(SDL_Scancode sdl_key) {
- if (!LOOKUP_TABLE.contains(sdl_key))
- return Keycode::NONE;
+ if (!LOOKUP_TABLE.contains(sdl_key)) return Keycode::NONE;
return LOOKUP_TABLE.at(sdl_key);
}
-const keyboard_state_t& SDLContext::get_keyboard_state(){
+const keyboard_state_t & SDLContext::get_keyboard_state() {
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) {
this->keyboard_state[key] = current_state[i] != 0;
@@ -283,7 +282,7 @@ std::vector<EventData> SDLContext::get_events() {
case SDL_QUIT:
event_list.push_back({.event_type = EventType::SHUTDOWN});
break;
- case SDL_KEYDOWN:
+ case SDL_KEYDOWN:
event_list.push_back(EventData{
.event_type = EventType::KEY_DOWN,
.data = {