Rev 1 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1 | Rev 8 | ||
---|---|---|---|
Line 1... | Line 1... | ||
1 | /* |
1 | /* |
2 | Simple DirectMedia Layer |
2 | Simple DirectMedia Layer |
3 | Copyright (C) 1997- |
3 | Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org> |
4 | 4 | ||
5 | This software is provided 'as-is', without any express or implied |
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 |
6 | warranty. In no event will the authors be held liable for any damages |
7 | arising from the use of this software. |
7 | arising from the use of this software. |
8 | 8 | ||
Line 82... | Line 82... | ||
82 | */ |
82 | */ |
83 | SDL_APP_DIDENTERFOREGROUND, /**< The application is now interactive |
83 | SDL_APP_DIDENTERFOREGROUND, /**< The application is now interactive |
84 | Called on iOS in applicationDidBecomeActive() |
84 | Called on iOS in applicationDidBecomeActive() |
85 | Called on Android in onResume() |
85 | Called on Android in onResume() |
86 | */ |
86 | */ |
- | 87 | ||
- | 88 | /* Display events */ |
|
- | 89 | SDL_DISPLAYEVENT = 0x150, /**< Display state change */ |
|
87 | 90 | ||
88 | /* Window events */ |
91 | /* Window events */ |
89 | SDL_WINDOWEVENT = 0x200, /**< Window state change */ |
92 | SDL_WINDOWEVENT = 0x200, /**< Window state change */ |
90 | SDL_SYSWMEVENT, /**< System specific event */ |
93 | SDL_SYSWMEVENT, /**< System specific event */ |
91 | 94 | ||
Line 95... | Line 98... | ||
95 | SDL_TEXTEDITING, /**< Keyboard text editing (composition) */ |
98 | SDL_TEXTEDITING, /**< Keyboard text editing (composition) */ |
96 | SDL_TEXTINPUT, /**< Keyboard text input */ |
99 | SDL_TEXTINPUT, /**< Keyboard text input */ |
97 | SDL_KEYMAPCHANGED, /**< Keymap changed due to a system event such as an |
100 | SDL_KEYMAPCHANGED, /**< Keymap changed due to a system event such as an |
98 | input language or keyboard layout change. |
101 | input language or keyboard layout change. |
99 | */ |
102 | */ |
100 | 103 | ||
101 | /* Mouse events */ |
104 | /* Mouse events */ |
102 | SDL_MOUSEMOTION = 0x400, /**< Mouse moved */ |
105 | SDL_MOUSEMOTION = 0x400, /**< Mouse moved */ |
103 | SDL_MOUSEBUTTONDOWN, /**< Mouse button pressed */ |
106 | SDL_MOUSEBUTTONDOWN, /**< Mouse button pressed */ |
104 | SDL_MOUSEBUTTONUP, /**< Mouse button released */ |
107 | SDL_MOUSEBUTTONUP, /**< Mouse button released */ |
105 | SDL_MOUSEWHEEL, /**< Mouse wheel motion */ |
108 | SDL_MOUSEWHEEL, /**< Mouse wheel motion */ |
106 | 109 | ||
107 | /* Joystick events */ |
110 | /* Joystick events */ |
108 | SDL_JOYAXISMOTION = 0x600, /**< Joystick axis motion */ |
111 | SDL_JOYAXISMOTION = 0x600, /**< Joystick axis motion */ |
109 | SDL_JOYBALLMOTION, /**< Joystick trackball motion */ |
112 | SDL_JOYBALLMOTION, /**< Joystick trackball motion */ |
110 | SDL_JOYHATMOTION, /**< Joystick hat position change */ |
113 | SDL_JOYHATMOTION, /**< Joystick hat position change */ |
111 | SDL_JOYBUTTONDOWN, /**< Joystick button pressed */ |
114 | SDL_JOYBUTTONDOWN, /**< Joystick button pressed */ |
Line 131... | Line 134... | ||
131 | SDL_DOLLARRECORD, |
134 | SDL_DOLLARRECORD, |
132 | SDL_MULTIGESTURE, |
135 | SDL_MULTIGESTURE, |
133 | 136 | ||
134 | /* Clipboard events */ |
137 | /* Clipboard events */ |
135 | SDL_CLIPBOARDUPDATE = 0x900, /**< The clipboard changed */ |
138 | SDL_CLIPBOARDUPDATE = 0x900, /**< The clipboard changed */ |
136 | 139 | ||
137 | /* Drag and drop events */ |
140 | /* Drag and drop events */ |
138 | SDL_DROPFILE = 0x1000, /**< The system requests a file open */ |
141 | SDL_DROPFILE = 0x1000, /**< The system requests a file open */ |
139 | SDL_DROPTEXT, /**< text/plain drag-and-drop event */ |
142 | SDL_DROPTEXT, /**< text/plain drag-and-drop event */ |
140 | SDL_DROPBEGIN, /**< A new set of drops is beginning (NULL filename) */ |
143 | SDL_DROPBEGIN, /**< A new set of drops is beginning (NULL filename) */ |
141 | SDL_DROPCOMPLETE, /**< Current set of drops is now complete (NULL filename) */ |
144 | SDL_DROPCOMPLETE, /**< Current set of drops is now complete (NULL filename) */ |
142 | 145 | ||
143 | /* Audio hotplug events */ |
146 | /* Audio hotplug events */ |
144 | SDL_AUDIODEVICEADDED = 0x1100, /**< A new audio device is available */ |
147 | SDL_AUDIODEVICEADDED = 0x1100, /**< A new audio device is available */ |
145 | SDL_AUDIODEVICEREMOVED, /**< An audio device has been removed. */ |
148 | SDL_AUDIODEVICEREMOVED, /**< An audio device has been removed. */ |
- | 149 | ||
- | 150 | /* Sensor events */ |
|
- | 151 | SDL_SENSORUPDATE = 0x1200, /**< A sensor was updated */ |
|
146 | 152 | ||
147 | /* Render events */ |
153 | /* Render events */ |
148 | SDL_RENDER_TARGETS_RESET = 0x2000, /**< The render targets have been reset and their contents need to be updated */ |
154 | SDL_RENDER_TARGETS_RESET = 0x2000, /**< The render targets have been reset and their contents need to be updated */ |
149 | SDL_RENDER_DEVICE_RESET, /**< The device has been reset and all textures need to be recreated */ |
155 | SDL_RENDER_DEVICE_RESET, /**< The device has been reset and all textures need to be recreated */ |
150 | 156 | ||
151 | /** Events ::SDL_USEREVENT through ::SDL_LASTEVENT are for your use, |
157 | /** Events ::SDL_USEREVENT through ::SDL_LASTEVENT are for your use, |
152 | * and should be allocated with SDL_RegisterEvents() |
158 | * and should be allocated with SDL_RegisterEvents() |
153 | */ |
159 | */ |
154 | SDL_USEREVENT = 0x8000, |
160 | SDL_USEREVENT = 0x8000, |
155 | 161 | ||
156 | /** |
162 | /** |
157 | * This last event is only for bounding internal arrays |
163 | * This last event is only for bounding internal arrays |
158 | */ |
164 | */ |
159 | SDL_LASTEVENT = 0xFFFF |
165 | SDL_LASTEVENT = 0xFFFF |
160 | } SDL_EventType; |
166 | } SDL_EventType; |
161 | 167 | ||
162 | /** |
168 | /** |
163 | * \brief Fields shared by every event |
169 | * \brief Fields shared by every event |
- | 170 | */ |
|
- | 171 | typedef struct SDL_CommonEvent |
|
- | 172 | { |
|
- | 173 | Uint32 type; |
|
- | 174 | Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ |
|
- | 175 | } SDL_CommonEvent; |
|
- | 176 | ||
- | 177 | /** |
|
- | 178 | * \brief Display state change event data (event.display.*) |
|
164 | */ |
179 | */ |
165 | typedef struct |
180 | typedef struct SDL_DisplayEvent |
166 | { |
181 | { |
167 | Uint32 type; |
182 | Uint32 type; /**< ::SDL_DISPLAYEVENT */ |
168 | Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ |
183 | Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ |
- | 184 | Uint32 display; /**< The associated display index */ |
|
- | 185 | Uint8 event; /**< ::SDL_DisplayEventID */ |
|
- | 186 | Uint8 padding1; |
|
- | 187 | Uint8 padding2; |
|
- | 188 | Uint8 padding3; |
|
- | 189 | Sint32 data1; /**< event dependent data */ |
|
169 | } |
190 | } SDL_DisplayEvent; |
170 | 191 | ||
171 | /** |
192 | /** |
172 | * \brief Window state change event data (event.window.*) |
193 | * \brief Window state change event data (event.window.*) |
173 | */ |
194 | */ |
174 | typedef struct SDL_WindowEvent |
195 | typedef struct SDL_WindowEvent |
Line 275... | Line 296... | ||
275 | 296 | ||
276 | /** |
297 | /** |
277 | * \brief Joystick axis motion event structure (event.jaxis.*) |
298 | * \brief Joystick axis motion event structure (event.jaxis.*) |
278 | */ |
299 | */ |
279 | typedef struct SDL_JoyAxisEvent |
300 | typedef struct SDL_JoyAxisEvent |
280 | { |
301 | { |
281 | Uint32 type; /**< ::SDL_JOYAXISMOTION */ |
302 | Uint32 type; /**< ::SDL_JOYAXISMOTION */ |
282 | Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ |
303 | Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ |
283 | SDL_JoystickID which; /**< The joystick instance id */ |
304 | SDL_JoystickID which; /**< The joystick instance id */ |
284 | Uint8 axis; /**< The joystick axis index */ |
305 | Uint8 axis; /**< The joystick axis index */ |
285 | Uint8 padding1; |
306 | Uint8 padding1; |
286 | Uint8 padding2; |
307 | Uint8 padding2; |
287 | Uint8 padding3; |
308 | Uint8 padding3; |
288 | Sint16 value; /**< The axis value (range: -32768 to 32767) */ |
309 | Sint16 value; /**< The axis value (range: -32768 to 32767) */ |
289 | Uint16 padding4; |
310 | Uint16 padding4; |
290 | } SDL_JoyAxisEvent; |
311 | } SDL_JoyAxisEvent; |
291 | 312 | ||
292 | /** |
313 | /** |
293 | * \brief Joystick trackball motion event structure (event.jball.*) |
314 | * \brief Joystick trackball motion event structure (event.jball.*) |
294 | */ |
315 | */ |
295 | typedef struct SDL_JoyBallEvent |
316 | typedef struct SDL_JoyBallEvent |
296 | { |
317 | { |
Line 322... | Line 343... | ||
322 | * Note that zero means the POV is centered. |
343 | * Note that zero means the POV is centered. |
323 | */ |
344 | */ |
324 | Uint8 padding1; |
345 | Uint8 padding1; |
325 | Uint8 padding2; |
346 | Uint8 padding2; |
326 | } SDL_JoyHatEvent; |
347 | } SDL_JoyHatEvent; |
327 | 348 | ||
328 | /** |
349 | /** |
329 | * \brief Joystick button event structure (event.jbutton.*) |
350 | * \brief Joystick button event structure (event.jbutton.*) |
330 | */ |
351 | */ |
331 | typedef struct SDL_JoyButtonEvent |
352 | typedef struct SDL_JoyButtonEvent |
332 | { |
353 | { |
333 | Uint32 type; /**< ::SDL_JOYBUTTONDOWN or ::SDL_JOYBUTTONUP */ |
354 | Uint32 type; /**< ::SDL_JOYBUTTONDOWN or ::SDL_JOYBUTTONUP */ |
334 | Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ |
355 | Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ |
335 | SDL_JoystickID which; /**< The joystick instance id */ |
356 | SDL_JoystickID which; /**< The joystick instance id */ |
336 | Uint8 button; /**< The joystick button index */ |
357 | Uint8 button; /**< The joystick button index */ |
337 | Uint8 state; /**< ::SDL_PRESSED or ::SDL_RELEASED */ |
358 | Uint8 state; /**< ::SDL_PRESSED or ::SDL_RELEASED */ |
338 | Uint8 padding1; |
359 | Uint8 padding1; |
339 | Uint8 padding2; |
360 | Uint8 padding2; |
Line 341... | Line 362... | ||
341 | 362 | ||
342 | /** |
363 | /** |
343 | * \brief Joystick device event structure (event.jdevice.*) |
364 | * \brief Joystick device event structure (event.jdevice.*) |
344 | */ |
365 | */ |
345 | typedef struct SDL_JoyDeviceEvent |
366 | typedef struct SDL_JoyDeviceEvent |
346 | { |
367 | { |
347 | Uint32 type; /**< ::SDL_JOYDEVICEADDED or ::SDL_JOYDEVICEREMOVED */ |
368 | Uint32 type; /**< ::SDL_JOYDEVICEADDED or ::SDL_JOYDEVICEREMOVED */ |
348 | Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ |
369 | Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ |
349 | Sint32 which; /**< The joystick device index for the ADDED event, instance id for the REMOVED event */ |
370 | Sint32 which; /**< The joystick device index for the ADDED event, instance id for the REMOVED event */ |
350 | } SDL_JoyDeviceEvent; |
371 | } SDL_JoyDeviceEvent; |
351 | 372 | ||
352 | 373 | ||
353 | /** |
374 | /** |
354 | * \brief Game controller axis motion event structure (event.caxis.*) |
375 | * \brief Game controller axis motion event structure (event.caxis.*) |
355 | */ |
376 | */ |
356 | typedef struct SDL_ControllerAxisEvent |
377 | typedef struct SDL_ControllerAxisEvent |
357 | { |
378 | { |
Line 371... | Line 392... | ||
371 | * \brief Game controller button event structure (event.cbutton.*) |
392 | * \brief Game controller button event structure (event.cbutton.*) |
372 | */ |
393 | */ |
373 | typedef struct SDL_ControllerButtonEvent |
394 | typedef struct SDL_ControllerButtonEvent |
374 | { |
395 | { |
375 | Uint32 type; /**< ::SDL_CONTROLLERBUTTONDOWN or ::SDL_CONTROLLERBUTTONUP */ |
396 | Uint32 type; /**< ::SDL_CONTROLLERBUTTONDOWN or ::SDL_CONTROLLERBUTTONUP */ |
376 | Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ |
397 | Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ |
377 | SDL_JoystickID which; /**< The joystick instance id */ |
398 | SDL_JoystickID which; /**< The joystick instance id */ |
378 | Uint8 button; /**< The controller button (SDL_GameControllerButton) */ |
399 | Uint8 button; /**< The controller button (SDL_GameControllerButton) */ |
379 | Uint8 state; /**< ::SDL_PRESSED or ::SDL_RELEASED */ |
400 | Uint8 state; /**< ::SDL_PRESSED or ::SDL_RELEASED */ |
380 | Uint8 padding1; |
401 | Uint8 padding1; |
381 | Uint8 padding2; |
402 | Uint8 padding2; |
Line 468... | Line 489... | ||
468 | Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ |
489 | Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ |
469 | char *file; /**< The file name, which should be freed with SDL_free(), is NULL on begin/complete */ |
490 | char *file; /**< The file name, which should be freed with SDL_free(), is NULL on begin/complete */ |
470 | Uint32 windowID; /**< The window that was dropped on, if any */ |
491 | Uint32 windowID; /**< The window that was dropped on, if any */ |
471 | } SDL_DropEvent; |
492 | } SDL_DropEvent; |
472 | 493 | ||
- | 494 | ||
- | 495 | /** |
|
- | 496 | * \brief Sensor event structure (event.sensor.*) |
|
- | 497 | */ |
|
- | 498 | typedef struct SDL_SensorEvent |
|
- | 499 | { |
|
- | 500 | Uint32 type; /**< ::SDL_SENSORUPDATE */ |
|
- | 501 | Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ |
|
- | 502 | Sint32 which; /**< The instance ID of the sensor */ |
|
- | 503 | float data[6]; /**< Up to 6 values from the sensor - additional values can be queried using SDL_SensorGetData() */ |
|
- | 504 | } SDL_SensorEvent; |
|
473 | 505 | ||
474 | /** |
506 | /** |
475 | * \brief The "quit requested" event |
507 | * \brief The "quit requested" event |
476 | */ |
508 | */ |
477 | typedef struct SDL_QuitEvent |
509 | typedef struct SDL_QuitEvent |
Line 524... | Line 556... | ||
524 | */ |
556 | */ |
525 | typedef union SDL_Event |
557 | typedef union SDL_Event |
526 | { |
558 | { |
527 | Uint32 type; /**< Event type, shared with all events */ |
559 | Uint32 type; /**< Event type, shared with all events */ |
528 | SDL_CommonEvent common; /**< Common event data */ |
560 | SDL_CommonEvent common; /**< Common event data */ |
- | 561 | SDL_DisplayEvent display; /**< Window event data */ |
|
529 | SDL_WindowEvent window; /**< Window event data */ |
562 | SDL_WindowEvent window; /**< Window event data */ |
530 | SDL_KeyboardEvent key; /**< Keyboard event data */ |
563 | SDL_KeyboardEvent key; /**< Keyboard event data */ |
531 | SDL_TextEditingEvent edit; /**< Text editing event data */ |
564 | SDL_TextEditingEvent edit; /**< Text editing event data */ |
532 | SDL_TextInputEvent text; /**< Text input event data */ |
565 | SDL_TextInputEvent text; /**< Text input event data */ |
533 | SDL_MouseMotionEvent motion; /**< Mouse motion event data */ |
566 | SDL_MouseMotionEvent motion; /**< Mouse motion event data */ |
Line 540... | Line 573... | ||
540 | SDL_JoyDeviceEvent jdevice; /**< Joystick device change event data */ |
573 | SDL_JoyDeviceEvent jdevice; /**< Joystick device change event data */ |
541 | SDL_ControllerAxisEvent caxis; /**< Game Controller axis event data */ |
574 | SDL_ControllerAxisEvent caxis; /**< Game Controller axis event data */ |
542 | SDL_ControllerButtonEvent cbutton; /**< Game Controller button event data */ |
575 | SDL_ControllerButtonEvent cbutton; /**< Game Controller button event data */ |
543 | SDL_ControllerDeviceEvent cdevice; /**< Game Controller device event data */ |
576 | SDL_ControllerDeviceEvent cdevice; /**< Game Controller device event data */ |
544 | SDL_AudioDeviceEvent adevice; /**< Audio device event data */ |
577 | SDL_AudioDeviceEvent adevice; /**< Audio device event data */ |
- | 578 | SDL_SensorEvent sensor; /**< Sensor event data */ |
|
545 | SDL_QuitEvent quit; /**< Quit request event data */ |
579 | SDL_QuitEvent quit; /**< Quit request event data */ |
546 | SDL_UserEvent user; /**< Custom event data */ |
580 | SDL_UserEvent user; /**< Custom event data */ |
547 | SDL_SysWMEvent syswm; /**< System dependent window event data */ |
581 | SDL_SysWMEvent syswm; /**< System dependent window event data */ |
548 | SDL_TouchFingerEvent tfinger; /**< Touch finger event data */ |
582 | SDL_TouchFingerEvent tfinger; /**< Touch finger event data */ |
549 | SDL_MultiGestureEvent mgesture; /**< Gesture event data */ |
583 | SDL_MultiGestureEvent mgesture; /**< Gesture event data */ |