SDL3pp
A slim C++ wrapper for SDL3
Loading...
Searching...
No Matches
SDL3pp_events.h
1#ifndef SDL3PP_EVENTS_H_
2#define SDL3PP_EVENTS_H_
3
4#include <SDL3/SDL_events.h>
5#include "SDL3pp_stdinc.h"
6#include "SDL3pp_video.h"
7
8namespace SDL {
9
53using EventType = SDL_EventType;
54
55constexpr EventType EVENT_FIRST = SDL_EVENT_FIRST;
56
57constexpr EventType EVENT_QUIT = SDL_EVENT_QUIT;
58
64constexpr EventType EVENT_TERMINATING = SDL_EVENT_TERMINATING;
65
71constexpr EventType EVENT_LOW_MEMORY = SDL_EVENT_LOW_MEMORY;
72
79 SDL_EVENT_WILL_ENTER_BACKGROUND;
80
86constexpr EventType EVENT_DID_ENTER_BACKGROUND = SDL_EVENT_DID_ENTER_BACKGROUND;
87
94 SDL_EVENT_WILL_ENTER_FOREGROUND;
95
101constexpr EventType EVENT_DID_ENTER_FOREGROUND = SDL_EVENT_DID_ENTER_FOREGROUND;
102
104 SDL_EVENT_LOCALE_CHANGED;
105
107 SDL_EVENT_SYSTEM_THEME_CHANGED;
108
110 SDL_EVENT_DISPLAY_ORIENTATION;
111
113 SDL_EVENT_DISPLAY_ADDED;
114
116 SDL_EVENT_DISPLAY_REMOVED;
117
119 SDL_EVENT_DISPLAY_MOVED;
120
122 SDL_EVENT_DISPLAY_DESKTOP_MODE_CHANGED;
123
125 SDL_EVENT_DISPLAY_CURRENT_MODE_CHANGED;
126
128 SDL_EVENT_DISPLAY_CONTENT_SCALE_CHANGED;
130
131#if SDL_VERSION_ATLEAST(3, 4, 0)
132
134 SDL_EVENT_DISPLAY_USABLE_BOUNDS_CHANGED;
136
137#endif // SDL_VERSION_ATLEAST(3, 4, 0)
138
140 SDL_EVENT_DISPLAY_FIRST;
141
143 SDL_EVENT_DISPLAY_LAST;
144
146 SDL_EVENT_WINDOW_SHOWN;
147
149 SDL_EVENT_WINDOW_HIDDEN;
150
156constexpr EventType EVENT_WINDOW_EXPOSED = SDL_EVENT_WINDOW_EXPOSED;
157
159 SDL_EVENT_WINDOW_MOVED;
160
162 SDL_EVENT_WINDOW_RESIZED;
163
166 SDL_EVENT_WINDOW_PIXEL_SIZE_CHANGED;
167
170 SDL_EVENT_WINDOW_METAL_VIEW_RESIZED;
171
173 SDL_EVENT_WINDOW_MINIMIZED;
174
176 SDL_EVENT_WINDOW_MAXIMIZED;
177
179constexpr EventType EVENT_WINDOW_RESTORED = SDL_EVENT_WINDOW_RESTORED;
180
182 SDL_EVENT_WINDOW_MOUSE_ENTER;
183
185 SDL_EVENT_WINDOW_MOUSE_LEAVE;
186
188 SDL_EVENT_WINDOW_FOCUS_GAINED;
189
191 SDL_EVENT_WINDOW_FOCUS_LOST;
192
195 SDL_EVENT_WINDOW_CLOSE_REQUESTED;
196
198 SDL_EVENT_WINDOW_HIT_TEST;
200
203 SDL_EVENT_WINDOW_ICCPROF_CHANGED;
204
206 SDL_EVENT_WINDOW_DISPLAY_CHANGED;
207
209 SDL_EVENT_WINDOW_DISPLAY_SCALE_CHANGED;
211
213 SDL_EVENT_WINDOW_SAFE_AREA_CHANGED;
214
216 SDL_EVENT_WINDOW_OCCLUDED;
217
219 SDL_EVENT_WINDOW_ENTER_FULLSCREEN;
220
222 SDL_EVENT_WINDOW_LEAVE_FULLSCREEN;
223
231constexpr EventType EVENT_WINDOW_DESTROYED = SDL_EVENT_WINDOW_DESTROYED;
232
234 SDL_EVENT_WINDOW_HDR_STATE_CHANGED;
235
237 SDL_EVENT_WINDOW_FIRST;
238
239constexpr EventType EVENT_WINDOW_LAST = SDL_EVENT_WINDOW_LAST;
240
241constexpr EventType EVENT_KEY_DOWN = SDL_EVENT_KEY_DOWN;
242
243constexpr EventType EVENT_KEY_UP = SDL_EVENT_KEY_UP;
244
246 SDL_EVENT_TEXT_EDITING;
247
249 SDL_EVENT_TEXT_INPUT;
250
255constexpr EventType EVENT_KEYMAP_CHANGED = SDL_EVENT_KEYMAP_CHANGED;
256
258 SDL_EVENT_KEYBOARD_ADDED;
260
262 SDL_EVENT_KEYBOARD_REMOVED;
263
265 SDL_EVENT_TEXT_EDITING_CANDIDATES;
266
267#if SDL_VERSION_ATLEAST(3, 4, 0)
268
270 SDL_EVENT_SCREEN_KEYBOARD_SHOWN;
271
273 SDL_EVENT_SCREEN_KEYBOARD_HIDDEN;
274
275#endif // SDL_VERSION_ATLEAST(3, 4, 0)
276
278 SDL_EVENT_MOUSE_MOTION;
279
281 SDL_EVENT_MOUSE_BUTTON_DOWN;
282
284 SDL_EVENT_MOUSE_BUTTON_UP;
285
287 SDL_EVENT_MOUSE_WHEEL;
288
290 SDL_EVENT_MOUSE_ADDED;
291
293 SDL_EVENT_MOUSE_REMOVED;
294
296 SDL_EVENT_JOYSTICK_AXIS_MOTION;
297
299 SDL_EVENT_JOYSTICK_BALL_MOTION;
300
302 SDL_EVENT_JOYSTICK_HAT_MOTION;
303
305 SDL_EVENT_JOYSTICK_BUTTON_DOWN;
306
308 SDL_EVENT_JOYSTICK_BUTTON_UP;
309
311 SDL_EVENT_JOYSTICK_ADDED;
313
315 SDL_EVENT_JOYSTICK_REMOVED;
316
318 SDL_EVENT_JOYSTICK_BATTERY_UPDATED;
319
321 SDL_EVENT_JOYSTICK_UPDATE_COMPLETE;
322
324 SDL_EVENT_GAMEPAD_AXIS_MOTION;
325
327 SDL_EVENT_GAMEPAD_BUTTON_DOWN;
328
330 SDL_EVENT_GAMEPAD_BUTTON_UP;
331
333 SDL_EVENT_GAMEPAD_ADDED;
334
336 SDL_EVENT_GAMEPAD_REMOVED;
337
339 SDL_EVENT_GAMEPAD_REMAPPED;
340
342 SDL_EVENT_GAMEPAD_TOUCHPAD_DOWN;
343
345 SDL_EVENT_GAMEPAD_TOUCHPAD_MOTION;
346
348 SDL_EVENT_GAMEPAD_TOUCHPAD_UP;
349
351 SDL_EVENT_GAMEPAD_SENSOR_UPDATE;
352
354 SDL_EVENT_GAMEPAD_UPDATE_COMPLETE;
355
357 SDL_EVENT_GAMEPAD_STEAM_HANDLE_UPDATED;
358
359constexpr EventType EVENT_FINGER_DOWN = SDL_EVENT_FINGER_DOWN;
360
361constexpr EventType EVENT_FINGER_UP = SDL_EVENT_FINGER_UP;
362
364 SDL_EVENT_FINGER_MOTION;
365
367 SDL_EVENT_FINGER_CANCELED;
368
369#if SDL_VERSION_ATLEAST(3, 4, 0)
370
372 SDL_EVENT_PINCH_BEGIN;
373
375 SDL_EVENT_PINCH_UPDATE;
376
378 SDL_EVENT_PINCH_END;
379
380#endif // SDL_VERSION_ATLEAST(3, 4, 0)
381
383 SDL_EVENT_CLIPBOARD_UPDATE;
384
386 SDL_EVENT_DROP_FILE;
387
389 SDL_EVENT_DROP_TEXT;
390
392 SDL_EVENT_DROP_BEGIN;
393
395constexpr EventType EVENT_DROP_COMPLETE = SDL_EVENT_DROP_COMPLETE;
396
398 SDL_EVENT_DROP_POSITION;
399
401 SDL_EVENT_AUDIO_DEVICE_ADDED;
402
404 SDL_EVENT_AUDIO_DEVICE_REMOVED;
405
408 SDL_EVENT_AUDIO_DEVICE_FORMAT_CHANGED;
409
411 SDL_EVENT_SENSOR_UPDATE;
412
414 SDL_EVENT_PEN_PROXIMITY_IN;
415
417 SDL_EVENT_PEN_PROXIMITY_OUT;
419
421 SDL_EVENT_PEN_DOWN;
422
424constexpr EventType EVENT_PEN_UP = SDL_EVENT_PEN_UP;
425
427 SDL_EVENT_PEN_BUTTON_DOWN;
428
430 SDL_EVENT_PEN_BUTTON_UP;
431
433 SDL_EVENT_PEN_MOTION;
434
436 SDL_EVENT_PEN_AXIS;
437
439 SDL_EVENT_CAMERA_DEVICE_ADDED;
440
442 SDL_EVENT_CAMERA_DEVICE_REMOVED;
443
446 SDL_EVENT_CAMERA_DEVICE_APPROVED;
447
449constexpr EventType EVENT_CAMERA_DEVICE_DENIED = SDL_EVENT_CAMERA_DEVICE_DENIED;
450
452constexpr EventType EVENT_RENDER_TARGETS_RESET = SDL_EVENT_RENDER_TARGETS_RESET;
453
455constexpr EventType EVENT_RENDER_DEVICE_RESET = SDL_EVENT_RENDER_DEVICE_RESET;
456
458 SDL_EVENT_RENDER_DEVICE_LOST;
460
461constexpr EventType EVENT_PRIVATE0 = SDL_EVENT_PRIVATE0;
462
463constexpr EventType EVENT_PRIVATE1 = SDL_EVENT_PRIVATE1;
464
465constexpr EventType EVENT_PRIVATE2 = SDL_EVENT_PRIVATE2;
466
467constexpr EventType EVENT_PRIVATE3 = SDL_EVENT_PRIVATE3;
468
470 SDL_EVENT_POLL_SENTINEL;
471
476constexpr EventType EVENT_USER = SDL_EVENT_USER;
477
479constexpr EventType EVENT_LAST = SDL_EVENT_LAST;
480
482 SDL_EVENT_ENUM_PADDING;
483
485
491using CommonEvent = SDL_CommonEvent;
492
498using DisplayEvent = SDL_DisplayEvent;
499
505using WindowEvent = SDL_WindowEvent;
506
512using KeyboardDeviceEvent = SDL_KeyboardDeviceEvent;
513
528using KeyboardEvent = SDL_KeyboardEvent;
529
539using TextEditingEvent = SDL_TextEditingEvent;
540
546using TextEditingCandidatesEvent = SDL_TextEditingCandidatesEvent;
547
559using TextInputEvent = SDL_TextInputEvent;
560
566using MouseDeviceEvent = SDL_MouseDeviceEvent;
567
573using MouseMotionEvent = SDL_MouseMotionEvent;
574
580using MouseButtonEvent = SDL_MouseButtonEvent;
581
587using MouseWheelEvent = SDL_MouseWheelEvent;
588
594using JoyAxisEvent = SDL_JoyAxisEvent;
595
601using JoyBallEvent = SDL_JoyBallEvent;
602
608using JoyHatEvent = SDL_JoyHatEvent;
609
615using JoyButtonEvent = SDL_JoyButtonEvent;
616
627using JoyDeviceEvent = SDL_JoyDeviceEvent;
628
634using JoyBatteryEvent = SDL_JoyBatteryEvent;
635
641using GamepadAxisEvent = SDL_GamepadAxisEvent;
642
648using GamepadButtonEvent = SDL_GamepadButtonEvent;
649
664using GamepadDeviceEvent = SDL_GamepadDeviceEvent;
665
671using GamepadTouchpadEvent = SDL_GamepadTouchpadEvent;
672
678using GamepadSensorEvent = SDL_GamepadSensorEvent;
679
689using AudioDeviceEvent = SDL_AudioDeviceEvent;
690
696using CameraDeviceEvent = SDL_CameraDeviceEvent;
697
703using RenderEvent = SDL_RenderEvent;
704
723using TouchFingerEvent = SDL_TouchFingerEvent;
724
725#if SDL_VERSION_ATLEAST(3, 4, 0)
726
728using PinchFingerEvent = SDL_PinchFingerEvent;
729
730#endif // SDL_VERSION_ATLEAST(3, 4, 0)
731
750using PenProximityEvent = SDL_PenProximityEvent;
751
762using PenMotionEvent = SDL_PenMotionEvent;
763
772using PenTouchEvent = SDL_PenTouchEvent;
773
782using PenButtonEvent = SDL_PenButtonEvent;
783
791using PenAxisEvent = SDL_PenAxisEvent;
792
799using DropEvent = SDL_DropEvent;
800
807using ClipboardEvent = SDL_ClipboardEvent;
808
814using SensorEvent = SDL_SensorEvent;
815
821using QuitEvent = SDL_QuitEvent;
822
834using UserEvent = SDL_UserEvent;
835
844using Event = SDL_Event;
845
866inline void PumpEvents() { SDL_PumpEvents(); }
867
879using EventAction = SDL_EventAction;
880
882 SDL_ADDEVENT;
883
885constexpr EventAction PEEKEVENT = SDL_PEEKEVENT;
886
888constexpr EventAction GETEVENT = SDL_GETEVENT;
889
891
935inline int PeepEvents(Event* events,
936 int numevents,
937 EventAction action,
938 Uint32 minType = EVENT_FIRST,
939 Uint32 maxType = EVENT_LAST)
940{
941 return SDL_PeepEvents(events, numevents, action, minType, maxType);
942}
943
959inline bool HasEvent(Uint32 type) { return SDL_HasEvent(type); }
960
979inline bool HasEvents(Uint32 minType = EVENT_FIRST, Uint32 maxType = EVENT_LAST)
980{
981 return SDL_HasEvents(minType, maxType);
982}
983
1009inline void FlushEvent(Uint32 type) { SDL_FlushEvent(type); }
1010
1036inline void FlushEvents(Uint32 minType = EVENT_FIRST,
1037 Uint32 maxType = EVENT_LAST)
1038{
1039 SDL_FlushEvents(minType, maxType);
1040}
1041
1093inline bool PollEvent(Event* event) { return SDL_PollEvent(event); }
1094
1138inline std::optional<Event> PollEvent()
1139{
1140 if (Event event; PollEvent(&event)) return event;
1141 return std::nullopt;
1142}
1143
1165inline void WaitEvent(Event* event) { CheckError(SDL_WaitEvent(event)); }
1166
1188{
1189 Event event;
1190 WaitEvent(&event);
1191 return event;
1192}
1193
1222inline bool WaitEventTimeout(Event* event, Sint32 timeoutMS)
1223{
1224 return SDL_WaitEventTimeout(event, timeoutMS);
1225}
1226
1250inline std::optional<Event> WaitEventTimeout(Sint32 timeoutMS)
1251{
1252 if (Event event; WaitEventTimeout(&event, timeoutMS)) return event;
1253 return std::nullopt;
1254}
1255
1284inline bool WaitEventTimeout(Event* event,
1285 std::chrono::milliseconds timeoutDuration)
1286{
1287 return WaitEventTimeout(event,
1288 Sint32(std::max(timeoutDuration.count(), Sint64(1))));
1289}
1290
1316inline std::optional<Event> WaitEventTimeout(
1317 std::chrono::milliseconds timeoutDuration)
1318{
1319 if (Event event; WaitEventTimeout(&event, timeoutDuration)) return event;
1320 return std::nullopt;
1321}
1322
1353inline void PushEvent(Event* event) { CheckError(SDL_PushEvent(event)); }
1354
1385inline void PushEvent(const Event& event)
1386{
1387 PushEvent(const_cast<Event*>(&event));
1388}
1389
1408using EventFilter = bool(SDLCALL*)(void* userdata, Event* event);
1409
1429using EventFilterCB = std::function<bool(Event* event)>;
1430
1452
1493inline void SetEventFilter(EventFilter filter, void* userdata)
1494{
1495 SDL_SetEventFilter(filter, userdata);
1496}
1497
1540{
1541 static EventFilterCB staticFilter;
1542 staticFilter = filter;
1543 SetEventFilter([](void*, Event* event) { return staticFilter(event); },
1544 nullptr);
1545}
1546
1564inline void GetEventFilter(EventFilter* filter, void** userdata)
1565{
1566 CheckError(SDL_GetEventFilter(filter, userdata));
1567}
1568
1598inline void AddEventWatch(EventFilter filter, void* userdata)
1599{
1600 CheckError(SDL_AddEventWatch(filter, userdata));
1601}
1602
1634{
1635 AddEventWatch(filter.wrapper, filter.data);
1636}
1637
1653inline void RemoveEventWatch(EventFilter filter, void* userdata)
1654{
1655 SDL_RemoveEventWatch(filter, userdata);
1656}
1657
1676inline void FilterEvents(EventFilter filter, void* userdata)
1677{
1678 SDL_FilterEvents(filter, userdata);
1679}
1680
1700inline void FilterEvents(EventFilterCB filter)
1701{
1702 return FilterEvents(
1703 [](void* userdata, Event* event) {
1704 const auto& f = *static_cast<EventFilterCB*>(userdata);
1705 return f(event);
1706 },
1707 &filter);
1708}
1709
1722inline void SetEventEnabled(Uint32 type, bool enabled)
1723{
1724 SDL_SetEventEnabled(type, enabled);
1725}
1726
1739inline bool EventEnabled(Uint32 type) { return SDL_EventEnabled(type); }
1740
1755inline Uint32 RegisterEvents(int numevents)
1756{
1757 return SDL_RegisterEvents(numevents);
1758}
1759
1776{
1777 return {CheckError(SDL_GetWindowFromEvent(&event))};
1778}
1779
1780#if SDL_VERSION_ATLEAST(3, 4, 0)
1781
1812inline int GetEventDescription(const Event& event, TargetBytes buf)
1813{
1814 if (buf.size_bytes() == 0) return SDL_GetEventDescription(&event, nullptr, 0);
1815 return SDL_GetEventDescription(&event, buf.data(), buf.size_bytes());
1816}
1817
1845inline std::string GetEventDescription(const Event& event)
1846{
1847 int sz = SDL_GetEventDescription(&event, nullptr, 0);
1848 std::string r;
1849 r.reserve(sz);
1850 GetEventDescription(event, r);
1851 return r;
1852}
1853
1854#endif // SDL_VERSION_ATLEAST(3, 4, 0)
1855
1857
1858} // namespace SDL
1859
1860#endif /* SDL3PP_EVENTS_H_ */
Target byte stream.
Definition: SDL3pp_strings.h:326
constexpr char * data() const
Retrieves contained data.
Definition: SDL3pp_strings.h:412
constexpr size_t size_bytes() const
Retrieves contained size in bytes.
Definition: SDL3pp_strings.h:409
constexpr void CheckError(bool result)
Check and throw if returned value from SDL is an error.
Definition: SDL3pp_error.h:197
bool(SDLCALL *)(void *userdata, Event *event) EventFilter
A function pointer used for callbacks that watch the event queue.
Definition: SDL3pp_events.h:1408
void FlushEvent(Uint32 type)
Clear events of a specific type from the event queue.
Definition: SDL3pp_events.h:1009
void RemoveEventWatch(EventFilter filter, void *userdata)
Remove an event watch callback added with AddEventWatch().
Definition: SDL3pp_events.h:1653
int PeepEvents(Event *events, int numevents, EventAction action, Uint32 minType=EVENT_FIRST, Uint32 maxType=EVENT_LAST)
Check the event queue for messages and optionally return them.
Definition: SDL3pp_events.h:935
SDL_PenProximityEvent PenProximityEvent
Pressure-sensitive pen proximity event structure (event.pproximity.
Definition: SDL3pp_events.h:750
SDL_GamepadButtonEvent GamepadButtonEvent
Gamepad button event structure (event.gbutton.
Definition: SDL3pp_events.h:648
void GetEventFilter(EventFilter *filter, void **userdata)
Query the current event filter.
Definition: SDL3pp_events.h:1564
SDL_WindowEvent WindowEvent
Window state change event data (event.window.
Definition: SDL3pp_events.h:505
bool HasEvents(Uint32 minType=EVENT_FIRST, Uint32 maxType=EVENT_LAST)
Check for the existence of certain event types in the event queue.
Definition: SDL3pp_events.h:979
SDL_RenderEvent RenderEvent
Renderer event structure (event.render.
Definition: SDL3pp_events.h:703
SDL_JoyAxisEvent JoyAxisEvent
Joystick axis motion event structure (event.jaxis.
Definition: SDL3pp_events.h:594
SDL_CameraDeviceEvent CameraDeviceEvent
Camera device event structure (event.cdevice.
Definition: SDL3pp_events.h:696
SDL_GamepadAxisEvent GamepadAxisEvent
Gamepad axis motion event structure (event.gaxis.
Definition: SDL3pp_events.h:641
SDL_GamepadDeviceEvent GamepadDeviceEvent
Gamepad device event structure (event.gdevice.
Definition: SDL3pp_events.h:664
SDL_ClipboardEvent ClipboardEvent
An event triggered when the clipboard contents have changed (event.clipboard.
Definition: SDL3pp_events.h:807
SDL_GamepadSensorEvent GamepadSensorEvent
Gamepad sensor event structure (event.gsensor.
Definition: SDL3pp_events.h:678
SDL_MouseDeviceEvent MouseDeviceEvent
Mouse device event structure (event.mdevice.
Definition: SDL3pp_events.h:566
SDL_TouchFingerEvent TouchFingerEvent
Touch finger event structure (event.tfinger.
Definition: SDL3pp_events.h:723
std::function< bool(Event *event)> EventFilterCB
A std::function used for callbacks that watch the event queue.
Definition: SDL3pp_events.h:1429
SDL_SensorEvent SensorEvent
Sensor event structure (event.sensor.
Definition: SDL3pp_events.h:814
SDL_GamepadTouchpadEvent GamepadTouchpadEvent
Gamepad touchpad event structure (event.gtouchpad.
Definition: SDL3pp_events.h:671
void FlushEvents(Uint32 minType=EVENT_FIRST, Uint32 maxType=EVENT_LAST)
Clear events of a range of types from the event queue.
Definition: SDL3pp_events.h:1036
Uint32 RegisterEvents(int numevents)
Allocate a set of user-defined events, and return the beginning event number for that set of events.
Definition: SDL3pp_events.h:1755
SDL_PenTouchEvent PenTouchEvent
Pressure-sensitive pen touched event structure (event.ptouch.
Definition: SDL3pp_events.h:772
SDL_KeyboardDeviceEvent KeyboardDeviceEvent
Keyboard device event structure (event.kdevice.
Definition: SDL3pp_events.h:512
SDL_AudioDeviceEvent AudioDeviceEvent
Audio device event structure (event.adevice.
Definition: SDL3pp_events.h:689
SDL_DropEvent DropEvent
An event used to drop text or request a file open by the system (event.drop.
Definition: SDL3pp_events.h:799
SDL_MouseButtonEvent MouseButtonEvent
Mouse button event structure (event.button.
Definition: SDL3pp_events.h:580
constexpr EventAction GETEVENT
Retrieve/remove events from the front of the queue.
Definition: SDL3pp_events.h:888
SDL_JoyBatteryEvent JoyBatteryEvent
Joystick battery level change event structure (event.jbattery.
Definition: SDL3pp_events.h:634
SDL_EventAction EventAction
The type of action to request from PeepEvents().
Definition: SDL3pp_events.h:879
SDL_DisplayEvent DisplayEvent
Display state change event data (event.display.
Definition: SDL3pp_events.h:498
bool WaitEventTimeout(Event *event, Sint32 timeoutMS)
Wait until the specified timeout (in milliseconds) for the next available event.
Definition: SDL3pp_events.h:1222
void SetEventEnabled(Uint32 type, bool enabled)
Set the state of processing events by type.
Definition: SDL3pp_events.h:1722
SDL_Event Event
The structure for all events in SDL.
Definition: SDL3pp_events.h:844
SDL_TextEditingEvent TextEditingEvent
Keyboard text editing event structure (event.edit.
Definition: SDL3pp_events.h:539
int GetEventDescription(const Event &event, TargetBytes buf)
Generate an English description of an event.
Definition: SDL3pp_events.h:1812
SDL_UserEvent UserEvent
A user-defined event type (event.user.
Definition: SDL3pp_events.h:834
std::optional< Event > PollEvent()
Poll for currently pending events.
Definition: SDL3pp_events.h:1138
Event WaitEvent()
Wait indefinitely for the next available event.
Definition: SDL3pp_events.h:1187
SDL_TextEditingCandidatesEvent TextEditingCandidatesEvent
Keyboard IME candidates event structure (event.edit_candidates.
Definition: SDL3pp_events.h:546
WindowRef GetWindowFromEvent(const Event &event)
Get window associated with an event.
Definition: SDL3pp_events.h:1775
void PushEvent(Event *event)
Add an event to the event queue.
Definition: SDL3pp_events.h:1353
void SetEventFilter(EventFilter filter, void *userdata)
Set up a filter to process all events before they are added to the internal event queue.
Definition: SDL3pp_events.h:1493
SDL_PenAxisEvent PenAxisEvent
Pressure-sensitive pen pressure / angle event structure (event.paxis.
Definition: SDL3pp_events.h:791
SDL_KeyboardEvent KeyboardEvent
Keyboard button event structure (event.key.
Definition: SDL3pp_events.h:528
constexpr EventAction ADDEVENT
Add events to the back of the queue.
Definition: SDL3pp_events.h:881
bool HasEvent(Uint32 type)
Check for the existence of a certain event type in the event queue.
Definition: SDL3pp_events.h:959
SDL_MouseMotionEvent MouseMotionEvent
Mouse motion event structure (event.motion.
Definition: SDL3pp_events.h:573
SDL_JoyHatEvent JoyHatEvent
Joystick hat position change event structure (event.jhat.
Definition: SDL3pp_events.h:608
void AddEventWatch(EventFilter filter, void *userdata)
Add a callback to be triggered when an event is added to the event queue.
Definition: SDL3pp_events.h:1598
void FilterEvents(EventFilter filter, void *userdata)
Run a specific filter function on the current event queue, removing any events for which the filter r...
Definition: SDL3pp_events.h:1676
SDL_PinchFingerEvent PinchFingerEvent
Pinch event structure (event.pinch.*)
Definition: SDL3pp_events.h:728
SDL_MouseWheelEvent MouseWheelEvent
Mouse wheel event structure (event.wheel.
Definition: SDL3pp_events.h:587
SDL_CommonEvent CommonEvent
Fields shared by every event.
Definition: SDL3pp_events.h:491
SDL_JoyButtonEvent JoyButtonEvent
Joystick button event structure (event.jbutton.
Definition: SDL3pp_events.h:615
SDL_PenButtonEvent PenButtonEvent
Pressure-sensitive pen button event structure (event.pbutton.
Definition: SDL3pp_events.h:782
SDL_TextInputEvent TextInputEvent
Keyboard text input event structure (event.text.
Definition: SDL3pp_events.h:559
constexpr EventAction PEEKEVENT
Check but don't remove events from the queue front.
Definition: SDL3pp_events.h:885
SDL_QuitEvent QuitEvent
The "quit requested" event.
Definition: SDL3pp_events.h:821
bool EventEnabled(Uint32 type)
Query the state of processing events by type.
Definition: SDL3pp_events.h:1739
SDL_JoyDeviceEvent JoyDeviceEvent
Joystick device event structure (event.jdevice.
Definition: SDL3pp_events.h:627
SDL_JoyBallEvent JoyBallEvent
Joystick trackball motion event structure (event.jball.
Definition: SDL3pp_events.h:601
void PumpEvents()
Pump the event loop, gathering events from the input devices.
Definition: SDL3pp_events.h:866
SDL_PenMotionEvent PenMotionEvent
Pressure-sensitive pen motion event structure (event.pmotion.
Definition: SDL3pp_events.h:762
::Uint32 Uint32
An unsigned 32-bit integer type.
Definition: SDL3pp_stdinc.h:341
::Sint64 Sint64
A signed 64-bit integer type.
Definition: SDL3pp_stdinc.h:356
::Sint32 Sint32
A signed 32-bit integer type.
Definition: SDL3pp_stdinc.h:328
constexpr EventType EVENT_PEN_UP
Pressure-sensitive pen stopped touching drawing surface.
Definition: SDL3pp_events.h:424
constexpr EventType EVENT_WINDOW_SAFE_AREA_CHANGED
The window safe area has been changed.
Definition: SDL3pp_events.h:212
constexpr EventType EVENT_DROP_FILE
The system requests a file open.
Definition: SDL3pp_events.h:385
constexpr EventType EVENT_PINCH_UPDATE
Pinch gesture updated.
Definition: SDL3pp_events.h:374
constexpr EventType EVENT_PEN_MOTION
Pressure-sensitive pen is moving on the tablet.
Definition: SDL3pp_events.h:432
constexpr EventType EVENT_DISPLAY_ORIENTATION
Display orientation has changed to data1.
Definition: SDL3pp_events.h:109
constexpr EventType EVENT_JOYSTICK_BUTTON_UP
Joystick button released.
Definition: SDL3pp_events.h:307
constexpr EventType EVENT_KEYBOARD_REMOVED
A keyboard has been removed.
Definition: SDL3pp_events.h:261
constexpr EventType EVENT_DISPLAY_ADDED
Display has been added to the system.
Definition: SDL3pp_events.h:112
constexpr EventType EVENT_AUDIO_DEVICE_ADDED
A new audio device is available.
Definition: SDL3pp_events.h:400
constexpr EventType EVENT_WINDOW_MOUSE_ENTER
Window has gained mouse focus.
Definition: SDL3pp_events.h:181
constexpr EventType EVENT_GAMEPAD_REMAPPED
The gamepad mapping was updated.
Definition: SDL3pp_events.h:338
constexpr EventType EVENT_PRIVATE0
PRIVATE0.
Definition: SDL3pp_events.h:461
constexpr EventType EVENT_RENDER_DEVICE_LOST
The device has been lost and can't be recovered.
Definition: SDL3pp_events.h:457
constexpr EventType EVENT_WINDOW_OCCLUDED
The window has been occluded.
Definition: SDL3pp_events.h:215
constexpr EventType EVENT_WINDOW_MOVED
Window has been moved to data1, data2.
Definition: SDL3pp_events.h:158
constexpr EventType EVENT_JOYSTICK_HAT_MOTION
Joystick hat position change.
Definition: SDL3pp_events.h:301
constexpr EventType EVENT_WINDOW_LEAVE_FULLSCREEN
The window has left fullscreen mode.
Definition: SDL3pp_events.h:221
constexpr EventType EVENT_PRIVATE2
PRIVATE2.
Definition: SDL3pp_events.h:465
constexpr EventType EVENT_DROP_BEGIN
A new set of drops is beginning (NULL filename)
Definition: SDL3pp_events.h:391
constexpr EventType EVENT_CAMERA_DEVICE_APPROVED
A camera device has been approved for use by the user.
Definition: SDL3pp_events.h:445
constexpr EventType EVENT_WILL_ENTER_BACKGROUND
The application is about to enter the background.
Definition: SDL3pp_events.h:78
constexpr EventType EVENT_WINDOW_EXPOSED
Window has been exposed and should be redrawn, and can be redrawn directly from event watchers for th...
Definition: SDL3pp_events.h:156
constexpr EventType EVENT_WINDOW_ICCPROF_CHANGED
The ICC profile of the window's display has changed.
Definition: SDL3pp_events.h:202
constexpr EventType EVENT_GAMEPAD_REMOVED
A gamepad has been removed.
Definition: SDL3pp_events.h:335
constexpr EventType EVENT_DISPLAY_CURRENT_MODE_CHANGED
Display has changed current mode.
Definition: SDL3pp_events.h:124
constexpr EventType EVENT_DID_ENTER_FOREGROUND
The application is now interactive.
Definition: SDL3pp_events.h:101
constexpr EventType EVENT_MOUSE_BUTTON_UP
Mouse button released.
Definition: SDL3pp_events.h:283
constexpr EventType EVENT_KEYBOARD_ADDED
A new keyboard has been inserted into the system.
Definition: SDL3pp_events.h:257
constexpr EventType EVENT_AUDIO_DEVICE_REMOVED
An audio device has been removed.
Definition: SDL3pp_events.h:403
constexpr EventType EVENT_DISPLAY_CONTENT_SCALE_CHANGED
Display has changed content scale.
Definition: SDL3pp_events.h:127
constexpr EventType EVENT_WINDOW_RESTORED
Window has been restored to normal size and position.
Definition: SDL3pp_events.h:179
constexpr EventType EVENT_WINDOW_HIT_TEST
Window had a hit test that wasn't HITTEST_NORMAL.
Definition: SDL3pp_events.h:197
constexpr EventType EVENT_JOYSTICK_BUTTON_DOWN
Joystick button pressed.
Definition: SDL3pp_events.h:304
constexpr EventType EVENT_DISPLAY_MOVED
Display has changed position.
Definition: SDL3pp_events.h:118
constexpr EventType EVENT_PEN_BUTTON_UP
Pressure-sensitive pen button released.
Definition: SDL3pp_events.h:429
constexpr EventType EVENT_KEY_UP
Key released.
Definition: SDL3pp_events.h:243
constexpr EventType EVENT_MOUSE_ADDED
A new mouse has been inserted into the system.
Definition: SDL3pp_events.h:289
constexpr EventType EVENT_POLL_SENTINEL
Signals the end of an event poll cycle.
Definition: SDL3pp_events.h:469
constexpr EventType EVENT_MOUSE_REMOVED
A mouse has been removed.
Definition: SDL3pp_events.h:292
constexpr EventType EVENT_DROP_POSITION
Position while moving over the window.
Definition: SDL3pp_events.h:397
constexpr EventType EVENT_JOYSTICK_BATTERY_UPDATED
Joystick battery level change.
Definition: SDL3pp_events.h:317
constexpr EventType EVENT_TEXT_INPUT
Keyboard text input.
Definition: SDL3pp_events.h:248
constexpr EventType EVENT_PINCH_END
Pinch gesture ended.
Definition: SDL3pp_events.h:377
constexpr EventType EVENT_DISPLAY_LAST
DISPLAY_LAST.
Definition: SDL3pp_events.h:142
constexpr EventType EVENT_WINDOW_RESIZED
Window has been resized to data1xdata2.
Definition: SDL3pp_events.h:161
constexpr EventType EVENT_PEN_PROXIMITY_OUT
Pressure-sensitive pen has become unavailable.
Definition: SDL3pp_events.h:416
constexpr EventType EVENT_WINDOW_PIXEL_SIZE_CHANGED
The pixel size of the window has changed to data1xdata2.
Definition: SDL3pp_events.h:165
constexpr EventType EVENT_JOYSTICK_BALL_MOTION
Joystick trackball motion.
Definition: SDL3pp_events.h:298
constexpr EventType EVENT_GAMEPAD_BUTTON_DOWN
Gamepad button pressed.
Definition: SDL3pp_events.h:326
constexpr EventType EVENT_CAMERA_DEVICE_REMOVED
A camera device has been removed.
Definition: SDL3pp_events.h:441
constexpr EventType EVENT_DISPLAY_FIRST
DISPLAY_FIRST.
Definition: SDL3pp_events.h:139
constexpr EventType EVENT_WINDOW_FIRST
WINDOW_FIRST.
Definition: SDL3pp_events.h:236
constexpr EventType EVENT_SCREEN_KEYBOARD_SHOWN
The on-screen keyboard has been shown.
Definition: SDL3pp_events.h:269
constexpr EventType EVENT_RENDER_DEVICE_RESET
The device has been reset and all textures need to be recreated.
Definition: SDL3pp_events.h:455
constexpr EventType EVENT_PEN_DOWN
Pressure-sensitive pen touched drawing surface.
Definition: SDL3pp_events.h:420
constexpr EventType EVENT_TEXT_EDITING
Keyboard text editing (composition)
Definition: SDL3pp_events.h:245
constexpr EventType EVENT_WINDOW_CLOSE_REQUESTED
The window manager requests that the window be closed.
Definition: SDL3pp_events.h:194
constexpr EventType EVENT_GAMEPAD_TOUCHPAD_UP
Gamepad touchpad finger was lifted.
Definition: SDL3pp_events.h:347
constexpr EventType EVENT_DID_ENTER_BACKGROUND
The application did enter the background and may not get CPU for some time.
Definition: SDL3pp_events.h:86
constexpr EventType EVENT_DROP_TEXT
text/plain drag-and-drop event
Definition: SDL3pp_events.h:388
constexpr EventType EVENT_WINDOW_HDR_STATE_CHANGED
Window HDR properties have changed.
Definition: SDL3pp_events.h:233
constexpr EventType EVENT_PEN_PROXIMITY_IN
Pressure-sensitive pen has become available.
Definition: SDL3pp_events.h:413
constexpr EventType EVENT_WILL_ENTER_FOREGROUND
The application is about to enter the foreground.
Definition: SDL3pp_events.h:93
constexpr EventType EVENT_SENSOR_UPDATE
A sensor was updated.
Definition: SDL3pp_events.h:410
constexpr EventType EVENT_KEY_DOWN
Key pressed.
Definition: SDL3pp_events.h:241
constexpr EventType EVENT_TEXT_EDITING_CANDIDATES
Keyboard text editing candidates.
Definition: SDL3pp_events.h:264
constexpr EventType EVENT_DISPLAY_USABLE_BOUNDS_CHANGED
Display has changed usable bounds.
Definition: SDL3pp_events.h:133
constexpr EventType EVENT_GAMEPAD_TOUCHPAD_DOWN
Gamepad touchpad was touched.
Definition: SDL3pp_events.h:341
constexpr EventType EVENT_WINDOW_MINIMIZED
Window has been minimized.
Definition: SDL3pp_events.h:172
SDL_EventType EventType
The types of events that can be delivered.
Definition: SDL3pp_events.h:53
constexpr EventType EVENT_PRIVATE1
PRIVATE1.
Definition: SDL3pp_events.h:463
constexpr EventType EVENT_LAST
This last event is only for bounding internal arrays.
Definition: SDL3pp_events.h:479
constexpr EventType EVENT_FINGER_MOTION
FINGER_MOTION.
Definition: SDL3pp_events.h:363
constexpr EventType EVENT_JOYSTICK_UPDATE_COMPLETE
Joystick update is complete.
Definition: SDL3pp_events.h:320
constexpr EventType EVENT_FINGER_CANCELED
FINGER_CANCELED.
Definition: SDL3pp_events.h:366
constexpr EventType EVENT_LOW_MEMORY
The application is low on memory, free memory if possible.
Definition: SDL3pp_events.h:71
constexpr EventType EVENT_DISPLAY_REMOVED
Display has been removed from the system.
Definition: SDL3pp_events.h:115
constexpr EventType EVENT_GAMEPAD_TOUCHPAD_MOTION
Gamepad touchpad finger was moved.
Definition: SDL3pp_events.h:344
constexpr EventType EVENT_FINGER_UP
FINGER_UP.
Definition: SDL3pp_events.h:361
constexpr EventType EVENT_JOYSTICK_AXIS_MOTION
Joystick axis motion.
Definition: SDL3pp_events.h:295
constexpr EventType EVENT_WINDOW_DISPLAY_SCALE_CHANGED
Window display scale has been changed.
Definition: SDL3pp_events.h:208
constexpr EventType EVENT_SCREEN_KEYBOARD_HIDDEN
The on-screen keyboard has been hidden.
Definition: SDL3pp_events.h:272
constexpr EventType EVENT_FINGER_DOWN
FINGER_DOWN.
Definition: SDL3pp_events.h:359
constexpr EventType EVENT_DISPLAY_DESKTOP_MODE_CHANGED
Display has changed desktop mode.
Definition: SDL3pp_events.h:121
constexpr EventType EVENT_WINDOW_DESTROYED
The window with the associated ID is being or has been destroyed.
Definition: SDL3pp_events.h:231
constexpr EventType EVENT_PRIVATE3
PRIVATE3.
Definition: SDL3pp_events.h:467
constexpr EventType EVENT_GAMEPAD_BUTTON_UP
Gamepad button released.
Definition: SDL3pp_events.h:329
constexpr EventType EVENT_CAMERA_DEVICE_DENIED
A camera device has been denied for use by the user.
Definition: SDL3pp_events.h:449
constexpr EventType EVENT_GAMEPAD_STEAM_HANDLE_UPDATED
Gamepad Steam handle has changed.
Definition: SDL3pp_events.h:356
constexpr EventType EVENT_USER
Events EVENT_USER through EVENT_LAST are for your use, and should be allocated with RegisterEvents()
Definition: SDL3pp_events.h:476
constexpr EventType EVENT_KEYMAP_CHANGED
Keymap changed due to a system event such as an input language or keyboard layout change.
Definition: SDL3pp_events.h:255
constexpr EventType EVENT_MOUSE_BUTTON_DOWN
Mouse button pressed.
Definition: SDL3pp_events.h:280
constexpr EventType EVENT_LOCALE_CHANGED
The user's locale preferences have changed.
Definition: SDL3pp_events.h:103
constexpr EventType EVENT_PINCH_BEGIN
Pinch gesture started.
Definition: SDL3pp_events.h:371
constexpr EventType EVENT_PEN_AXIS
Pressure-sensitive pen angle/pressure/etc changed.
Definition: SDL3pp_events.h:435
constexpr EventType EVENT_WINDOW_MOUSE_LEAVE
Window has lost mouse focus.
Definition: SDL3pp_events.h:184
constexpr EventType EVENT_FIRST
Unused (do not remove)
Definition: SDL3pp_events.h:55
constexpr EventType EVENT_JOYSTICK_REMOVED
An opened joystick has been removed.
Definition: SDL3pp_events.h:314
constexpr EventType EVENT_GAMEPAD_UPDATE_COMPLETE
Gamepad update is complete.
Definition: SDL3pp_events.h:353
constexpr EventType EVENT_CLIPBOARD_UPDATE
The clipboard changed.
Definition: SDL3pp_events.h:382
constexpr EventType EVENT_AUDIO_DEVICE_FORMAT_CHANGED
An audio device's format has been changed by the system.
Definition: SDL3pp_events.h:407
constexpr EventType EVENT_MOUSE_WHEEL
Mouse wheel motion.
Definition: SDL3pp_events.h:286
constexpr EventType EVENT_SYSTEM_THEME_CHANGED
The system theme changed.
Definition: SDL3pp_events.h:106
constexpr EventType EVENT_JOYSTICK_ADDED
A new joystick has been inserted into the system.
Definition: SDL3pp_events.h:310
constexpr EventType EVENT_TERMINATING
The application is being terminated by the OS.
Definition: SDL3pp_events.h:64
constexpr EventType EVENT_ENUM_PADDING
ENUM_PADDING.
Definition: SDL3pp_events.h:481
constexpr EventType EVENT_GAMEPAD_SENSOR_UPDATE
Gamepad sensor was updated.
Definition: SDL3pp_events.h:350
constexpr EventType EVENT_WINDOW_SHOWN
Window has been shown.
Definition: SDL3pp_events.h:145
constexpr EventType EVENT_WINDOW_MAXIMIZED
Window has been maximized.
Definition: SDL3pp_events.h:175
constexpr EventType EVENT_GAMEPAD_ADDED
A new gamepad has been inserted into the system.
Definition: SDL3pp_events.h:332
constexpr EventType EVENT_WINDOW_FOCUS_LOST
Window has lost keyboard focus.
Definition: SDL3pp_events.h:190
constexpr EventType EVENT_MOUSE_MOTION
Mouse moved.
Definition: SDL3pp_events.h:277
constexpr EventType EVENT_PEN_BUTTON_DOWN
Pressure-sensitive pen button pressed.
Definition: SDL3pp_events.h:426
constexpr EventType EVENT_WINDOW_METAL_VIEW_RESIZED
The pixel size of a Metal view associated with the window has changed.
Definition: SDL3pp_events.h:169
constexpr EventType EVENT_GAMEPAD_AXIS_MOTION
Gamepad axis motion.
Definition: SDL3pp_events.h:323
constexpr EventType EVENT_RENDER_TARGETS_RESET
The render targets have been reset and their contents need to be updated.
Definition: SDL3pp_events.h:452
constexpr EventType EVENT_WINDOW_FOCUS_GAINED
Window has gained keyboard focus.
Definition: SDL3pp_events.h:187
constexpr EventType EVENT_WINDOW_ENTER_FULLSCREEN
The window has entered fullscreen mode.
Definition: SDL3pp_events.h:218
constexpr EventType EVENT_QUIT
User-requested quit.
Definition: SDL3pp_events.h:57
constexpr EventType EVENT_WINDOW_DISPLAY_CHANGED
Window has been moved to display data1.
Definition: SDL3pp_events.h:205
constexpr EventType EVENT_WINDOW_HIDDEN
Window has been hidden.
Definition: SDL3pp_events.h:148
constexpr EventType EVENT_CAMERA_DEVICE_ADDED
A new camera device is available.
Definition: SDL3pp_events.h:438
constexpr EventType EVENT_WINDOW_LAST
WINDOW_LAST.
Definition: SDL3pp_events.h:239
constexpr EventType EVENT_DROP_COMPLETE
Current set of drops is now complete (NULL filename)
Definition: SDL3pp_events.h:395
Main include header for the SDL3pp library.
Definition: SDL3pp_callbackWrapper.h:169
Semi-safe reference for Window.
Definition: SDL3pp_video.h:3169