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
132 SDL_EVENT_DISPLAY_FIRST;
133
135 SDL_EVENT_DISPLAY_LAST;
136
138 SDL_EVENT_WINDOW_SHOWN;
139
141 SDL_EVENT_WINDOW_HIDDEN;
142
147constexpr EventType EVENT_WINDOW_EXPOSED = SDL_EVENT_WINDOW_EXPOSED;
148
150 SDL_EVENT_WINDOW_MOVED;
151
153 SDL_EVENT_WINDOW_RESIZED;
154
157 SDL_EVENT_WINDOW_PIXEL_SIZE_CHANGED;
158
161 SDL_EVENT_WINDOW_METAL_VIEW_RESIZED;
162
164 SDL_EVENT_WINDOW_MINIMIZED;
165
167 SDL_EVENT_WINDOW_MAXIMIZED;
168
170constexpr EventType EVENT_WINDOW_RESTORED = SDL_EVENT_WINDOW_RESTORED;
171
173 SDL_EVENT_WINDOW_MOUSE_ENTER;
174
176 SDL_EVENT_WINDOW_MOUSE_LEAVE;
177
179 SDL_EVENT_WINDOW_FOCUS_GAINED;
180
182 SDL_EVENT_WINDOW_FOCUS_LOST;
183
186 SDL_EVENT_WINDOW_CLOSE_REQUESTED;
187
189 SDL_EVENT_WINDOW_HIT_TEST;
191
194 SDL_EVENT_WINDOW_ICCPROF_CHANGED;
195
197 SDL_EVENT_WINDOW_DISPLAY_CHANGED;
198
200 SDL_EVENT_WINDOW_DISPLAY_SCALE_CHANGED;
202
204 SDL_EVENT_WINDOW_SAFE_AREA_CHANGED;
205
207 SDL_EVENT_WINDOW_OCCLUDED;
208
210 SDL_EVENT_WINDOW_ENTER_FULLSCREEN;
211
213 SDL_EVENT_WINDOW_LEAVE_FULLSCREEN;
214
222constexpr EventType EVENT_WINDOW_DESTROYED = SDL_EVENT_WINDOW_DESTROYED;
223
225 SDL_EVENT_WINDOW_HDR_STATE_CHANGED;
226
228 SDL_EVENT_WINDOW_FIRST;
229
230constexpr EventType EVENT_WINDOW_LAST = SDL_EVENT_WINDOW_LAST;
231
232constexpr EventType EVENT_KEY_DOWN = SDL_EVENT_KEY_DOWN;
233
234constexpr EventType EVENT_KEY_UP = SDL_EVENT_KEY_UP;
235
237 SDL_EVENT_TEXT_EDITING;
238
240 SDL_EVENT_TEXT_INPUT;
241
246constexpr EventType EVENT_KEYMAP_CHANGED = SDL_EVENT_KEYMAP_CHANGED;
247
249 SDL_EVENT_KEYBOARD_ADDED;
251
253 SDL_EVENT_KEYBOARD_REMOVED;
254
256 SDL_EVENT_TEXT_EDITING_CANDIDATES;
257
259 SDL_EVENT_MOUSE_MOTION;
260
262 SDL_EVENT_MOUSE_BUTTON_DOWN;
263
265 SDL_EVENT_MOUSE_BUTTON_UP;
266
268 SDL_EVENT_MOUSE_WHEEL;
269
271 SDL_EVENT_MOUSE_ADDED;
272
274 SDL_EVENT_MOUSE_REMOVED;
275
277 SDL_EVENT_JOYSTICK_AXIS_MOTION;
278
280 SDL_EVENT_JOYSTICK_BALL_MOTION;
281
283 SDL_EVENT_JOYSTICK_HAT_MOTION;
284
286 SDL_EVENT_JOYSTICK_BUTTON_DOWN;
287
289 SDL_EVENT_JOYSTICK_BUTTON_UP;
290
292 SDL_EVENT_JOYSTICK_ADDED;
294
296 SDL_EVENT_JOYSTICK_REMOVED;
297
299 SDL_EVENT_JOYSTICK_BATTERY_UPDATED;
300
302 SDL_EVENT_JOYSTICK_UPDATE_COMPLETE;
303
305 SDL_EVENT_GAMEPAD_AXIS_MOTION;
306
308 SDL_EVENT_GAMEPAD_BUTTON_DOWN;
309
311 SDL_EVENT_GAMEPAD_BUTTON_UP;
312
314 SDL_EVENT_GAMEPAD_ADDED;
315
317 SDL_EVENT_GAMEPAD_REMOVED;
318
320 SDL_EVENT_GAMEPAD_REMAPPED;
321
323 SDL_EVENT_GAMEPAD_TOUCHPAD_DOWN;
324
326 SDL_EVENT_GAMEPAD_TOUCHPAD_MOTION;
327
329 SDL_EVENT_GAMEPAD_TOUCHPAD_UP;
330
332 SDL_EVENT_GAMEPAD_SENSOR_UPDATE;
333
335 SDL_EVENT_GAMEPAD_UPDATE_COMPLETE;
336
338 SDL_EVENT_GAMEPAD_STEAM_HANDLE_UPDATED;
339
340constexpr EventType EVENT_FINGER_DOWN = SDL_EVENT_FINGER_DOWN;
341
342constexpr EventType EVENT_FINGER_UP = SDL_EVENT_FINGER_UP;
343
345 SDL_EVENT_FINGER_MOTION;
346
348 SDL_EVENT_FINGER_CANCELED;
349
351 SDL_EVENT_CLIPBOARD_UPDATE;
352
354 SDL_EVENT_DROP_FILE;
355
357 SDL_EVENT_DROP_TEXT;
358
360 SDL_EVENT_DROP_BEGIN;
361
363constexpr EventType EVENT_DROP_COMPLETE = SDL_EVENT_DROP_COMPLETE;
364
366 SDL_EVENT_DROP_POSITION;
367
369 SDL_EVENT_AUDIO_DEVICE_ADDED;
370
372 SDL_EVENT_AUDIO_DEVICE_REMOVED;
373
376 SDL_EVENT_AUDIO_DEVICE_FORMAT_CHANGED;
377
379 SDL_EVENT_SENSOR_UPDATE;
380
382 SDL_EVENT_PEN_PROXIMITY_IN;
383
385 SDL_EVENT_PEN_PROXIMITY_OUT;
387
389 SDL_EVENT_PEN_DOWN;
390
392constexpr EventType EVENT_PEN_UP = SDL_EVENT_PEN_UP;
393
395 SDL_EVENT_PEN_BUTTON_DOWN;
396
398 SDL_EVENT_PEN_BUTTON_UP;
399
401 SDL_EVENT_PEN_MOTION;
402
404 SDL_EVENT_PEN_AXIS;
405
407 SDL_EVENT_CAMERA_DEVICE_ADDED;
408
410 SDL_EVENT_CAMERA_DEVICE_REMOVED;
411
414 SDL_EVENT_CAMERA_DEVICE_APPROVED;
415
417constexpr EventType EVENT_CAMERA_DEVICE_DENIED = SDL_EVENT_CAMERA_DEVICE_DENIED;
418
420constexpr EventType EVENT_RENDER_TARGETS_RESET = SDL_EVENT_RENDER_TARGETS_RESET;
421
423constexpr EventType EVENT_RENDER_DEVICE_RESET = SDL_EVENT_RENDER_DEVICE_RESET;
424
426 SDL_EVENT_RENDER_DEVICE_LOST;
428
429constexpr EventType EVENT_PRIVATE0 = SDL_EVENT_PRIVATE0;
430
431constexpr EventType EVENT_PRIVATE1 = SDL_EVENT_PRIVATE1;
432
433constexpr EventType EVENT_PRIVATE2 = SDL_EVENT_PRIVATE2;
434
435constexpr EventType EVENT_PRIVATE3 = SDL_EVENT_PRIVATE3;
436
438 SDL_EVENT_POLL_SENTINEL;
439
444constexpr EventType EVENT_USER = SDL_EVENT_USER;
445
447constexpr EventType EVENT_LAST = SDL_EVENT_LAST;
448
450 SDL_EVENT_ENUM_PADDING;
451
453
459using CommonEvent = SDL_CommonEvent;
460
466using DisplayEvent = SDL_DisplayEvent;
467
473using WindowEvent = SDL_WindowEvent;
474
480using KeyboardDeviceEvent = SDL_KeyboardDeviceEvent;
481
496using KeyboardEvent = SDL_KeyboardEvent;
497
507using TextEditingEvent = SDL_TextEditingEvent;
508
514using TextEditingCandidatesEvent = SDL_TextEditingCandidatesEvent;
515
527using TextInputEvent = SDL_TextInputEvent;
528
534using MouseDeviceEvent = SDL_MouseDeviceEvent;
535
541using MouseMotionEvent = SDL_MouseMotionEvent;
542
548using MouseButtonEvent = SDL_MouseButtonEvent;
549
555using MouseWheelEvent = SDL_MouseWheelEvent;
556
562using JoyAxisEvent = SDL_JoyAxisEvent;
563
569using JoyBallEvent = SDL_JoyBallEvent;
570
576using JoyHatEvent = SDL_JoyHatEvent;
577
583using JoyButtonEvent = SDL_JoyButtonEvent;
584
595using JoyDeviceEvent = SDL_JoyDeviceEvent;
596
602using JoyBatteryEvent = SDL_JoyBatteryEvent;
603
609using GamepadAxisEvent = SDL_GamepadAxisEvent;
610
616using GamepadButtonEvent = SDL_GamepadButtonEvent;
617
632using GamepadDeviceEvent = SDL_GamepadDeviceEvent;
633
639using GamepadTouchpadEvent = SDL_GamepadTouchpadEvent;
640
646using GamepadSensorEvent = SDL_GamepadSensorEvent;
647
653using AudioDeviceEvent = SDL_AudioDeviceEvent;
654
660using CameraDeviceEvent = SDL_CameraDeviceEvent;
661
667using RenderEvent = SDL_RenderEvent;
668
687using TouchFingerEvent = SDL_TouchFingerEvent;
688
704using PenProximityEvent = SDL_PenProximityEvent;
705
716using PenMotionEvent = SDL_PenMotionEvent;
717
726using PenTouchEvent = SDL_PenTouchEvent;
727
736using PenButtonEvent = SDL_PenButtonEvent;
737
745using PenAxisEvent = SDL_PenAxisEvent;
746
753using DropEvent = SDL_DropEvent;
754
761using ClipboardEvent = SDL_ClipboardEvent;
762
768using SensorEvent = SDL_SensorEvent;
769
775using QuitEvent = SDL_QuitEvent;
776
788using UserEvent = SDL_UserEvent;
789
798using Event = SDL_Event;
799
820inline void PumpEvents() { SDL_PumpEvents(); }
821
833using EventAction = SDL_EventAction;
834
836 SDL_ADDEVENT;
837
839constexpr EventAction PEEKEVENT = SDL_PEEKEVENT;
840
842constexpr EventAction GETEVENT = SDL_GETEVENT;
843
845
889inline int PeepEvents(Event* events,
890 int numevents,
891 EventAction action,
892 Uint32 minType = EVENT_FIRST,
893 Uint32 maxType = EVENT_LAST)
894{
895 return SDL_PeepEvents(events, numevents, action, minType, maxType);
896}
897
913inline bool HasEvent(Uint32 type) { return SDL_HasEvent(type); }
914
933inline bool HasEvents(Uint32 minType = EVENT_FIRST, Uint32 maxType = EVENT_LAST)
934{
935 return SDL_HasEvents(minType, maxType);
936}
937
963inline void FlushEvent(Uint32 type) { SDL_FlushEvent(type); }
964
990inline void FlushEvents(Uint32 minType = EVENT_FIRST,
991 Uint32 maxType = EVENT_LAST)
992{
993 SDL_FlushEvents(minType, maxType);
994}
995
1040inline bool PollEvent(Event* event) { return SDL_PollEvent(event); }
1041
1078inline std::optional<Event> PollEvent()
1079{
1080 if (Event event; PollEvent(&event)) return event;
1081 return std::nullopt;
1082}
1083
1105inline void WaitEvent(Event* event) { CheckError(SDL_WaitEvent(event)); }
1106
1128{
1129 Event event;
1130 WaitEvent(&event);
1131 return event;
1132}
1133
1162inline bool WaitEventTimeout(Event* event, Sint32 timeoutMS)
1163{
1164 return SDL_WaitEventTimeout(event, timeoutMS);
1165}
1166
1190inline std::optional<Event> WaitEventTimeout(Sint32 timeoutMS)
1191{
1192 if (Event event; WaitEventTimeout(&event, timeoutMS)) return event;
1193 return std::nullopt;
1194}
1195
1224inline bool WaitEventTimeout(Event* event,
1225 std::chrono::milliseconds timeoutDuration)
1226{
1227 return WaitEventTimeout(event,
1228 Sint32(std::max(timeoutDuration.count(), Sint64(1))));
1229}
1230
1254inline std::optional<Event> WaitEventTimeout(
1255 std::chrono::milliseconds timeoutDuration)
1256{
1257 if (Event event; WaitEventTimeout(&event, timeoutDuration)) return event;
1258 return std::nullopt;
1259}
1260
1291inline void PushEvent(Event* event) { CheckError(SDL_PushEvent(event)); }
1292
1323inline void PushEvent(const Event& event)
1324{
1325 PushEvent(const_cast<Event*>(&event));
1326}
1327
1346using EventFilter = bool(SDLCALL*)(void* userdata, Event* event);
1347
1368using EventFilterCB = std::function<bool(Event* event)>;
1369
1391
1430inline void SetEventFilter(EventFilter filter, void* userdata)
1431{
1432 SDL_SetEventFilter(filter, userdata);
1433}
1434
1473{
1474 static EventFilterCB staticFilter;
1475 staticFilter = filter;
1476 SetEventFilter([](void*, Event* event) { return staticFilter(event); },
1477 nullptr);
1478}
1479
1497inline void GetEventFilter(EventFilter* filter, void** userdata)
1498{
1499 CheckError(SDL_GetEventFilter(filter, userdata));
1500}
1501
1531inline void AddEventWatch(EventFilter filter, void* userdata)
1532{
1533 CheckError(SDL_AddEventWatch(filter, userdata));
1534}
1535
1565{
1566 AddEventWatch(filter.wrapper, filter.data);
1567}
1568
1584inline void RemoveEventWatch(EventFilter filter, void* userdata)
1585{
1586 SDL_RemoveEventWatch(filter, userdata);
1587}
1588
1607inline void FilterEvents(EventFilter filter, void* userdata)
1608{
1609 SDL_FilterEvents(filter, userdata);
1610}
1611
1632inline void FilterEvents(EventFilterCB filter)
1633{
1634 return FilterEvents(
1635 [](void* userdata, Event* event) {
1636 const auto& f = *static_cast<EventFilterCB*>(userdata);
1637 return f(event);
1638 },
1639 &filter);
1640}
1641
1654inline void SetEventEnabled(Uint32 type, bool enabled)
1655{
1656 SDL_SetEventEnabled(type, enabled);
1657}
1658
1671inline bool EventEnabled(Uint32 type) { return SDL_EventEnabled(type); }
1672
1687inline Uint32 RegisterEvents(int numevents)
1688{
1689 return SDL_RegisterEvents(numevents);
1690}
1691
1708{
1709 return {CheckError(SDL_GetWindowFromEvent(&event))};
1710}
1711
1713
1714} // namespace SDL
1715
1716#endif /* SDL3PP_EVENTS_H_ */
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:1346
void FlushEvent(Uint32 type)
Clear events of a specific type from the event queue.
Definition: SDL3pp_events.h:963
void RemoveEventWatch(EventFilter filter, void *userdata)
Remove an event watch callback added with AddEventWatch().
Definition: SDL3pp_events.h:1584
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:889
SDL_PenProximityEvent PenProximityEvent
Pressure-sensitive pen proximity event structure (event.pmotion.
Definition: SDL3pp_events.h:704
SDL_GamepadButtonEvent GamepadButtonEvent
Gamepad button event structure (event.gbutton.
Definition: SDL3pp_events.h:616
void GetEventFilter(EventFilter *filter, void **userdata)
Query the current event filter.
Definition: SDL3pp_events.h:1497
SDL_WindowEvent WindowEvent
Window state change event data (event.window.
Definition: SDL3pp_events.h:473
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:933
SDL_RenderEvent RenderEvent
Renderer event structure (event.render.
Definition: SDL3pp_events.h:667
SDL_JoyAxisEvent JoyAxisEvent
Joystick axis motion event structure (event.jaxis.
Definition: SDL3pp_events.h:562
SDL_CameraDeviceEvent CameraDeviceEvent
Camera device event structure (event.cdevice.
Definition: SDL3pp_events.h:660
SDL_GamepadAxisEvent GamepadAxisEvent
Gamepad axis motion event structure (event.gaxis.
Definition: SDL3pp_events.h:609
SDL_GamepadDeviceEvent GamepadDeviceEvent
Gamepad device event structure (event.gdevice.
Definition: SDL3pp_events.h:632
SDL_ClipboardEvent ClipboardEvent
An event triggered when the clipboard contents have changed (event.clipboard.
Definition: SDL3pp_events.h:761
SDL_GamepadSensorEvent GamepadSensorEvent
Gamepad sensor event structure (event.gsensor.
Definition: SDL3pp_events.h:646
SDL_MouseDeviceEvent MouseDeviceEvent
Mouse device event structure (event.mdevice.
Definition: SDL3pp_events.h:534
SDL_TouchFingerEvent TouchFingerEvent
Touch finger event structure (event.tfinger.
Definition: SDL3pp_events.h:687
std::function< bool(Event *event)> EventFilterCB
A std::function used for callbacks that watch the event queue.
Definition: SDL3pp_events.h:1368
SDL_SensorEvent SensorEvent
Sensor event structure (event.sensor.
Definition: SDL3pp_events.h:768
SDL_GamepadTouchpadEvent GamepadTouchpadEvent
Gamepad touchpad event structure (event.gtouchpad.
Definition: SDL3pp_events.h:639
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:990
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:1687
SDL_PenTouchEvent PenTouchEvent
Pressure-sensitive pen touched event structure (event.ptouch.
Definition: SDL3pp_events.h:726
SDL_KeyboardDeviceEvent KeyboardDeviceEvent
Keyboard device event structure (event.kdevice.
Definition: SDL3pp_events.h:480
SDL_AudioDeviceEvent AudioDeviceEvent
Audio device event structure (event.adevice.
Definition: SDL3pp_events.h:653
SDL_DropEvent DropEvent
An event used to drop text or request a file open by the system (event.drop.
Definition: SDL3pp_events.h:753
SDL_MouseButtonEvent MouseButtonEvent
Mouse button event structure (event.button.
Definition: SDL3pp_events.h:548
constexpr EventAction GETEVENT
Retrieve/remove events from the front of the queue.
Definition: SDL3pp_events.h:842
SDL_JoyBatteryEvent JoyBatteryEvent
Joystick battery level change event structure (event.jbattery.
Definition: SDL3pp_events.h:602
SDL_EventAction EventAction
The type of action to request from PeepEvents().
Definition: SDL3pp_events.h:833
SDL_DisplayEvent DisplayEvent
Display state change event data (event.display.
Definition: SDL3pp_events.h:466
bool WaitEventTimeout(Event *event, Sint32 timeoutMS)
Wait until the specified timeout (in milliseconds) for the next available event.
Definition: SDL3pp_events.h:1162
void SetEventEnabled(Uint32 type, bool enabled)
Set the state of processing events by type.
Definition: SDL3pp_events.h:1654
SDL_Event Event
The structure for all events in SDL.
Definition: SDL3pp_events.h:798
SDL_TextEditingEvent TextEditingEvent
Keyboard text editing event structure (event.edit.
Definition: SDL3pp_events.h:507
SDL_UserEvent UserEvent
A user-defined event type (event.user.
Definition: SDL3pp_events.h:788
std::optional< Event > PollEvent()
Poll for currently pending events.
Definition: SDL3pp_events.h:1078
Event WaitEvent()
Wait indefinitely for the next available event.
Definition: SDL3pp_events.h:1127
SDL_TextEditingCandidatesEvent TextEditingCandidatesEvent
Keyboard IME candidates event structure (event.edit_candidates.
Definition: SDL3pp_events.h:514
WindowRef GetWindowFromEvent(const Event &event)
Get window associated with an event.
Definition: SDL3pp_events.h:1707
void PushEvent(Event *event)
Add an event to the event queue.
Definition: SDL3pp_events.h:1291
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:1430
SDL_PenAxisEvent PenAxisEvent
Pressure-sensitive pen pressure / angle event structure (event.paxis.
Definition: SDL3pp_events.h:745
SDL_KeyboardEvent KeyboardEvent
Keyboard button event structure (event.key.
Definition: SDL3pp_events.h:496
constexpr EventAction ADDEVENT
Add events to the back of the queue.
Definition: SDL3pp_events.h:835
bool HasEvent(Uint32 type)
Check for the existence of a certain event type in the event queue.
Definition: SDL3pp_events.h:913
SDL_MouseMotionEvent MouseMotionEvent
Mouse motion event structure (event.motion.
Definition: SDL3pp_events.h:541
SDL_JoyHatEvent JoyHatEvent
Joystick hat position change event structure (event.jhat.
Definition: SDL3pp_events.h:576
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:1531
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:1607
SDL_MouseWheelEvent MouseWheelEvent
Mouse wheel event structure (event.wheel.
Definition: SDL3pp_events.h:555
SDL_CommonEvent CommonEvent
Fields shared by every event.
Definition: SDL3pp_events.h:459
SDL_JoyButtonEvent JoyButtonEvent
Joystick button event structure (event.jbutton.
Definition: SDL3pp_events.h:583
SDL_PenButtonEvent PenButtonEvent
Pressure-sensitive pen button event structure (event.pbutton.
Definition: SDL3pp_events.h:736
SDL_TextInputEvent TextInputEvent
Keyboard text input event structure (event.text.
Definition: SDL3pp_events.h:527
constexpr EventAction PEEKEVENT
Check but don't remove events from the queue front.
Definition: SDL3pp_events.h:839
SDL_QuitEvent QuitEvent
The "quit requested" event.
Definition: SDL3pp_events.h:775
bool EventEnabled(Uint32 type)
Query the state of processing events by type.
Definition: SDL3pp_events.h:1671
SDL_JoyDeviceEvent JoyDeviceEvent
Joystick device event structure (event.jdevice.
Definition: SDL3pp_events.h:595
SDL_JoyBallEvent JoyBallEvent
Joystick trackball motion event structure (event.jball.
Definition: SDL3pp_events.h:569
void PumpEvents()
Pump the event loop, gathering events from the input devices.
Definition: SDL3pp_events.h:820
SDL_PenMotionEvent PenMotionEvent
Pressure-sensitive pen motion event structure (event.pmotion.
Definition: SDL3pp_events.h:716
::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:392
constexpr EventType EVENT_WINDOW_SAFE_AREA_CHANGED
The window safe area has been changed.
Definition: SDL3pp_events.h:203
constexpr EventType EVENT_DROP_FILE
The system requests a file open.
Definition: SDL3pp_events.h:353
constexpr EventType EVENT_PEN_MOTION
Pressure-sensitive pen is moving on the tablet.
Definition: SDL3pp_events.h:400
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:288
constexpr EventType EVENT_KEYBOARD_REMOVED
A keyboard has been removed.
Definition: SDL3pp_events.h:252
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:368
constexpr EventType EVENT_WINDOW_MOUSE_ENTER
Window has gained mouse focus.
Definition: SDL3pp_events.h:172
constexpr EventType EVENT_GAMEPAD_REMAPPED
The gamepad mapping was updated.
Definition: SDL3pp_events.h:319
constexpr EventType EVENT_PRIVATE0
PRIVATE0.
Definition: SDL3pp_events.h:429
constexpr EventType EVENT_RENDER_DEVICE_LOST
The device has been lost and can't be recovered.
Definition: SDL3pp_events.h:425
constexpr EventType EVENT_WINDOW_OCCLUDED
The window has been occluded.
Definition: SDL3pp_events.h:206
constexpr EventType EVENT_WINDOW_MOVED
Window has been moved to data1, data2.
Definition: SDL3pp_events.h:149
constexpr EventType EVENT_JOYSTICK_HAT_MOTION
Joystick hat position change.
Definition: SDL3pp_events.h:282
constexpr EventType EVENT_WINDOW_LEAVE_FULLSCREEN
The window has left fullscreen mode.
Definition: SDL3pp_events.h:212
constexpr EventType EVENT_PRIVATE2
PRIVATE2.
Definition: SDL3pp_events.h:433
constexpr EventType EVENT_DROP_BEGIN
A new set of drops is beginning (NULL filename)
Definition: SDL3pp_events.h:359
constexpr EventType EVENT_CAMERA_DEVICE_APPROVED
A camera device has been approved for use by the user.
Definition: SDL3pp_events.h:413
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:147
constexpr EventType EVENT_WINDOW_ICCPROF_CHANGED
The ICC profile of the window's display has changed.
Definition: SDL3pp_events.h:193
constexpr EventType EVENT_GAMEPAD_REMOVED
A gamepad has been removed.
Definition: SDL3pp_events.h:316
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:264
constexpr EventType EVENT_KEYBOARD_ADDED
A new keyboard has been inserted into the system.
Definition: SDL3pp_events.h:248
constexpr EventType EVENT_AUDIO_DEVICE_REMOVED
An audio device has been removed.
Definition: SDL3pp_events.h:371
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:170
constexpr EventType EVENT_WINDOW_HIT_TEST
Window had a hit test that wasn't HITTEST_NORMAL.
Definition: SDL3pp_events.h:188
constexpr EventType EVENT_JOYSTICK_BUTTON_DOWN
Joystick button pressed.
Definition: SDL3pp_events.h:285
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:397
constexpr EventType EVENT_KEY_UP
Key released.
Definition: SDL3pp_events.h:234
constexpr EventType EVENT_MOUSE_ADDED
A new mouse has been inserted into the system.
Definition: SDL3pp_events.h:270
constexpr EventType EVENT_POLL_SENTINEL
Signals the end of an event poll cycle.
Definition: SDL3pp_events.h:437
constexpr EventType EVENT_MOUSE_REMOVED
A mouse has been removed.
Definition: SDL3pp_events.h:273
constexpr EventType EVENT_DROP_POSITION
Position while moving over the window.
Definition: SDL3pp_events.h:365
constexpr EventType EVENT_JOYSTICK_BATTERY_UPDATED
Joystick battery level change.
Definition: SDL3pp_events.h:298
constexpr EventType EVENT_TEXT_INPUT
Keyboard text input.
Definition: SDL3pp_events.h:239
constexpr EventType EVENT_DISPLAY_LAST
DISPLAY_LAST.
Definition: SDL3pp_events.h:134
constexpr EventType EVENT_WINDOW_RESIZED
Window has been resized to data1xdata2.
Definition: SDL3pp_events.h:152
constexpr EventType EVENT_PEN_PROXIMITY_OUT
Pressure-sensitive pen has become unavailable.
Definition: SDL3pp_events.h:384
constexpr EventType EVENT_WINDOW_PIXEL_SIZE_CHANGED
The pixel size of the window has changed to data1xdata2.
Definition: SDL3pp_events.h:156
constexpr EventType EVENT_JOYSTICK_BALL_MOTION
Joystick trackball motion.
Definition: SDL3pp_events.h:279
constexpr EventType EVENT_GAMEPAD_BUTTON_DOWN
Gamepad button pressed.
Definition: SDL3pp_events.h:307
constexpr EventType EVENT_CAMERA_DEVICE_REMOVED
A camera device has been removed.
Definition: SDL3pp_events.h:409
constexpr EventType EVENT_DISPLAY_FIRST
DISPLAY_FIRST.
Definition: SDL3pp_events.h:131
constexpr EventType EVENT_WINDOW_FIRST
WINDOW_FIRST.
Definition: SDL3pp_events.h:227
constexpr EventType EVENT_RENDER_DEVICE_RESET
The device has been reset and all textures need to be recreated.
Definition: SDL3pp_events.h:423
constexpr EventType EVENT_PEN_DOWN
Pressure-sensitive pen touched drawing surface.
Definition: SDL3pp_events.h:388
constexpr EventType EVENT_TEXT_EDITING
Keyboard text editing (composition)
Definition: SDL3pp_events.h:236
constexpr EventType EVENT_WINDOW_CLOSE_REQUESTED
The window manager requests that the window be closed.
Definition: SDL3pp_events.h:185
constexpr EventType EVENT_GAMEPAD_TOUCHPAD_UP
Gamepad touchpad finger was lifted.
Definition: SDL3pp_events.h:328
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:356
constexpr EventType EVENT_WINDOW_HDR_STATE_CHANGED
Window HDR properties have changed.
Definition: SDL3pp_events.h:224
constexpr EventType EVENT_PEN_PROXIMITY_IN
Pressure-sensitive pen has become available.
Definition: SDL3pp_events.h:381
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:378
constexpr EventType EVENT_KEY_DOWN
Key pressed.
Definition: SDL3pp_events.h:232
constexpr EventType EVENT_TEXT_EDITING_CANDIDATES
Keyboard text editing candidates.
Definition: SDL3pp_events.h:255
constexpr EventType EVENT_GAMEPAD_TOUCHPAD_DOWN
Gamepad touchpad was touched.
Definition: SDL3pp_events.h:322
constexpr EventType EVENT_WINDOW_MINIMIZED
Window has been minimized.
Definition: SDL3pp_events.h:163
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:431
constexpr EventType EVENT_LAST
This last event is only for bounding internal arrays.
Definition: SDL3pp_events.h:447
constexpr EventType EVENT_FINGER_MOTION
FINGER_MOTION.
Definition: SDL3pp_events.h:344
constexpr EventType EVENT_JOYSTICK_UPDATE_COMPLETE
Joystick update is complete.
Definition: SDL3pp_events.h:301
constexpr EventType EVENT_FINGER_CANCELED
FINGER_CANCELED.
Definition: SDL3pp_events.h:347
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:325
constexpr EventType EVENT_FINGER_UP
FINGER_UP.
Definition: SDL3pp_events.h:342
constexpr EventType EVENT_JOYSTICK_AXIS_MOTION
Joystick axis motion.
Definition: SDL3pp_events.h:276
constexpr EventType EVENT_WINDOW_DISPLAY_SCALE_CHANGED
Window display scale has been changed.
Definition: SDL3pp_events.h:199
constexpr EventType EVENT_FINGER_DOWN
FINGER_DOWN.
Definition: SDL3pp_events.h:340
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:222
constexpr EventType EVENT_PRIVATE3
PRIVATE3.
Definition: SDL3pp_events.h:435
constexpr EventType EVENT_GAMEPAD_BUTTON_UP
Gamepad button released.
Definition: SDL3pp_events.h:310
constexpr EventType EVENT_CAMERA_DEVICE_DENIED
A camera device has been denied for use by the user.
Definition: SDL3pp_events.h:417
constexpr EventType EVENT_GAMEPAD_STEAM_HANDLE_UPDATED
Gamepad Steam handle has changed.
Definition: SDL3pp_events.h:337
constexpr EventType EVENT_USER
Events EVENT_USER through EVENT_LAST are for your use, and should be allocated with RegisterEvents()
Definition: SDL3pp_events.h:444
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:246
constexpr EventType EVENT_MOUSE_BUTTON_DOWN
Mouse button pressed.
Definition: SDL3pp_events.h:261
constexpr EventType EVENT_LOCALE_CHANGED
The user's locale preferences have changed.
Definition: SDL3pp_events.h:103
constexpr EventType EVENT_PEN_AXIS
Pressure-sensitive pen angle/pressure/etc changed.
Definition: SDL3pp_events.h:403
constexpr EventType EVENT_WINDOW_MOUSE_LEAVE
Window has lost mouse focus.
Definition: SDL3pp_events.h:175
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:295
constexpr EventType EVENT_GAMEPAD_UPDATE_COMPLETE
Gamepad update is complete.
Definition: SDL3pp_events.h:334
constexpr EventType EVENT_CLIPBOARD_UPDATE
The clipboard or primary selection changed.
Definition: SDL3pp_events.h:350
constexpr EventType EVENT_AUDIO_DEVICE_FORMAT_CHANGED
An audio device's format has been changed by the system.
Definition: SDL3pp_events.h:375
constexpr EventType EVENT_MOUSE_WHEEL
Mouse wheel motion.
Definition: SDL3pp_events.h:267
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:291
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:449
constexpr EventType EVENT_GAMEPAD_SENSOR_UPDATE
Gamepad sensor was updated.
Definition: SDL3pp_events.h:331
constexpr EventType EVENT_WINDOW_SHOWN
Window has been shown.
Definition: SDL3pp_events.h:137
constexpr EventType EVENT_WINDOW_MAXIMIZED
Window has been maximized.
Definition: SDL3pp_events.h:166
constexpr EventType EVENT_GAMEPAD_ADDED
A new gamepad has been inserted into the system.
Definition: SDL3pp_events.h:313
constexpr EventType EVENT_WINDOW_FOCUS_LOST
Window has lost keyboard focus.
Definition: SDL3pp_events.h:181
constexpr EventType EVENT_MOUSE_MOTION
Mouse moved.
Definition: SDL3pp_events.h:258
constexpr EventType EVENT_PEN_BUTTON_DOWN
Pressure-sensitive pen button pressed.
Definition: SDL3pp_events.h:394
constexpr EventType EVENT_WINDOW_METAL_VIEW_RESIZED
The pixel size of a Metal view associated with the window has changed.
Definition: SDL3pp_events.h:160
constexpr EventType EVENT_GAMEPAD_AXIS_MOTION
Gamepad axis motion.
Definition: SDL3pp_events.h:304
constexpr EventType EVENT_RENDER_TARGETS_RESET
The render targets have been reset and their contents need to be updated.
Definition: SDL3pp_events.h:420
constexpr EventType EVENT_WINDOW_FOCUS_GAINED
Window has gained keyboard focus.
Definition: SDL3pp_events.h:178
constexpr EventType EVENT_WINDOW_ENTER_FULLSCREEN
The window has entered fullscreen mode.
Definition: SDL3pp_events.h:209
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:196
constexpr EventType EVENT_WINDOW_HIDDEN
Window has been hidden.
Definition: SDL3pp_events.h:140
constexpr EventType EVENT_CAMERA_DEVICE_ADDED
A new camera device is available.
Definition: SDL3pp_events.h:406
constexpr EventType EVENT_WINDOW_LAST
WINDOW_LAST.
Definition: SDL3pp_events.h:230
constexpr EventType EVENT_DROP_COMPLETE
Current set of drops is now complete (NULL filename)
Definition: SDL3pp_events.h:363
Main include header for the SDL3pp library.
Definition: SDL3pp_callbackWrapper.h:169
Semi-safe reference for Window.
Definition: SDL3pp_video.h:2962