Implement UIs using RmlUi

This commit is contained in:
Lexi / Zoe 2026-05-10 23:23:40 +02:00
parent 8039b1276e
commit 7f37be386d
Signed by: binaryDiv
GPG key ID: F8D4956E224DA232
27 changed files with 1457 additions and 42 deletions

View file

@ -1,6 +1,6 @@
module;
#include <SDL3/SDL.h>
#include <SDL3/SDL_events.h>
export module wrappers.sdl.events;
@ -10,7 +10,7 @@ export namespace sdl
using Event = SDL_Event;
// Alias for EventType enum
using EventType_t = SDL_EventType;
using EventType = SDL_EventType;
/**
* Wrapper for the SDL_EventType enum.
@ -18,13 +18,30 @@ export namespace sdl
* 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 EventType
namespace EventTypes
{
constexpr EventType_t Quit = SDL_EVENT_QUIT;
constexpr EventType_t KeyDown = SDL_EVENT_KEY_DOWN;
constexpr EventType_t KeyUp = SDL_EVENT_KEY_UP;
constexpr EventType_t MouseMotion = SDL_EVENT_MOUSE_MOTION;
constexpr EventType_t MouseButtonUp = SDL_EVENT_MOUSE_BUTTON_UP;
constexpr EventType_t MouseButtonDown = SDL_EVENT_MOUSE_BUTTON_DOWN;
// 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;
}
}