rutile-game/src/wrappers/sdl/events.cppm

48 lines
1.6 KiB
Text
Raw Normal View History

module;
2026-05-10 23:23:40 +02:00
#include <SDL3/SDL_events.h>
export module wrappers.sdl.events;
export namespace sdl
{
// Simple alias for SDL_Event union
using Event = SDL_Event;
2025-11-26 02:07:27 +01:00
// Alias for EventType enum
2026-05-10 23:23:40 +02:00
using EventType = SDL_EventType;
2025-11-26 02:07:27 +01:00
/**
* Wrapper for the SDL_EventType enum.
*
* We're using a namespace here to emulate an enum-like interface, without having to copy the entire enum.
* More constants can be added on demand.
*/
2026-05-10 23:23:40 +02:00
namespace EventTypes
2025-11-26 02:07:27 +01:00
{
2026-05-10 23:23:40 +02:00
// Application events
constexpr EventType Quit = SDL_EVENT_QUIT;
// Window events
constexpr EventType WindowMouseLeave = SDL_EVENT_WINDOW_MOUSE_LEAVE;
constexpr EventType WindowDisplayScaleChanged = SDL_EVENT_WINDOW_DISPLAY_SCALE_CHANGED;
constexpr EventType WindowPixelSizeChanged = SDL_EVENT_WINDOW_PIXEL_SIZE_CHANGED;
// Keyboard events
constexpr EventType KeyDown = SDL_EVENT_KEY_DOWN;
constexpr EventType KeyUp = SDL_EVENT_KEY_UP;
constexpr EventType TextInput = SDL_EVENT_TEXT_INPUT;
// Mouse events
constexpr EventType MouseMotion = SDL_EVENT_MOUSE_MOTION;
constexpr EventType MouseButtonDown = SDL_EVENT_MOUSE_BUTTON_DOWN;
constexpr EventType MouseButtonUp = SDL_EVENT_MOUSE_BUTTON_UP;
constexpr EventType MouseWheel = SDL_EVENT_MOUSE_WHEEL;
// Touch events
constexpr EventType FingerDown = SDL_EVENT_FINGER_DOWN;
constexpr EventType FingerUp = SDL_EVENT_FINGER_UP;
constexpr EventType FingerMotion = SDL_EVENT_FINGER_MOTION;
2025-11-26 02:07:27 +01:00
}
}