diff options
Diffstat (limited to 'floormat/events.hpp')
| -rw-r--r-- | floormat/events.hpp | 28 |
1 files changed, 13 insertions, 15 deletions
diff --git a/floormat/events.hpp b/floormat/events.hpp index 97c5f171..6ab1b3ae 100644 --- a/floormat/events.hpp +++ b/floormat/events.hpp @@ -1,23 +1,20 @@ #pragma once #include <Magnum/Math/Vector2.h> -#include <SDL_keycode.h> -#include <SDL_mouse.h> -#include <SDL_events.h> namespace floormat { enum mouse_button : std::uint8_t { mouse_button_none = 0, - mouse_button_left = SDL_BUTTON_LMASK, - mouse_button_middle = SDL_BUTTON_MMASK, - mouse_button_right = SDL_BUTTON_RMASK, - mouse_button_x1 = SDL_BUTTON_X1MASK, - mouse_button_x2 = SDL_BUTTON_X2MASK, + mouse_button_left = 1 << 0, + mouse_button_middle = 1 << 1, + mouse_button_right = 1 << 3, + mouse_button_x1 = 1 << 4, + mouse_button_x2 = 1 << 5, }; struct mouse_button_event final { Vector2i position; - SDL_Keymod mods = KMOD_NONE; + int mods = 0; mouse_button button = mouse_button_none; std::uint8_t click_count = 0; }; @@ -25,13 +22,13 @@ struct mouse_button_event final { struct mouse_move_event final { Vector2i position, relative_position; mouse_button buttons = mouse_button_none; - SDL_Keymod mods = KMOD_NONE; + int mods = 0; }; struct mouse_scroll_event final { Magnum::Vector2 offset; Vector2i position; - SDL_Keymod mods = KMOD_NONE; + int mods = 0; }; struct text_input_event final { @@ -44,13 +41,14 @@ struct text_editing_event final { }; struct key_event final { - SDL_Keycode key = SDLK_UNKNOWN; - SDL_Keymod mods = KMOD_NONE; + int key = 0; + int mods = 0; std::uint8_t is_repeated = false; }; -struct any_event final { - SDL_Event event = {}; +union alignas(alignof(void*)) any_event { + std::size_t size[0] = {}; + char buf[64]; }; } // namespace floormat |
