47 lines
1.6 KiB
C++
47 lines
1.6 KiB
C++
module;
|
|
|
|
#include <SDL3/SDL_events.h>
|
|
|
|
export module wrappers.sdl.events;
|
|
|
|
export namespace sdl
|
|
{
|
|
// Simple alias for SDL_Event union
|
|
using Event = SDL_Event;
|
|
|
|
// Alias for EventType enum
|
|
using EventType = SDL_EventType;
|
|
|
|
/**
|
|
* 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.
|
|
*/
|
|
namespace EventTypes
|
|
{
|
|
// 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;
|
|
}
|
|
}
|