libpromeki 1.0.0-alpha
PROfessional MEdia toolKIt
 
Loading...
Searching...
No Matches
sdleventpump.h
Go to the documentation of this file.
1
8#pragma once
9
10#include <cstdint>
11#include <promeki/namespace.h>
12#include <promeki/map.h>
13#include <promeki/keyevent.h>
14
15union SDL_Event;
16
17PROMEKI_NAMESPACE_BEGIN
18
19class SDLWindow;
20
38 public:
39 SDLEventPump() = default;
40 ~SDLEventPump() = default;
41
42 SDLEventPump(const SDLEventPump &) = delete;
43 SDLEventPump &operator=(const SDLEventPump &) = delete;
44
54 void pumpEvents();
55
61
67
73 SDLWindow *findWindow(uint32_t id) const;
74
75 private:
76 Map<uint32_t, SDLWindow *> _windowMap;
77
78 void dispatchEvent(const SDL_Event &e);
79 void handleWindowEvent(const SDL_Event &e);
80 void handleKeyEvent(const SDL_Event &e);
81 void handleMouseEvent(const SDL_Event &e);
82 void handleMouseWheelEvent(const SDL_Event &e);
83
84 static KeyEvent::Key translateKey(int sdlKeycode);
85 static uint8_t translateModifiers(uint16_t sdlMod);
86};
87
88PROMEKI_NAMESPACE_END
Pumps SDL events into the promeki event system.
Definition sdleventpump.h:37
void unregisterWindow(SDLWindow *window)
Unregisters a window from event routing.
void registerWindow(SDLWindow *window)
Registers a window for event routing.
SDLWindow * findWindow(uint32_t id) const
Finds a registered window by SDL window ID.
void pumpEvents()
Drains all pending SDL events and dispatches them.
Top-level SDL window that serves as a root Widget.
Definition sdlwindow.h:47