SDL 3.0
SDL_events.h
Go to the documentation of this file.
1/*
2 Simple DirectMedia Layer
3 Copyright (C) 1997-2024 Sam Lantinga <slouken@libsdl.org>
4
5 This software is provided 'as-is', without any express or implied
6 warranty. In no event will the authors be held liable for any damages
7 arising from the use of this software.
8
9 Permission is granted to anyone to use this software for any purpose,
10 including commercial applications, and to alter it and redistribute it
11 freely, subject to the following restrictions:
12
13 1. The origin of this software must not be misrepresented; you must not
14 claim that you wrote the original software. If you use this software
15 in a product, an acknowledgment in the product documentation would be
16 appreciated but is not required.
17 2. Altered source versions must be plainly marked as such, and must not be
18 misrepresented as being the original software.
19 3. This notice may not be removed or altered from any source distribution.
20*/
21
22/**
23 * \file SDL_events.h
24 *
25 * Include file for SDL event handling.
26 */
27
28#ifndef SDL_events_h_
29#define SDL_events_h_
30
31#include <SDL3/SDL_audio.h>
32#include <SDL3/SDL_error.h>
33#include <SDL3/SDL_gamepad.h>
34#include <SDL3/SDL_joystick.h>
35#include <SDL3/SDL_keyboard.h>
36#include <SDL3/SDL_mouse.h>
37#include <SDL3/SDL_pen.h>
38#include <SDL3/SDL_stdinc.h>
39#include <SDL3/SDL_touch.h>
40#include <SDL3/SDL_video.h>
41#include <SDL3/SDL_camera.h>
42
43#include <SDL3/SDL_begin_code.h>
44/* Set up for C function definitions, even when using C++ */
45#ifdef __cplusplus
46extern "C" {
47#endif
48
49/* General keyboard/mouse state definitions */
50#define SDL_RELEASED 0
51#define SDL_PRESSED 1
52
53/**
54 * The types of events that can be delivered.
55 *
56 * \since This enum is available since SDL 3.0.0.
57 */
58typedef enum SDL_EventType
59{
60 SDL_EVENT_FIRST = 0, /**< Unused (do not remove) */
61
62 /* Application events */
63 SDL_EVENT_QUIT = 0x100, /**< User-requested quit */
64
65 /* These application events have special meaning on iOS, see README-ios.md for details */
66 SDL_EVENT_TERMINATING, /**< The application is being terminated by the OS
67 Called on iOS in applicationWillTerminate()
68 Called on Android in onDestroy()
69 */
70 SDL_EVENT_LOW_MEMORY, /**< The application is low on memory, free memory if possible.
71 Called on iOS in applicationDidReceiveMemoryWarning()
72 Called on Android in onLowMemory()
73 */
74 SDL_EVENT_WILL_ENTER_BACKGROUND, /**< The application is about to enter the background
75 Called on iOS in applicationWillResignActive()
76 Called on Android in onPause()
77 */
78 SDL_EVENT_DID_ENTER_BACKGROUND, /**< The application did enter the background and may not get CPU for some time
79 Called on iOS in applicationDidEnterBackground()
80 Called on Android in onPause()
81 */
82 SDL_EVENT_WILL_ENTER_FOREGROUND, /**< The application is about to enter the foreground
83 Called on iOS in applicationWillEnterForeground()
84 Called on Android in onResume()
85 */
86 SDL_EVENT_DID_ENTER_FOREGROUND, /**< The application is now interactive
87 Called on iOS in applicationDidBecomeActive()
88 Called on Android in onResume()
89 */
90
91 SDL_EVENT_LOCALE_CHANGED, /**< The user's locale preferences have changed. */
92
93 SDL_EVENT_SYSTEM_THEME_CHANGED, /**< The system theme changed */
94
95 /* Display events */
96 /* 0x150 was SDL_DISPLAYEVENT, reserve the number for sdl2-compat */
97 SDL_EVENT_DISPLAY_ORIENTATION = 0x151, /**< Display orientation has changed to data1 */
98 SDL_EVENT_DISPLAY_ADDED, /**< Display has been added to the system */
99 SDL_EVENT_DISPLAY_REMOVED, /**< Display has been removed from the system */
100 SDL_EVENT_DISPLAY_MOVED, /**< Display has changed position */
101 SDL_EVENT_DISPLAY_CONTENT_SCALE_CHANGED, /**< Display has changed content scale */
102 SDL_EVENT_DISPLAY_HDR_STATE_CHANGED, /**< Display HDR properties have changed */
105
106 /* Window events */
107 /* 0x200 was SDL_WINDOWEVENT, reserve the number for sdl2-compat */
108 /* 0x201 was SDL_EVENT_SYSWM, reserve the number for sdl2-compat */
109 SDL_EVENT_WINDOW_SHOWN = 0x202, /**< Window has been shown */
110 SDL_EVENT_WINDOW_HIDDEN, /**< Window has been hidden */
111 SDL_EVENT_WINDOW_EXPOSED, /**< Window has been exposed and should be redrawn */
112 SDL_EVENT_WINDOW_MOVED, /**< Window has been moved to data1, data2 */
113 SDL_EVENT_WINDOW_RESIZED, /**< Window has been resized to data1xdata2 */
114 SDL_EVENT_WINDOW_PIXEL_SIZE_CHANGED,/**< The pixel size of the window has changed to data1xdata2 */
115 SDL_EVENT_WINDOW_MINIMIZED, /**< Window has been minimized */
116 SDL_EVENT_WINDOW_MAXIMIZED, /**< Window has been maximized */
117 SDL_EVENT_WINDOW_RESTORED, /**< Window has been restored to normal size and position */
118 SDL_EVENT_WINDOW_MOUSE_ENTER, /**< Window has gained mouse focus */
119 SDL_EVENT_WINDOW_MOUSE_LEAVE, /**< Window has lost mouse focus */
120 SDL_EVENT_WINDOW_FOCUS_GAINED, /**< Window has gained keyboard focus */
121 SDL_EVENT_WINDOW_FOCUS_LOST, /**< Window has lost keyboard focus */
122 SDL_EVENT_WINDOW_CLOSE_REQUESTED, /**< The window manager requests that the window be closed */
123 SDL_EVENT_WINDOW_TAKE_FOCUS, /**< Window is being offered a focus (should SetWindowInputFocus() on itself or a subwindow, or ignore) */
124 SDL_EVENT_WINDOW_HIT_TEST, /**< Window had a hit test that wasn't SDL_HITTEST_NORMAL */
125 SDL_EVENT_WINDOW_ICCPROF_CHANGED, /**< The ICC profile of the window's display has changed */
126 SDL_EVENT_WINDOW_DISPLAY_CHANGED, /**< Window has been moved to display data1 */
127 SDL_EVENT_WINDOW_DISPLAY_SCALE_CHANGED, /**< Window display scale has been changed */
128 SDL_EVENT_WINDOW_OCCLUDED, /**< The window has been occluded */
129 SDL_EVENT_WINDOW_ENTER_FULLSCREEN, /**< The window has entered fullscreen mode */
130 SDL_EVENT_WINDOW_LEAVE_FULLSCREEN, /**< The window has left fullscreen mode */
131 SDL_EVENT_WINDOW_DESTROYED, /**< The window with the associated ID is being or has been destroyed. If this message is being handled
132 in an event watcher, the window handle is still valid and can still be used to retrieve any userdata
133 associated with the window. Otherwise, the handle has already been destroyed and all resources
134 associated with it are invalid */
135 SDL_EVENT_WINDOW_PEN_ENTER, /**< Window has gained focus of the pressure-sensitive pen with ID "data1" */
136 SDL_EVENT_WINDOW_PEN_LEAVE, /**< Window has lost focus of the pressure-sensitive pen with ID "data1" */
139
140 /* Keyboard events */
141 SDL_EVENT_KEY_DOWN = 0x300, /**< Key pressed */
142 SDL_EVENT_KEY_UP, /**< Key released */
143 SDL_EVENT_TEXT_EDITING, /**< Keyboard text editing (composition) */
144 SDL_EVENT_TEXT_INPUT, /**< Keyboard text input */
145 SDL_EVENT_KEYMAP_CHANGED, /**< Keymap changed due to a system event such as an
146 input language or keyboard layout change. */
147 SDL_EVENT_KEYBOARD_ADDED, /**< A new keyboard has been inserted into the system */
148 SDL_EVENT_KEYBOARD_REMOVED, /**< A keyboard has been removed */
149
150 /* Mouse events */
151 SDL_EVENT_MOUSE_MOTION = 0x400, /**< Mouse moved */
152 SDL_EVENT_MOUSE_BUTTON_DOWN, /**< Mouse button pressed */
153 SDL_EVENT_MOUSE_BUTTON_UP, /**< Mouse button released */
154 SDL_EVENT_MOUSE_WHEEL, /**< Mouse wheel motion */
155 SDL_EVENT_MOUSE_ADDED, /**< A new mouse has been inserted into the system */
156 SDL_EVENT_MOUSE_REMOVED, /**< A mouse has been removed */
157
158 /* Joystick events */
159 SDL_EVENT_JOYSTICK_AXIS_MOTION = 0x600, /**< Joystick axis motion */
160 SDL_EVENT_JOYSTICK_BALL_MOTION, /**< Joystick trackball motion */
161 SDL_EVENT_JOYSTICK_HAT_MOTION, /**< Joystick hat position change */
162 SDL_EVENT_JOYSTICK_BUTTON_DOWN, /**< Joystick button pressed */
163 SDL_EVENT_JOYSTICK_BUTTON_UP, /**< Joystick button released */
164 SDL_EVENT_JOYSTICK_ADDED, /**< A new joystick has been inserted into the system */
165 SDL_EVENT_JOYSTICK_REMOVED, /**< An opened joystick has been removed */
166 SDL_EVENT_JOYSTICK_BATTERY_UPDATED, /**< Joystick battery level change */
167 SDL_EVENT_JOYSTICK_UPDATE_COMPLETE, /**< Joystick update is complete */
168
169 /* Gamepad events */
170 SDL_EVENT_GAMEPAD_AXIS_MOTION = 0x650, /**< Gamepad axis motion */
171 SDL_EVENT_GAMEPAD_BUTTON_DOWN, /**< Gamepad button pressed */
172 SDL_EVENT_GAMEPAD_BUTTON_UP, /**< Gamepad button released */
173 SDL_EVENT_GAMEPAD_ADDED, /**< A new gamepad has been inserted into the system */
174 SDL_EVENT_GAMEPAD_REMOVED, /**< An opened gamepad has been removed */
175 SDL_EVENT_GAMEPAD_REMAPPED, /**< The gamepad mapping was updated */
176 SDL_EVENT_GAMEPAD_TOUCHPAD_DOWN, /**< Gamepad touchpad was touched */
177 SDL_EVENT_GAMEPAD_TOUCHPAD_MOTION, /**< Gamepad touchpad finger was moved */
178 SDL_EVENT_GAMEPAD_TOUCHPAD_UP, /**< Gamepad touchpad finger was lifted */
179 SDL_EVENT_GAMEPAD_SENSOR_UPDATE, /**< Gamepad sensor was updated */
180 SDL_EVENT_GAMEPAD_UPDATE_COMPLETE, /**< Gamepad update is complete */
181 SDL_EVENT_GAMEPAD_STEAM_HANDLE_UPDATED, /**< Gamepad Steam handle has changed */
182
183 /* Touch events */
187
188 /* 0x800, 0x801, and 0x802 were the Gesture events from SDL2. Do not reuse these values! sdl2-compat needs them! */
189
190 /* Clipboard events */
191 SDL_EVENT_CLIPBOARD_UPDATE = 0x900, /**< The clipboard or primary selection changed */
192
193 /* Drag and drop events */
194 SDL_EVENT_DROP_FILE = 0x1000, /**< The system requests a file open */
195 SDL_EVENT_DROP_TEXT, /**< text/plain drag-and-drop event */
196 SDL_EVENT_DROP_BEGIN, /**< A new set of drops is beginning (NULL filename) */
197 SDL_EVENT_DROP_COMPLETE, /**< Current set of drops is now complete (NULL filename) */
198 SDL_EVENT_DROP_POSITION, /**< Position while moving over the window */
199
200 /* Audio hotplug events */
201 SDL_EVENT_AUDIO_DEVICE_ADDED = 0x1100, /**< A new audio device is available */
202 SDL_EVENT_AUDIO_DEVICE_REMOVED, /**< An audio device has been removed. */
203 SDL_EVENT_AUDIO_DEVICE_FORMAT_CHANGED, /**< An audio device's format has been changed by the system. */
204
205 /* Sensor events */
206 SDL_EVENT_SENSOR_UPDATE = 0x1200, /**< A sensor was updated */
207
208 /* Pressure-sensitive pen events */
209 SDL_EVENT_PEN_DOWN = 0x1300, /**< Pressure-sensitive pen touched drawing surface */
210 SDL_EVENT_PEN_UP, /**< Pressure-sensitive pen stopped touching drawing surface */
211 SDL_EVENT_PEN_MOTION, /**< Pressure-sensitive pen moved, or angle/pressure changed */
212 SDL_EVENT_PEN_BUTTON_DOWN, /**< Pressure-sensitive pen button pressed */
213 SDL_EVENT_PEN_BUTTON_UP, /**< Pressure-sensitive pen button released */
214
215 /* Camera hotplug events */
216 SDL_EVENT_CAMERA_DEVICE_ADDED = 0x1400, /**< A new camera device is available */
217 SDL_EVENT_CAMERA_DEVICE_REMOVED, /**< A camera device has been removed. */
218 SDL_EVENT_CAMERA_DEVICE_APPROVED, /**< A camera device has been approved for use by the user. */
219 SDL_EVENT_CAMERA_DEVICE_DENIED, /**< A camera device has been denied for use by the user. */
220
221 /* Render events */
222 SDL_EVENT_RENDER_TARGETS_RESET = 0x2000, /**< The render targets have been reset and their contents need to be updated */
223 SDL_EVENT_RENDER_DEVICE_RESET, /**< The device has been reset and all textures need to be recreated */
224
225 /* Internal events */
226 SDL_EVENT_POLL_SENTINEL = 0x7F00, /**< Signals the end of an event poll cycle */
227
228 /** Events ::SDL_EVENT_USER through ::SDL_EVENT_LAST are for your use,
229 * and should be allocated with SDL_RegisterEvents()
230 */
232
233 /**
234 * This last event is only for bounding internal arrays
235 */
237
238 /* This just makes sure the enum is the size of Uint32 */
239 SDL_EVENT_ENUM_PADDING = 0x7FFFFFFF
240
242
243/**
244 * Fields shared by every event
245 *
246 * \since This struct is available since SDL 3.0.0.
247 */
248typedef struct SDL_CommonEvent
249{
250 Uint32 type; /**< Event type, shared with all events, Uint32 to cover user events which are not in the SDL_EventType enumeration */
252 Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
254
255/**
256 * Display state change event data (event.display.*)
257 *
258 * \since This struct is available since SDL 3.0.0.
259 */
260typedef struct SDL_DisplayEvent
261{
262 SDL_EventType type; /**< ::SDL_DISPLAYEVENT_* */
264 Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
265 SDL_DisplayID displayID;/**< The associated display */
266 Sint32 data1; /**< event dependent data */
268
269/**
270 * Window state change event data (event.window.*)
271 *
272 * \since This struct is available since SDL 3.0.0.
273 */
274typedef struct SDL_WindowEvent
275{
276 SDL_EventType type; /**< ::SDL_WINDOWEVENT_* */
278 Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
279 SDL_WindowID windowID; /**< The associated window */
280 Sint32 data1; /**< event dependent data */
281 Sint32 data2; /**< event dependent data */
283
284/**
285 * Keyboard device event structure (event.kdevice.*)
286 *
287 * \since This struct is available since SDL 3.0.0.
288 */
290{
291 SDL_EventType type; /**< ::SDL_EVENT_KEYBOARD_ADDED or ::SDL_EVENT_KEYBOARD_REMOVED */
293 Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
294 SDL_KeyboardID which; /**< The keyboard instance id */
296
297/**
298 * Keyboard button event structure (event.key.*)
299 *
300 * \since This struct is available since SDL 3.0.0.
301 */
302typedef struct SDL_KeyboardEvent
303{
304 SDL_EventType type; /**< ::SDL_EVENT_KEY_DOWN or ::SDL_EVENT_KEY_UP */
306 Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
307 SDL_WindowID windowID; /**< The window with keyboard focus, if any */
308 SDL_KeyboardID which; /**< The keyboard instance id, or 0 if unknown or virtual */
309 Uint8 state; /**< ::SDL_PRESSED or ::SDL_RELEASED */
310 Uint8 repeat; /**< Non-zero if this is a key repeat */
313 SDL_Keysym keysym; /**< The key that was pressed or released */
315
316#define SDL_TEXTEDITINGEVENT_TEXT_SIZE 64
317
318/**
319 * Keyboard text editing event structure (event.edit.*)
320 *
321 * The `text` is owned by SDL and should be copied if the application wants to
322 * hold onto it beyond the scope of handling this event.
323 *
324 * \since This struct is available since SDL 3.0.0.
325 */
327{
328 SDL_EventType type; /**< ::SDL_EVENT_TEXT_EDITING */
330 Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
331 SDL_WindowID windowID; /**< The window with keyboard focus, if any */
332 char *text; /**< The editing text */
333 Sint32 start; /**< The start cursor of selected editing text */
334 Sint32 length; /**< The length of selected editing text */
336
337/**
338 * Keyboard text input event structure (event.text.*)
339 *
340 * The `text` is owned by SDL and should be copied if the application wants to
341 * hold onto it beyond the scope of handling this event.
342 *
343 * \since This struct is available since SDL 3.0.0.
344 */
345typedef struct SDL_TextInputEvent
346{
347 SDL_EventType type; /**< ::SDL_EVENT_TEXT_INPUT */
349 Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
350 SDL_WindowID windowID; /**< The window with keyboard focus, if any */
351 char *text; /**< The input text, UTF-8 encoded */
353
354/**
355 * Mouse device event structure (event.mdevice.*)
356 *
357 * \since This struct is available since SDL 3.0.0.
358 */
360{
361 SDL_EventType type; /**< ::SDL_EVENT_MOUSE_ADDED or ::SDL_EVENT_MOUSE_REMOVED */
363 Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
364 SDL_MouseID which; /**< The mouse instance id */
366
367/**
368 * Mouse motion event structure (event.motion.*)
369 *
370 * \since This struct is available since SDL 3.0.0.
371 */
373{
374 SDL_EventType type; /**< ::SDL_EVENT_MOUSE_MOTION */
376 Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
377 SDL_WindowID windowID; /**< The window with mouse focus, if any */
378 SDL_MouseID which; /**< The mouse instance id, SDL_TOUCH_MOUSEID, or SDL_PEN_MOUSEID */
379 Uint32 state; /**< The current button state */
380 float x; /**< X coordinate, relative to window */
381 float y; /**< Y coordinate, relative to window */
382 float xrel; /**< The relative motion in the X direction */
383 float yrel; /**< The relative motion in the Y direction */
385
386/**
387 * Mouse button event structure (event.button.*)
388 *
389 * \since This struct is available since SDL 3.0.0.
390 */
392{
393 SDL_EventType type; /**< ::SDL_EVENT_MOUSE_BUTTON_DOWN or ::SDL_EVENT_MOUSE_BUTTON_UP */
395 Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
396 SDL_WindowID windowID; /**< The window with mouse focus, if any */
397 SDL_MouseID which; /**< The mouse instance id, SDL_TOUCH_MOUSEID, or SDL_PEN_MOUSEID */
398 Uint8 button; /**< The mouse button index */
399 Uint8 state; /**< ::SDL_PRESSED or ::SDL_RELEASED */
400 Uint8 clicks; /**< 1 for single-click, 2 for double-click, etc. */
402 float x; /**< X coordinate, relative to window */
403 float y; /**< Y coordinate, relative to window */
405
406/**
407 * Mouse wheel event structure (event.wheel.*)
408 *
409 * \since This struct is available since SDL 3.0.0.
410 */
412{
413 SDL_EventType type; /**< ::SDL_EVENT_MOUSE_WHEEL */
415 Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
416 SDL_WindowID windowID; /**< The window with mouse focus, if any */
417 SDL_MouseID which; /**< The mouse instance id, SDL_TOUCH_MOUSEID, or SDL_PEN_MOUSEID */
418 float x; /**< The amount scrolled horizontally, positive to the right and negative to the left */
419 float y; /**< The amount scrolled vertically, positive away from the user and negative toward the user */
420 SDL_MouseWheelDirection direction; /**< Set to one of the SDL_MOUSEWHEEL_* defines. When FLIPPED the values in X and Y will be opposite. Multiply by -1 to change them back */
421 float mouse_x; /**< X coordinate, relative to window */
422 float mouse_y; /**< Y coordinate, relative to window */
424
425/**
426 * Joystick axis motion event structure (event.jaxis.*)
427 *
428 * \since This struct is available since SDL 3.0.0.
429 */
430typedef struct SDL_JoyAxisEvent
431{
432 SDL_EventType type; /**< ::SDL_EVENT_JOYSTICK_AXIS_MOTION */
434 Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
435 SDL_JoystickID which; /**< The joystick instance id */
436 Uint8 axis; /**< The joystick axis index */
440 Sint16 value; /**< The axis value (range: -32768 to 32767) */
443
444/**
445 * Joystick trackball motion event structure (event.jball.*)
446 *
447 * \since This struct is available since SDL 3.0.0.
448 */
449typedef struct SDL_JoyBallEvent
450{
451 SDL_EventType type; /**< ::SDL_EVENT_JOYSTICK_BALL_MOTION */
453 Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
454 SDL_JoystickID which; /**< The joystick instance id */
455 Uint8 ball; /**< The joystick trackball index */
459 Sint16 xrel; /**< The relative motion in the X direction */
460 Sint16 yrel; /**< The relative motion in the Y direction */
462
463/**
464 * Joystick hat position change event structure (event.jhat.*)
465 *
466 * \since This struct is available since SDL 3.0.0.
467 */
468typedef struct SDL_JoyHatEvent
469{
470 SDL_EventType type; /**< ::SDL_EVENT_JOYSTICK_HAT_MOTION */
472 Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
473 SDL_JoystickID which; /**< The joystick instance id */
474 Uint8 hat; /**< The joystick hat index */
475 Uint8 value; /**< The hat position value.
476 * \sa ::SDL_HAT_LEFTUP ::SDL_HAT_UP ::SDL_HAT_RIGHTUP
477 * \sa ::SDL_HAT_LEFT ::SDL_HAT_CENTERED ::SDL_HAT_RIGHT
478 * \sa ::SDL_HAT_LEFTDOWN ::SDL_HAT_DOWN ::SDL_HAT_RIGHTDOWN
479 *
480 * Note that zero means the POV is centered.
481 */
485
486/**
487 * Joystick button event structure (event.jbutton.*)
488 *
489 * \since This struct is available since SDL 3.0.0.
490 */
491typedef struct SDL_JoyButtonEvent
492{
493 SDL_EventType type; /**< ::SDL_EVENT_JOYSTICK_BUTTON_DOWN or ::SDL_EVENT_JOYSTICK_BUTTON_UP */
495 Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
496 SDL_JoystickID which; /**< The joystick instance id */
497 Uint8 button; /**< The joystick button index */
498 Uint8 state; /**< ::SDL_PRESSED or ::SDL_RELEASED */
502
503/**
504 * Joystick device event structure (event.jdevice.*)
505 *
506 * \since This struct is available since SDL 3.0.0.
507 */
508typedef struct SDL_JoyDeviceEvent
509{
510 SDL_EventType type; /**< ::SDL_EVENT_JOYSTICK_ADDED or ::SDL_EVENT_JOYSTICK_REMOVED or ::SDL_EVENT_JOYSTICK_UPDATE_COMPLETE */
512 Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
513 SDL_JoystickID which; /**< The joystick instance id */
515
516/**
517 * Joysick battery level change event structure (event.jbattery.*)
518 *
519 * \since This struct is available since SDL 3.0.0.
520 */
522{
523 SDL_EventType type; /**< ::SDL_EVENT_JOYSTICK_BATTERY_UPDATED */
525 Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
526 SDL_JoystickID which; /**< The joystick instance id */
527 SDL_PowerState state; /**< The joystick battery state */
528 int percent; /**< The joystick battery percent charge remaining */
530
531/**
532 * Gamepad axis motion event structure (event.gaxis.*)
533 *
534 * \since This struct is available since SDL 3.0.0.
535 */
537{
538 SDL_EventType type; /**< ::SDL_EVENT_GAMEPAD_AXIS_MOTION */
540 Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
541 SDL_JoystickID which; /**< The joystick instance id */
542 Uint8 axis; /**< The gamepad axis (SDL_GamepadAxis) */
546 Sint16 value; /**< The axis value (range: -32768 to 32767) */
549
550
551/**
552 * Gamepad button event structure (event.gbutton.*)
553 *
554 * \since This struct is available since SDL 3.0.0.
555 */
557{
558 SDL_EventType type; /**< ::SDL_EVENT_GAMEPAD_BUTTON_DOWN or ::SDL_EVENT_GAMEPAD_BUTTON_UP */
560 Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
561 SDL_JoystickID which; /**< The joystick instance id */
562 Uint8 button; /**< The gamepad button (SDL_GamepadButton) */
563 Uint8 state; /**< ::SDL_PRESSED or ::SDL_RELEASED */
567
568
569/**
570 * Gamepad device event structure (event.gdevice.*)
571 *
572 * \since This struct is available since SDL 3.0.0.
573 */
575{
576 SDL_EventType type; /**< ::SDL_EVENT_GAMEPAD_ADDED, ::SDL_EVENT_GAMEPAD_REMOVED, or ::SDL_EVENT_GAMEPAD_REMAPPED, ::SDL_EVENT_GAMEPAD_UPDATE_COMPLETE or ::SDL_EVENT_GAMEPAD_STEAM_HANDLE_UPDATED */
578 Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
579 SDL_JoystickID which; /**< The joystick instance id */
581
582/**
583 * Gamepad touchpad event structure (event.gtouchpad.*)
584 *
585 * \since This struct is available since SDL 3.0.0.
586 */
588{
589 SDL_EventType type; /**< ::SDL_EVENT_GAMEPAD_TOUCHPAD_DOWN or ::SDL_EVENT_GAMEPAD_TOUCHPAD_MOTION or ::SDL_EVENT_GAMEPAD_TOUCHPAD_UP */
591 Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
592 SDL_JoystickID which; /**< The joystick instance id */
593 Sint32 touchpad; /**< The index of the touchpad */
594 Sint32 finger; /**< The index of the finger on the touchpad */
595 float x; /**< Normalized in the range 0...1 with 0 being on the left */
596 float y; /**< Normalized in the range 0...1 with 0 being at the top */
597 float pressure; /**< Normalized in the range 0...1 */
599
600/**
601 * Gamepad sensor event structure (event.gsensor.*)
602 *
603 * \since This struct is available since SDL 3.0.0.
604 */
606{
607 SDL_EventType type; /**< ::SDL_EVENT_GAMEPAD_SENSOR_UPDATE */
609 Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
610 SDL_JoystickID which; /**< The joystick instance id */
611 Sint32 sensor; /**< The type of the sensor, one of the values of ::SDL_SensorType */
612 float data[3]; /**< Up to 3 values from the sensor, as defined in SDL_sensor.h */
613 Uint64 sensor_timestamp; /**< The timestamp of the sensor reading in nanoseconds, not necessarily synchronized with the system clock */
615
616/**
617 * Audio device event structure (event.adevice.*)
618 *
619 * \since This struct is available since SDL 3.0.0.
620 */
622{
623 SDL_EventType type; /**< ::SDL_EVENT_AUDIO_DEVICE_ADDED, or ::SDL_EVENT_AUDIO_DEVICE_REMOVED, or ::SDL_EVENT_AUDIO_DEVICE_FORMAT_CHANGED */
625 Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
626 SDL_AudioDeviceID which; /**< SDL_AudioDeviceID for the device being added or removed or changing */
627 Uint8 iscapture; /**< zero if an output device, non-zero if a capture device. */
632
633/**
634 * Camera device event structure (event.cdevice.*)
635 *
636 * \since This struct is available since SDL 3.0.0.
637 */
639{
640 SDL_EventType type; /**< ::SDL_EVENT_CAMERA_DEVICE_ADDED, ::SDL_EVENT_CAMERA_DEVICE_REMOVED, ::SDL_EVENT_CAMERA_DEVICE_APPROVED, ::SDL_EVENT_CAMERA_DEVICE_DENIED */
642 Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
643 SDL_CameraDeviceID which; /**< SDL_CameraDeviceID for the device being added or removed or changing */
645
646/**
647 * Touch finger event structure (event.tfinger.*)
648 *
649 * \since This struct is available since SDL 3.0.0.
650 */
652{
653 SDL_EventType type; /**< ::SDL_EVENT_FINGER_MOTION or ::SDL_EVENT_FINGER_DOWN or ::SDL_EVENT_FINGER_UP */
655 Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
656 SDL_TouchID touchID; /**< The touch device id */
658 float x; /**< Normalized in the range 0...1 */
659 float y; /**< Normalized in the range 0...1 */
660 float dx; /**< Normalized in the range -1...1 */
661 float dy; /**< Normalized in the range -1...1 */
662 float pressure; /**< Normalized in the range 0...1 */
663 SDL_WindowID windowID; /**< The window underneath the finger, if any */
665
666
667#define SDL_DROPEVENT_DATA_SIZE 64
668
669/**
670 * Pressure-sensitive pen touched or stopped touching surface (event.ptip.*)
671 *
672 * \since This struct is available since SDL 3.0.0.
673 */
674typedef struct SDL_PenTipEvent
675{
676 SDL_EventType type; /**< ::SDL_EVENT_PEN_DOWN or ::SDL_EVENT_PEN_UP */
678 Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
679 SDL_WindowID windowID; /**< The window with pen focus, if any */
680 SDL_PenID which; /**< The pen instance id */
681 Uint8 tip; /**< ::SDL_PEN_TIP_INK when using a regular pen tip, or ::SDL_PEN_TIP_ERASER if the pen is being used as an eraser (e.g., flipped to use the eraser tip) */
682 Uint8 state; /**< ::SDL_PRESSED on ::SDL_EVENT_PEN_DOWN and ::SDL_RELEASED on ::SDL_EVENT_PEN_UP */
683 Uint16 pen_state; /**< Pen button masks (where SDL_BUTTON(1) is the first button, SDL_BUTTON(2) is the second button etc.), ::SDL_PEN_DOWN_MASK is set if the pen is touching the surface, and ::SDL_PEN_ERASER_MASK is set if the pen is (used as) an eraser. */
684 float x; /**< X coordinate, relative to window */
685 float y; /**< Y coordinate, relative to window */
686 float axes[SDL_PEN_NUM_AXES]; /**< Pen axes such as pressure and tilt (ordered as per ::SDL_PenAxis) */
688
689/**
690 * Pressure-sensitive pen motion / pressure / angle event structure
691 * (event.pmotion.*)
692 *
693 * \since This struct is available since SDL 3.0.0.
694 */
695typedef struct SDL_PenMotionEvent
696{
697 SDL_EventType type; /**< ::SDL_EVENT_PEN_MOTION */
699 Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
700 SDL_WindowID windowID; /**< The window with pen focus, if any */
701 SDL_PenID which; /**< The pen instance id */
704 Uint16 pen_state; /**< Pen button masks (where SDL_BUTTON(1) is the first button, SDL_BUTTON(2) is the second button etc.), ::SDL_PEN_DOWN_MASK is set if the pen is touching the surface, and ::SDL_PEN_ERASER_MASK is set if the pen is (used as) an eraser. */
705 float x; /**< X coordinate, relative to window */
706 float y; /**< Y coordinate, relative to window */
707 float axes[SDL_PEN_NUM_AXES]; /**< Pen axes such as pressure and tilt (ordered as per ::SDL_PenAxis) */
709
710/**
711 * Pressure-sensitive pen button event structure (event.pbutton.*)
712 *
713 * \since This struct is available since SDL 3.0.0.
714 */
715typedef struct SDL_PenButtonEvent
716{
717 SDL_EventType type; /**< ::SDL_EVENT_PEN_BUTTON_DOWN or ::SDL_EVENT_PEN_BUTTON_UP */
719 Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
720 SDL_WindowID windowID; /**< The window with pen focus, if any */
721 SDL_PenID which; /**< The pen instance id */
722 Uint8 button; /**< The pen button index (1 represents the pen tip for compatibility with mouse events) */
723 Uint8 state; /**< ::SDL_PRESSED or ::SDL_RELEASED */
724 Uint16 pen_state; /**< Pen button masks (where SDL_BUTTON(1) is the first button, SDL_BUTTON(2) is the second button etc.), ::SDL_PEN_DOWN_MASK is set if the pen is touching the surface, and ::SDL_PEN_ERASER_MASK is set if the pen is (used as) an eraser. */
725 float x; /**< X coordinate, relative to window */
726 float y; /**< Y coordinate, relative to window */
727 float axes[SDL_PEN_NUM_AXES]; /**< Pen axes such as pressure and tilt (ordered as per ::SDL_PenAxis) */
729
730/**
731 * An event used to drop text or request a file open by the system
732 * (event.drop.*)
733 *
734 * The `data` is owned by SDL and should be copied if the application wants to
735 * hold onto it beyond the scope of handling this event. Do not free it!
736 *
737 * \since This struct is available since SDL 3.0.0.
738 */
739typedef struct SDL_DropEvent
740{
741 SDL_EventType type; /**< ::SDL_EVENT_DROP_BEGIN or ::SDL_EVENT_DROP_FILE or ::SDL_EVENT_DROP_TEXT or ::SDL_EVENT_DROP_COMPLETE or ::SDL_EVENT_DROP_POSITION */
743 Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
744 SDL_WindowID windowID; /**< The window that was dropped on, if any */
745 float x; /**< X coordinate, relative to window (not on begin) */
746 float y; /**< Y coordinate, relative to window (not on begin) */
747 char *source; /**< The source app that sent this drop event, or NULL if that isn't available */
748 char *data; /**< The text for SDL_EVENT_DROP_TEXT and the file name for SDL_EVENT_DROP_FILE, NULL for other events */
750
751/**
752 * An event triggered when the clipboard contents have changed
753 * (event.clipboard.*)
754 *
755 * \since This struct is available since SDL 3.0.0.
756 */
757typedef struct SDL_ClipboardEvent
758{
759 SDL_EventType type; /**< ::SDL_EVENT_CLIPBOARD_UPDATE */
761 Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
763
764/**
765 * Sensor event structure (event.sensor.*)
766 *
767 * \since This struct is available since SDL 3.0.0.
768 */
769typedef struct SDL_SensorEvent
770{
771 SDL_EventType type; /**< ::SDL_EVENT_SENSOR_UPDATE */
773 Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
774 SDL_SensorID which; /**< The instance ID of the sensor */
775 float data[6]; /**< Up to 6 values from the sensor - additional values can be queried using SDL_GetSensorData() */
776 Uint64 sensor_timestamp; /**< The timestamp of the sensor reading in nanoseconds, not necessarily synchronized with the system clock */
778
779/**
780 * The "quit requested" event
781 *
782 * \since This struct is available since SDL 3.0.0.
783 */
784typedef struct SDL_QuitEvent
785{
786 SDL_EventType type; /**< ::SDL_EVENT_QUIT */
788 Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
790
791/**
792 * A user-defined event type (event.user.*)
793 *
794 * This event is unique; it is never created by SDL, but only by the
795 * application. The event can be pushed onto the event queue using
796 * SDL_PushEvent(). The contents of the structure members are completely up to
797 * the programmer; the only requirement is that '''type''' is a value obtained
798 * from SDL_RegisterEvents().
799 *
800 * \since This struct is available since SDL 3.0.0.
801 */
802typedef struct SDL_UserEvent
803{
804 Uint32 type; /**< ::SDL_EVENT_USER through ::SDL_EVENT_LAST-1, Uint32 because these are not in the SDL_EventType enumeration */
806 Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
807 SDL_WindowID windowID; /**< The associated window if any */
808 Sint32 code; /**< User defined event code */
809 void *data1; /**< User defined data pointer */
810 void *data2; /**< User defined data pointer */
812
813
814/**
815 * The structure for all events in SDL.
816 *
817 * \since This struct is available since SDL 3.0.0.
818 */
819typedef union SDL_Event
820{
821 Uint32 type; /**< Event type, shared with all events, Uint32 to cover user events which are not in the SDL_EventType enumeration */
822 SDL_CommonEvent common; /**< Common event data */
823 SDL_DisplayEvent display; /**< Display event data */
824 SDL_WindowEvent window; /**< Window event data */
825 SDL_KeyboardDeviceEvent kdevice; /**< Keyboard device change event data */
826 SDL_KeyboardEvent key; /**< Keyboard event data */
827 SDL_TextEditingEvent edit; /**< Text editing event data */
828 SDL_TextInputEvent text; /**< Text input event data */
829 SDL_MouseDeviceEvent mdevice; /**< Mouse device change event data */
830 SDL_MouseMotionEvent motion; /**< Mouse motion event data */
831 SDL_MouseButtonEvent button; /**< Mouse button event data */
832 SDL_MouseWheelEvent wheel; /**< Mouse wheel event data */
833 SDL_JoyDeviceEvent jdevice; /**< Joystick device change event data */
834 SDL_JoyAxisEvent jaxis; /**< Joystick axis event data */
835 SDL_JoyBallEvent jball; /**< Joystick ball event data */
836 SDL_JoyHatEvent jhat; /**< Joystick hat event data */
837 SDL_JoyButtonEvent jbutton; /**< Joystick button event data */
838 SDL_JoyBatteryEvent jbattery; /**< Joystick battery event data */
839 SDL_GamepadDeviceEvent gdevice; /**< Gamepad device event data */
840 SDL_GamepadAxisEvent gaxis; /**< Gamepad axis event data */
841 SDL_GamepadButtonEvent gbutton; /**< Gamepad button event data */
842 SDL_GamepadTouchpadEvent gtouchpad; /**< Gamepad touchpad event data */
843 SDL_GamepadSensorEvent gsensor; /**< Gamepad sensor event data */
844 SDL_AudioDeviceEvent adevice; /**< Audio device event data */
845 SDL_CameraDeviceEvent cdevice; /**< Camera device event data */
846 SDL_SensorEvent sensor; /**< Sensor event data */
847 SDL_QuitEvent quit; /**< Quit request event data */
848 SDL_UserEvent user; /**< Custom event data */
849 SDL_TouchFingerEvent tfinger; /**< Touch finger event data */
850 SDL_PenTipEvent ptip; /**< Pen tip touching or leaving drawing surface */
851 SDL_PenMotionEvent pmotion; /**< Pen change in position, pressure, or angle */
852 SDL_PenButtonEvent pbutton; /**< Pen button press */
853 SDL_DropEvent drop; /**< Drag and drop event data */
854 SDL_ClipboardEvent clipboard; /**< Clipboard event data */
855
856 /* This is necessary for ABI compatibility between Visual C++ and GCC.
857 Visual C++ will respect the push pack pragma and use 52 bytes (size of
858 SDL_TextEditingEvent, the largest structure for 32-bit and 64-bit
859 architectures) for this union, and GCC will use the alignment of the
860 largest datatype within the union, which is 8 bytes on 64-bit
861 architectures.
862
863 So... we'll add padding to force the size to be the same for both.
864
865 On architectures where pointers are 16 bytes, this needs rounding up to
866 the next multiple of 16, 64, and on architectures where pointers are
867 even larger the size of SDL_UserEvent will dominate as being 3 pointers.
868 */
870} SDL_Event;
871
872/* Make sure we haven't broken binary compatibility */
873SDL_COMPILE_TIME_ASSERT(SDL_Event, sizeof(SDL_Event) == sizeof(((SDL_Event *)NULL)->padding));
874
875
876/* Function prototypes */
877
878/**
879 * Pump the event loop, gathering events from the input devices.
880 *
881 * This function updates the event queue and internal input device state.
882 *
883 * **WARNING**: This should only be run in the thread that initialized the
884 * video subsystem, and for extra safety, you should consider only doing those
885 * things on the main thread in any case.
886 *
887 * SDL_PumpEvents() gathers all the pending input information from devices and
888 * places it in the event queue. Without calls to SDL_PumpEvents() no events
889 * would ever be placed on the queue. Often the need for calls to
890 * SDL_PumpEvents() is hidden from the user since SDL_PollEvent() and
891 * SDL_WaitEvent() implicitly call SDL_PumpEvents(). However, if you are not
892 * polling or waiting for events (e.g. you are filtering them), then you must
893 * call SDL_PumpEvents() to force an event queue update.
894 *
895 * \since This function is available since SDL 3.0.0.
896 *
897 * \sa SDL_PollEvent
898 * \sa SDL_WaitEvent
899 */
900extern DECLSPEC void SDLCALL SDL_PumpEvents(void);
901
902/* @{ */
909
910/**
911 * Check the event queue for messages and optionally return them.
912 *
913 * `action` may be any of the following:
914 *
915 * - `SDL_ADDEVENT`: up to `numevents` events will be added to the back of the
916 * event queue.
917 * - `SDL_PEEKEVENT`: `numevents` events at the front of the event queue,
918 * within the specified minimum and maximum type, will be returned to the
919 * caller and will _not_ be removed from the queue.
920 * - `SDL_GETEVENT`: up to `numevents` events at the front of the event queue,
921 * within the specified minimum and maximum type, will be returned to the
922 * caller and will be removed from the queue.
923 *
924 * You may have to call SDL_PumpEvents() before calling this function.
925 * Otherwise, the events may not be ready to be filtered when you call
926 * SDL_PeepEvents().
927 *
928 * This function is thread-safe.
929 *
930 * \param events destination buffer for the retrieved events
931 * \param numevents if action is SDL_ADDEVENT, the number of events to add
932 * back to the event queue; if action is SDL_PEEKEVENT or
933 * SDL_GETEVENT, the maximum number of events to retrieve
934 * \param action action to take; see [[#action|Remarks]] for details
935 * \param minType minimum value of the event type to be considered;
936 * SDL_EVENT_FIRST is a safe choice
937 * \param maxType maximum value of the event type to be considered;
938 * SDL_EVENT_LAST is a safe choice
939 * \returns the number of events actually stored or a negative error code on
940 * failure; call SDL_GetError() for more information.
941 *
942 * \since This function is available since SDL 3.0.0.
943 *
944 * \sa SDL_PollEvent
945 * \sa SDL_PumpEvents
946 * \sa SDL_PushEvent
947 */
948extern DECLSPEC int SDLCALL SDL_PeepEvents(SDL_Event *events, int numevents, SDL_EventAction action, Uint32 minType, Uint32 maxType);
949/* @} */
950
951/**
952 * Check for the existence of a certain event type in the event queue.
953 *
954 * If you need to check for a range of event types, use SDL_HasEvents()
955 * instead.
956 *
957 * \param type the type of event to be queried; see SDL_EventType for details
958 * \returns SDL_TRUE if events matching `type` are present, or SDL_FALSE if
959 * events matching `type` are not present.
960 *
961 * \since This function is available since SDL 3.0.0.
962 *
963 * \sa SDL_HasEvents
964 */
965extern DECLSPEC SDL_bool SDLCALL SDL_HasEvent(Uint32 type);
966
967
968/**
969 * Check for the existence of certain event types in the event queue.
970 *
971 * If you need to check for a single event type, use SDL_HasEvent() instead.
972 *
973 * \param minType the low end of event type to be queried, inclusive; see
974 * SDL_EventType for details
975 * \param maxType the high end of event type to be queried, inclusive; see
976 * SDL_EventType for details
977 * \returns SDL_TRUE if events with type >= `minType` and <= `maxType` are
978 * present, or SDL_FALSE if not.
979 *
980 * \since This function is available since SDL 3.0.0.
981 *
982 * \sa SDL_HasEvents
983 */
984extern DECLSPEC SDL_bool SDLCALL SDL_HasEvents(Uint32 minType, Uint32 maxType);
985
986/**
987 * Clear events of a specific type from the event queue.
988 *
989 * This will unconditionally remove any events from the queue that match
990 * `type`. If you need to remove a range of event types, use SDL_FlushEvents()
991 * instead.
992 *
993 * It's also normal to just ignore events you don't care about in your event
994 * loop without calling this function.
995 *
996 * This function only affects currently queued events. If you want to make
997 * sure that all pending OS events are flushed, you can call SDL_PumpEvents()
998 * on the main thread immediately before the flush call.
999 *
1000 * If you have user events with custom data that needs to be freed, you should
1001 * use SDL_PeepEvents() to remove and clean up those events before calling
1002 * this function.
1003 *
1004 * \param type the type of event to be cleared; see SDL_EventType for details
1005 *
1006 * \since This function is available since SDL 3.0.0.
1007 *
1008 * \sa SDL_FlushEvents
1009 */
1010extern DECLSPEC void SDLCALL SDL_FlushEvent(Uint32 type);
1011
1012/**
1013 * Clear events of a range of types from the event queue.
1014 *
1015 * This will unconditionally remove any events from the queue that are in the
1016 * range of `minType` to `maxType`, inclusive. If you need to remove a single
1017 * event type, use SDL_FlushEvent() instead.
1018 *
1019 * It's also normal to just ignore events you don't care about in your event
1020 * loop without calling this function.
1021 *
1022 * This function only affects currently queued events. If you want to make
1023 * sure that all pending OS events are flushed, you can call SDL_PumpEvents()
1024 * on the main thread immediately before the flush call.
1025 *
1026 * \param minType the low end of event type to be cleared, inclusive; see
1027 * SDL_EventType for details
1028 * \param maxType the high end of event type to be cleared, inclusive; see
1029 * SDL_EventType for details
1030 *
1031 * \since This function is available since SDL 3.0.0.
1032 *
1033 * \sa SDL_FlushEvent
1034 */
1035extern DECLSPEC void SDLCALL SDL_FlushEvents(Uint32 minType, Uint32 maxType);
1036
1037/**
1038 * Poll for currently pending events.
1039 *
1040 * If `event` is not NULL, the next event is removed from the queue and stored
1041 * in the SDL_Event structure pointed to by `event`. The 1 returned refers to
1042 * this event, immediately stored in the SDL Event structure -- not an event
1043 * to follow.
1044 *
1045 * If `event` is NULL, it simply returns 1 if there is an event in the queue,
1046 * but will not remove it from the queue.
1047 *
1048 * As this function may implicitly call SDL_PumpEvents(), you can only call
1049 * this function in the thread that set the video mode.
1050 *
1051 * SDL_PollEvent() is the favored way of receiving system events since it can
1052 * be done from the main loop and does not suspend the main loop while waiting
1053 * on an event to be posted.
1054 *
1055 * The common practice is to fully process the event queue once every frame,
1056 * usually as a first step before updating the game's state:
1057 *
1058 * ```c
1059 * while (game_is_still_running) {
1060 * SDL_Event event;
1061 * while (SDL_PollEvent(&event)) { // poll until all events are handled!
1062 * // decide what to do with this event.
1063 * }
1064 *
1065 * // update game state, draw the current frame
1066 * }
1067 * ```
1068 *
1069 * \param event the SDL_Event structure to be filled with the next event from
1070 * the queue, or NULL
1071 * \returns SDL_TRUE if this got an event or SDL_FALSE if there are none
1072 * available.
1073 *
1074 * \since This function is available since SDL 3.0.0.
1075 *
1076 * \sa SDL_PushEvent
1077 * \sa SDL_WaitEvent
1078 * \sa SDL_WaitEventTimeout
1079 */
1080extern DECLSPEC SDL_bool SDLCALL SDL_PollEvent(SDL_Event *event);
1081
1082/**
1083 * Wait indefinitely for the next available event.
1084 *
1085 * If `event` is not NULL, the next event is removed from the queue and stored
1086 * in the SDL_Event structure pointed to by `event`.
1087 *
1088 * As this function may implicitly call SDL_PumpEvents(), you can only call
1089 * this function in the thread that initialized the video subsystem.
1090 *
1091 * \param event the SDL_Event structure to be filled in with the next event
1092 * from the queue, or NULL
1093 * \returns SDL_TRUE on success or SDL_FALSE if there was an error while
1094 * waiting for events; call SDL_GetError() for more information.
1095 *
1096 * \since This function is available since SDL 3.0.0.
1097 *
1098 * \sa SDL_PollEvent
1099 * \sa SDL_PushEvent
1100 * \sa SDL_WaitEventTimeout
1101 */
1102extern DECLSPEC SDL_bool SDLCALL SDL_WaitEvent(SDL_Event *event);
1103
1104/**
1105 * Wait until the specified timeout (in milliseconds) for the next available
1106 * event.
1107 *
1108 * If `event` is not NULL, the next event is removed from the queue and stored
1109 * in the SDL_Event structure pointed to by `event`.
1110 *
1111 * As this function may implicitly call SDL_PumpEvents(), you can only call
1112 * this function in the thread that initialized the video subsystem.
1113 *
1114 * The timeout is not guaranteed, the actual wait time could be longer due to
1115 * system scheduling.
1116 *
1117 * \param event the SDL_Event structure to be filled in with the next event
1118 * from the queue, or NULL
1119 * \param timeoutMS the maximum number of milliseconds to wait for the next
1120 * available event
1121 * \returns SDL_TRUE if this got an event or SDL_FALSE if the timeout elapsed
1122 * without any events available.
1123 *
1124 * \since This function is available since SDL 3.0.0.
1125 *
1126 * \sa SDL_PollEvent
1127 * \sa SDL_PushEvent
1128 * \sa SDL_WaitEvent
1129 */
1130extern DECLSPEC SDL_bool SDLCALL SDL_WaitEventTimeout(SDL_Event *event, Sint32 timeoutMS);
1131
1132/**
1133 * Add an event to the event queue.
1134 *
1135 * The event queue can actually be used as a two way communication channel.
1136 * Not only can events be read from the queue, but the user can also push
1137 * their own events onto it. `event` is a pointer to the event structure you
1138 * wish to push onto the queue. The event is copied into the queue, and the
1139 * caller may dispose of the memory pointed to after SDL_PushEvent() returns.
1140 *
1141 * Note: Pushing device input events onto the queue doesn't modify the state
1142 * of the device within SDL.
1143 *
1144 * This function is thread-safe, and can be called from other threads safely.
1145 *
1146 * Note: Events pushed onto the queue with SDL_PushEvent() get passed through
1147 * the event filter but events added with SDL_PeepEvents() do not.
1148 *
1149 * For pushing application-specific events, please use SDL_RegisterEvents() to
1150 * get an event type that does not conflict with other code that also wants
1151 * its own custom event types.
1152 *
1153 * \param event the SDL_Event to be added to the queue
1154 * \returns 1 on success, 0 if the event was filtered, or a negative error
1155 * code on failure; call SDL_GetError() for more information. A
1156 * common reason for error is the event queue being full.
1157 *
1158 * \since This function is available since SDL 3.0.0.
1159 *
1160 * \sa SDL_PeepEvents
1161 * \sa SDL_PollEvent
1162 * \sa SDL_RegisterEvents
1163 */
1164extern DECLSPEC int SDLCALL SDL_PushEvent(SDL_Event *event);
1165
1166/**
1167 * A function pointer used for callbacks that watch the event queue.
1168 *
1169 * \param userdata what was passed as `userdata` to SDL_SetEventFilter() or
1170 * SDL_AddEventWatch, etc
1171 * \param event the event that triggered the callback
1172 * \returns 1 to permit event to be added to the queue, and 0 to disallow it.
1173 * When used with SDL_AddEventWatch, the return value is ignored.
1174 *
1175 * \threadsafety SDL may call this callback at any time from any thread; the
1176 * application is responsible for locking resources the callback
1177 * touches that need to be protected.
1178 *
1179 * \since This datatype is available since SDL 3.0.0.
1180 *
1181 * \sa SDL_SetEventFilter
1182 * \sa SDL_AddEventWatch
1183 */
1184typedef int (SDLCALL *SDL_EventFilter)(void *userdata, SDL_Event *event);
1185
1186/**
1187 * Set up a filter to process all events before they change internal state and
1188 * are posted to the internal event queue.
1189 *
1190 * If the filter function returns 1 when called, then the event will be added
1191 * to the internal queue. If it returns 0, then the event will be dropped from
1192 * the queue, but the internal state will still be updated. This allows
1193 * selective filtering of dynamically arriving events.
1194 *
1195 * **WARNING**: Be very careful of what you do in the event filter function,
1196 * as it may run in a different thread!
1197 *
1198 * On platforms that support it, if the quit event is generated by an
1199 * interrupt signal (e.g. pressing Ctrl-C), it will be delivered to the
1200 * application at the next event poll.
1201 *
1202 * There is one caveat when dealing with the ::SDL_QuitEvent event type. The
1203 * event filter is only called when the window manager desires to close the
1204 * application window. If the event filter returns 1, then the window will be
1205 * closed, otherwise the window will remain open if possible.
1206 *
1207 * Note: Disabled events never make it to the event filter function; see
1208 * SDL_SetEventEnabled().
1209 *
1210 * Note: If you just want to inspect events without filtering, you should use
1211 * SDL_AddEventWatch() instead.
1212 *
1213 * Note: Events pushed onto the queue with SDL_PushEvent() get passed through
1214 * the event filter, but events pushed onto the queue with SDL_PeepEvents() do
1215 * not.
1216 *
1217 * \param filter An SDL_EventFilter function to call when an event happens
1218 * \param userdata a pointer that is passed to `filter`
1219 *
1220 * \threadsafety SDL may call the filter callback at any time from any thread;
1221 * the application is responsible for locking resources the
1222 * callback touches that need to be protected.
1223 *
1224 * \since This function is available since SDL 3.0.0.
1225 *
1226 * \sa SDL_AddEventWatch
1227 * \sa SDL_SetEventEnabled
1228 * \sa SDL_GetEventFilter
1229 * \sa SDL_PeepEvents
1230 * \sa SDL_PushEvent
1231 */
1232extern DECLSPEC void SDLCALL SDL_SetEventFilter(SDL_EventFilter filter, void *userdata);
1233
1234/**
1235 * Query the current event filter.
1236 *
1237 * This function can be used to "chain" filters, by saving the existing filter
1238 * before replacing it with a function that will call that saved filter.
1239 *
1240 * \param filter the current callback function will be stored here
1241 * \param userdata the pointer that is passed to the current event filter will
1242 * be stored here
1243 * \returns SDL_TRUE on success or SDL_FALSE if there is no event filter set.
1244 *
1245 * \since This function is available since SDL 3.0.0.
1246 *
1247 * \sa SDL_SetEventFilter
1248 */
1249extern DECLSPEC SDL_bool SDLCALL SDL_GetEventFilter(SDL_EventFilter *filter, void **userdata);
1250
1251/**
1252 * Add a callback to be triggered when an event is added to the event queue.
1253 *
1254 * `filter` will be called when an event happens, and its return value is
1255 * ignored.
1256 *
1257 * **WARNING**: Be very careful of what you do in the event filter function,
1258 * as it may run in a different thread!
1259 *
1260 * If the quit event is generated by a signal (e.g. SIGINT), it will bypass
1261 * the internal queue and be delivered to the watch callback immediately, and
1262 * arrive at the next event poll.
1263 *
1264 * Note: the callback is called for events posted by the user through
1265 * SDL_PushEvent(), but not for disabled events, nor for events by a filter
1266 * callback set with SDL_SetEventFilter(), nor for events posted by the user
1267 * through SDL_PeepEvents().
1268 *
1269 * \param filter an SDL_EventFilter function to call when an event happens.
1270 * \param userdata a pointer that is passed to `filter`
1271 * \returns 0 on success, or a negative error code on failure; call
1272 * SDL_GetError() for more information.
1273 *
1274 * \since This function is available since SDL 3.0.0.
1275 *
1276 * \sa SDL_DelEventWatch
1277 * \sa SDL_SetEventFilter
1278 */
1279extern DECLSPEC int SDLCALL SDL_AddEventWatch(SDL_EventFilter filter, void *userdata);
1280
1281/**
1282 * Remove an event watch callback added with SDL_AddEventWatch().
1283 *
1284 * This function takes the same input as SDL_AddEventWatch() to identify and
1285 * delete the corresponding callback.
1286 *
1287 * \param filter the function originally passed to SDL_AddEventWatch()
1288 * \param userdata the pointer originally passed to SDL_AddEventWatch()
1289 *
1290 * \since This function is available since SDL 3.0.0.
1291 *
1292 * \sa SDL_AddEventWatch
1293 */
1294extern DECLSPEC void SDLCALL SDL_DelEventWatch(SDL_EventFilter filter, void *userdata);
1295
1296/**
1297 * Run a specific filter function on the current event queue, removing any
1298 * events for which the filter returns 0.
1299 *
1300 * See SDL_SetEventFilter() for more information. Unlike SDL_SetEventFilter(),
1301 * this function does not change the filter permanently, it only uses the
1302 * supplied filter until this function returns.
1303 *
1304 * \param filter the SDL_EventFilter function to call when an event happens
1305 * \param userdata a pointer that is passed to `filter`
1306 *
1307 * \since This function is available since SDL 3.0.0.
1308 *
1309 * \sa SDL_GetEventFilter
1310 * \sa SDL_SetEventFilter
1311 */
1312extern DECLSPEC void SDLCALL SDL_FilterEvents(SDL_EventFilter filter, void *userdata);
1313
1314/**
1315 * Set the state of processing events by type.
1316 *
1317 * \param type the type of event; see SDL_EventType for details
1318 * \param enabled whether to process the event or not
1319 *
1320 * \since This function is available since SDL 3.0.0.
1321 *
1322 * \sa SDL_EventEnabled
1323 */
1324extern DECLSPEC void SDLCALL SDL_SetEventEnabled(Uint32 type, SDL_bool enabled);
1325
1326/**
1327 * Query the state of processing events by type.
1328 *
1329 * \param type the type of event; see SDL_EventType for details
1330 * \returns SDL_TRUE if the event is being processed, SDL_FALSE otherwise.
1331 *
1332 * \since This function is available since SDL 3.0.0.
1333 *
1334 * \sa SDL_SetEventEnabled
1335 */
1336extern DECLSPEC SDL_bool SDLCALL SDL_EventEnabled(Uint32 type);
1337
1338/**
1339 * Allocate a set of user-defined events, and return the beginning event
1340 * number for that set of events.
1341 *
1342 * \param numevents the number of events to be allocated
1343 * \returns the beginning event number, or 0 if numevents is invalid or if
1344 * there are not enough user-defined events left.
1345 *
1346 * \since This function is available since SDL 3.0.0.
1347 *
1348 * \sa SDL_PushEvent
1349 */
1350extern DECLSPEC Uint32 SDLCALL SDL_RegisterEvents(int numevents);
1351
1352/**
1353 * Allocate dynamic memory for an SDL event.
1354 *
1355 * You can use this to allocate memory for user events that will be
1356 * automatically freed after the event is processed.
1357 *
1358 * \param size the amount of memory to allocate
1359 * \returns a pointer to the memory allocated or NULL on failure; call
1360 * SDL_GetError() for more information.
1361 *
1362 * \since This function is available since SDL 3.0.0.
1363 */
1364extern DECLSPEC void * SDLCALL SDL_AllocateEventMemory(size_t size);
1365
1366/* Ends C function definitions when using C++ */
1367#ifdef __cplusplus
1368}
1369#endif
1370#include <SDL3/SDL_close_code.h>
1371
1372#endif /* SDL_events_h_ */
Uint32 SDL_AudioDeviceID
Definition SDL_audio.h:239
#define NULL
Uint32 SDL_CameraDeviceID
Definition SDL_camera.h:53
void SDL_DelEventWatch(SDL_EventFilter filter, void *userdata)
int SDL_PeepEvents(SDL_Event *events, int numevents, SDL_EventAction action, Uint32 minType, Uint32 maxType)
void SDL_FilterEvents(SDL_EventFilter filter, void *userdata)
SDL_bool SDL_HasEvent(Uint32 type)
SDL_bool SDL_WaitEvent(SDL_Event *event)
SDL_bool SDL_WaitEventTimeout(SDL_Event *event, Sint32 timeoutMS)
Uint32 SDL_RegisterEvents(int numevents)
SDL_EventType
Definition SDL_events.h:59
@ SDL_EVENT_KEYMAP_CHANGED
Definition SDL_events.h:145
@ SDL_EVENT_DISPLAY_CONTENT_SCALE_CHANGED
Definition SDL_events.h:101
@ SDL_EVENT_WINDOW_HIT_TEST
Definition SDL_events.h:124
@ SDL_EVENT_GAMEPAD_ADDED
Definition SDL_events.h:173
@ SDL_EVENT_GAMEPAD_TOUCHPAD_UP
Definition SDL_events.h:178
@ SDL_EVENT_WINDOW_RESTORED
Definition SDL_events.h:117
@ SDL_EVENT_GAMEPAD_AXIS_MOTION
Definition SDL_events.h:170
@ SDL_EVENT_WINDOW_LAST
Definition SDL_events.h:138
@ SDL_EVENT_DROP_BEGIN
Definition SDL_events.h:196
@ SDL_EVENT_MOUSE_MOTION
Definition SDL_events.h:151
@ SDL_EVENT_WINDOW_FOCUS_GAINED
Definition SDL_events.h:120
@ SDL_EVENT_MOUSE_WHEEL
Definition SDL_events.h:154
@ SDL_EVENT_JOYSTICK_REMOVED
Definition SDL_events.h:165
@ SDL_EVENT_WINDOW_ENTER_FULLSCREEN
Definition SDL_events.h:129
@ SDL_EVENT_PEN_DOWN
Definition SDL_events.h:209
@ SDL_EVENT_CLIPBOARD_UPDATE
Definition SDL_events.h:191
@ SDL_EVENT_DID_ENTER_FOREGROUND
Definition SDL_events.h:86
@ SDL_EVENT_JOYSTICK_BUTTON_UP
Definition SDL_events.h:163
@ SDL_EVENT_JOYSTICK_BATTERY_UPDATED
Definition SDL_events.h:166
@ SDL_EVENT_WILL_ENTER_FOREGROUND
Definition SDL_events.h:82
@ SDL_EVENT_PEN_MOTION
Definition SDL_events.h:211
@ SDL_EVENT_POLL_SENTINEL
Definition SDL_events.h:226
@ SDL_EVENT_CAMERA_DEVICE_REMOVED
Definition SDL_events.h:217
@ SDL_EVENT_JOYSTICK_UPDATE_COMPLETE
Definition SDL_events.h:167
@ SDL_EVENT_FINGER_UP
Definition SDL_events.h:185
@ SDL_EVENT_DISPLAY_REMOVED
Definition SDL_events.h:99
@ SDL_EVENT_JOYSTICK_ADDED
Definition SDL_events.h:164
@ SDL_EVENT_MOUSE_ADDED
Definition SDL_events.h:155
@ SDL_EVENT_DROP_POSITION
Definition SDL_events.h:198
@ SDL_EVENT_WINDOW_EXPOSED
Definition SDL_events.h:111
@ SDL_EVENT_WINDOW_DISPLAY_CHANGED
Definition SDL_events.h:126
@ SDL_EVENT_WINDOW_RESIZED
Definition SDL_events.h:113
@ SDL_EVENT_ENUM_PADDING
Definition SDL_events.h:239
@ SDL_EVENT_GAMEPAD_REMAPPED
Definition SDL_events.h:175
@ SDL_EVENT_GAMEPAD_REMOVED
Definition SDL_events.h:174
@ SDL_EVENT_FINGER_MOTION
Definition SDL_events.h:186
@ SDL_EVENT_WINDOW_MOUSE_ENTER
Definition SDL_events.h:118
@ SDL_EVENT_WINDOW_HIDDEN
Definition SDL_events.h:110
@ SDL_EVENT_RENDER_TARGETS_RESET
Definition SDL_events.h:222
@ SDL_EVENT_MOUSE_REMOVED
Definition SDL_events.h:156
@ SDL_EVENT_DISPLAY_HDR_STATE_CHANGED
Definition SDL_events.h:102
@ SDL_EVENT_DID_ENTER_BACKGROUND
Definition SDL_events.h:78
@ SDL_EVENT_CAMERA_DEVICE_APPROVED
Definition SDL_events.h:218
@ SDL_EVENT_AUDIO_DEVICE_ADDED
Definition SDL_events.h:201
@ SDL_EVENT_RENDER_DEVICE_RESET
Definition SDL_events.h:223
@ SDL_EVENT_LOW_MEMORY
Definition SDL_events.h:70
@ SDL_EVENT_GAMEPAD_UPDATE_COMPLETE
Definition SDL_events.h:180
@ SDL_EVENT_WINDOW_DESTROYED
Definition SDL_events.h:131
@ SDL_EVENT_PEN_UP
Definition SDL_events.h:210
@ SDL_EVENT_GAMEPAD_BUTTON_DOWN
Definition SDL_events.h:171
@ SDL_EVENT_DISPLAY_ADDED
Definition SDL_events.h:98
@ SDL_EVENT_JOYSTICK_AXIS_MOTION
Definition SDL_events.h:159
@ SDL_EVENT_KEY_UP
Definition SDL_events.h:142
@ SDL_EVENT_WINDOW_CLOSE_REQUESTED
Definition SDL_events.h:122
@ SDL_EVENT_TEXT_INPUT
Definition SDL_events.h:144
@ SDL_EVENT_LOCALE_CHANGED
Definition SDL_events.h:91
@ SDL_EVENT_WINDOW_OCCLUDED
Definition SDL_events.h:128
@ SDL_EVENT_DISPLAY_LAST
Definition SDL_events.h:104
@ SDL_EVENT_WILL_ENTER_BACKGROUND
Definition SDL_events.h:74
@ SDL_EVENT_MOUSE_BUTTON_DOWN
Definition SDL_events.h:152
@ SDL_EVENT_USER
Definition SDL_events.h:231
@ SDL_EVENT_WINDOW_FIRST
Definition SDL_events.h:137
@ SDL_EVENT_SENSOR_UPDATE
Definition SDL_events.h:206
@ SDL_EVENT_PEN_BUTTON_DOWN
Definition SDL_events.h:212
@ SDL_EVENT_FIRST
Definition SDL_events.h:60
@ SDL_EVENT_DISPLAY_MOVED
Definition SDL_events.h:100
@ SDL_EVENT_JOYSTICK_BUTTON_DOWN
Definition SDL_events.h:162
@ SDL_EVENT_PEN_BUTTON_UP
Definition SDL_events.h:213
@ SDL_EVENT_MOUSE_BUTTON_UP
Definition SDL_events.h:153
@ SDL_EVENT_DROP_TEXT
Definition SDL_events.h:195
@ SDL_EVENT_DROP_FILE
Definition SDL_events.h:194
@ SDL_EVENT_KEYBOARD_REMOVED
Definition SDL_events.h:148
@ SDL_EVENT_WINDOW_FOCUS_LOST
Definition SDL_events.h:121
@ SDL_EVENT_GAMEPAD_STEAM_HANDLE_UPDATED
Definition SDL_events.h:181
@ SDL_EVENT_GAMEPAD_BUTTON_UP
Definition SDL_events.h:172
@ SDL_EVENT_WINDOW_PEN_ENTER
Definition SDL_events.h:135
@ SDL_EVENT_WINDOW_MAXIMIZED
Definition SDL_events.h:116
@ SDL_EVENT_TERMINATING
Definition SDL_events.h:66
@ SDL_EVENT_WINDOW_PEN_LEAVE
Definition SDL_events.h:136
@ SDL_EVENT_WINDOW_ICCPROF_CHANGED
Definition SDL_events.h:125
@ SDL_EVENT_SYSTEM_THEME_CHANGED
Definition SDL_events.h:93
@ SDL_EVENT_WINDOW_LEAVE_FULLSCREEN
Definition SDL_events.h:130
@ SDL_EVENT_CAMERA_DEVICE_ADDED
Definition SDL_events.h:216
@ SDL_EVENT_KEYBOARD_ADDED
Definition SDL_events.h:147
@ SDL_EVENT_GAMEPAD_SENSOR_UPDATE
Definition SDL_events.h:179
@ SDL_EVENT_JOYSTICK_HAT_MOTION
Definition SDL_events.h:161
@ SDL_EVENT_AUDIO_DEVICE_FORMAT_CHANGED
Definition SDL_events.h:203
@ SDL_EVENT_JOYSTICK_BALL_MOTION
Definition SDL_events.h:160
@ SDL_EVENT_WINDOW_TAKE_FOCUS
Definition SDL_events.h:123
@ SDL_EVENT_WINDOW_SHOWN
Definition SDL_events.h:109
@ SDL_EVENT_KEY_DOWN
Definition SDL_events.h:141
@ SDL_EVENT_CAMERA_DEVICE_DENIED
Definition SDL_events.h:219
@ SDL_EVENT_WINDOW_MOVED
Definition SDL_events.h:112
@ SDL_EVENT_DISPLAY_FIRST
Definition SDL_events.h:103
@ SDL_EVENT_WINDOW_MINIMIZED
Definition SDL_events.h:115
@ SDL_EVENT_WINDOW_PIXEL_SIZE_CHANGED
Definition SDL_events.h:114
@ SDL_EVENT_DISPLAY_ORIENTATION
Definition SDL_events.h:97
@ SDL_EVENT_WINDOW_DISPLAY_SCALE_CHANGED
Definition SDL_events.h:127
@ SDL_EVENT_GAMEPAD_TOUCHPAD_MOTION
Definition SDL_events.h:177
@ SDL_EVENT_LAST
Definition SDL_events.h:236
@ SDL_EVENT_AUDIO_DEVICE_REMOVED
Definition SDL_events.h:202
@ SDL_EVENT_DROP_COMPLETE
Definition SDL_events.h:197
@ SDL_EVENT_GAMEPAD_TOUCHPAD_DOWN
Definition SDL_events.h:176
@ SDL_EVENT_TEXT_EDITING
Definition SDL_events.h:143
@ SDL_EVENT_WINDOW_MOUSE_LEAVE
Definition SDL_events.h:119
@ SDL_EVENT_QUIT
Definition SDL_events.h:63
@ SDL_EVENT_FINGER_DOWN
Definition SDL_events.h:184
SDL_bool SDL_PollEvent(SDL_Event *event)
int(* SDL_EventFilter)(void *userdata, SDL_Event *event)
void SDL_SetEventFilter(SDL_EventFilter filter, void *userdata)
SDL_bool SDL_GetEventFilter(SDL_EventFilter *filter, void **userdata)
SDL_bool SDL_EventEnabled(Uint32 type)
void SDL_FlushEvents(Uint32 minType, Uint32 maxType)
SDL_EventAction
Definition SDL_events.h:904
@ SDL_ADDEVENT
Definition SDL_events.h:905
@ SDL_PEEKEVENT
Definition SDL_events.h:906
@ SDL_GETEVENT
Definition SDL_events.h:907
void SDL_FlushEvent(Uint32 type)
int SDL_AddEventWatch(SDL_EventFilter filter, void *userdata)
int SDL_PushEvent(SDL_Event *event)
SDL_bool SDL_HasEvents(Uint32 minType, Uint32 maxType)
void SDL_SetEventEnabled(Uint32 type, SDL_bool enabled)
void * SDL_AllocateEventMemory(size_t size)
void SDL_PumpEvents(void)
Uint32 SDL_JoystickID
Uint32 SDL_KeyboardID
Uint32 SDL_MouseID
Definition SDL_mouse.h:41
SDL_MouseWheelDirection
Definition SDL_mouse.h:81
Uint32 SDL_PenID
Definition SDL_pen.h:58
@ SDL_PEN_NUM_AXES
Definition SDL_pen.h:93
SDL_PowerState
Definition SDL_power.h:48
Uint32 SDL_SensorID
Definition SDL_sensor.h:63
uint8_t Uint8
Definition SDL_stdinc.h:188
uint16_t Uint16
Definition SDL_stdinc.h:206
int32_t Sint32
Definition SDL_stdinc.h:215
SDL_MALLOC size_t size
Definition SDL_stdinc.h:469
int SDL_bool
Definition SDL_stdinc.h:170
int16_t Sint16
Definition SDL_stdinc.h:197
#define SDL_COMPILE_TIME_ASSERT(name, x)
Definition SDL_stdinc.h:417
uint64_t Uint64
Definition SDL_stdinc.h:242
uint32_t Uint32
Definition SDL_stdinc.h:224
Uint64 SDL_TouchID
Definition SDL_touch.h:42
Uint64 SDL_FingerID
Definition SDL_touch.h:43
Uint32 SDL_DisplayID
Definition SDL_video.h:45
Uint32 SDL_WindowID
Definition SDL_video.h:46
SDL_AudioDeviceID which
Definition SDL_events.h:626
SDL_EventType type
Definition SDL_events.h:623
SDL_EventType type
Definition SDL_events.h:640
SDL_CameraDeviceID which
Definition SDL_events.h:643
SDL_EventType type
Definition SDL_events.h:759
SDL_DisplayID displayID
Definition SDL_events.h:265
SDL_EventType type
Definition SDL_events.h:262
SDL_EventType type
Definition SDL_events.h:741
SDL_WindowID windowID
Definition SDL_events.h:744
Uint64 timestamp
Definition SDL_events.h:743
Uint32 reserved
Definition SDL_events.h:742
SDL_JoystickID which
Definition SDL_events.h:541
SDL_EventType type
Definition SDL_events.h:538
SDL_JoystickID which
Definition SDL_events.h:561
SDL_JoystickID which
Definition SDL_events.h:579
SDL_JoystickID which
Definition SDL_events.h:610
SDL_EventType type
Definition SDL_events.h:432
SDL_JoystickID which
Definition SDL_events.h:435
SDL_EventType type
Definition SDL_events.h:451
SDL_JoystickID which
Definition SDL_events.h:454
SDL_JoystickID which
Definition SDL_events.h:526
SDL_PowerState state
Definition SDL_events.h:527
SDL_EventType type
Definition SDL_events.h:523
SDL_JoystickID which
Definition SDL_events.h:496
SDL_EventType type
Definition SDL_events.h:493
SDL_EventType type
Definition SDL_events.h:510
SDL_JoystickID which
Definition SDL_events.h:513
SDL_JoystickID which
Definition SDL_events.h:473
SDL_EventType type
Definition SDL_events.h:470
SDL_KeyboardID which
Definition SDL_events.h:294
SDL_Keysym keysym
Definition SDL_events.h:313
SDL_EventType type
Definition SDL_events.h:304
SDL_KeyboardID which
Definition SDL_events.h:308
SDL_WindowID windowID
Definition SDL_events.h:307
SDL_WindowID windowID
Definition SDL_events.h:396
SDL_EventType type
Definition SDL_events.h:393
SDL_EventType type
Definition SDL_events.h:361
SDL_WindowID windowID
Definition SDL_events.h:377
SDL_EventType type
Definition SDL_events.h:374
SDL_MouseWheelDirection direction
Definition SDL_events.h:420
SDL_EventType type
Definition SDL_events.h:413
SDL_MouseID which
Definition SDL_events.h:417
SDL_WindowID windowID
Definition SDL_events.h:416
float axes[SDL_PEN_NUM_AXES]
Definition SDL_events.h:727
SDL_WindowID windowID
Definition SDL_events.h:720
SDL_EventType type
Definition SDL_events.h:717
float axes[SDL_PEN_NUM_AXES]
Definition SDL_events.h:707
SDL_WindowID windowID
Definition SDL_events.h:700
SDL_EventType type
Definition SDL_events.h:697
SDL_WindowID windowID
Definition SDL_events.h:679
SDL_PenID which
Definition SDL_events.h:680
SDL_EventType type
Definition SDL_events.h:676
float axes[SDL_PEN_NUM_AXES]
Definition SDL_events.h:686
SDL_EventType type
Definition SDL_events.h:786
Uint32 reserved
Definition SDL_events.h:787
Uint64 timestamp
Definition SDL_events.h:788
Uint64 sensor_timestamp
Definition SDL_events.h:776
SDL_EventType type
Definition SDL_events.h:771
SDL_SensorID which
Definition SDL_events.h:774
SDL_EventType type
Definition SDL_events.h:328
SDL_WindowID windowID
Definition SDL_events.h:331
SDL_WindowID windowID
Definition SDL_events.h:350
SDL_EventType type
Definition SDL_events.h:347
SDL_FingerID fingerID
Definition SDL_events.h:657
SDL_TouchID touchID
Definition SDL_events.h:656
SDL_EventType type
Definition SDL_events.h:653
SDL_WindowID windowID
Definition SDL_events.h:663
Uint32 reserved
Definition SDL_events.h:805
SDL_WindowID windowID
Definition SDL_events.h:807
Uint64 timestamp
Definition SDL_events.h:806
SDL_EventType type
Definition SDL_events.h:276
SDL_WindowID windowID
Definition SDL_events.h:279
SDL_PenTipEvent ptip
Definition SDL_events.h:850
SDL_QuitEvent quit
Definition SDL_events.h:847
SDL_AudioDeviceEvent adevice
Definition SDL_events.h:844
Uint8 padding[128]
Definition SDL_events.h:869
SDL_JoyDeviceEvent jdevice
Definition SDL_events.h:833
Uint32 type
Definition SDL_events.h:821
SDL_MouseWheelEvent wheel
Definition SDL_events.h:832
SDL_PenMotionEvent pmotion
Definition SDL_events.h:851
SDL_JoyHatEvent jhat
Definition SDL_events.h:836
SDL_ClipboardEvent clipboard
Definition SDL_events.h:854
SDL_JoyButtonEvent jbutton
Definition SDL_events.h:837
SDL_GamepadDeviceEvent gdevice
Definition SDL_events.h:839
SDL_GamepadAxisEvent gaxis
Definition SDL_events.h:840
SDL_WindowEvent window
Definition SDL_events.h:824
SDL_CameraDeviceEvent cdevice
Definition SDL_events.h:845
SDL_GamepadTouchpadEvent gtouchpad
Definition SDL_events.h:842
SDL_KeyboardDeviceEvent kdevice
Definition SDL_events.h:825
SDL_TextEditingEvent edit
Definition SDL_events.h:827
SDL_TextInputEvent text
Definition SDL_events.h:828
SDL_PenButtonEvent pbutton
Definition SDL_events.h:852
SDL_GamepadSensorEvent gsensor
Definition SDL_events.h:843
SDL_TouchFingerEvent tfinger
Definition SDL_events.h:849
SDL_MouseButtonEvent button
Definition SDL_events.h:831
SDL_UserEvent user
Definition SDL_events.h:848
SDL_KeyboardEvent key
Definition SDL_events.h:826
SDL_CommonEvent common
Definition SDL_events.h:822
SDL_MouseMotionEvent motion
Definition SDL_events.h:830
SDL_JoyAxisEvent jaxis
Definition SDL_events.h:834
SDL_MouseDeviceEvent mdevice
Definition SDL_events.h:829
SDL_DropEvent drop
Definition SDL_events.h:853
SDL_JoyBallEvent jball
Definition SDL_events.h:835
SDL_JoyBatteryEvent jbattery
Definition SDL_events.h:838
SDL_SensorEvent sensor
Definition SDL_events.h:846
SDL_GamepadButtonEvent gbutton
Definition SDL_events.h:841
SDL_DisplayEvent display
Definition SDL_events.h:823