zenilib  0.5.3.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
SDL_events.h
Go to the documentation of this file.
1 /*
2  Simple DirectMedia Layer
3  Copyright (C) 1997-2013 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 
28 #ifndef _SDL_events_h
29 #define _SDL_events_h
30 
31 #include "SDL_stdinc.h"
32 #include "SDL_error.h"
33 #include "SDL_video.h"
34 #include "SDL_keyboard.h"
35 #include "SDL_mouse.h"
36 #include "SDL_joystick.h"
37 #include "SDL_gamecontroller.h"
38 #include "SDL_quit.h"
39 #include "SDL_gesture.h"
40 #include "SDL_touch.h"
41 
42 #include "begin_code.h"
43 /* Set up for C function definitions, even when using C++ */
44 #ifdef __cplusplus
45 extern "C" {
46 #endif
47 
48 /* General keyboard/mouse state definitions */
49 #define SDL_RELEASED 0
50 #define SDL_PRESSED 1
51 
55 typedef enum
56 {
59  /* Application events */
60  SDL_QUIT = 0x100,
62  /* These application events have special meaning on iOS, see README-ios.txt for details */
88  /* Window events */
89  SDL_WINDOWEVENT = 0x200,
92  /* Keyboard events */
93  SDL_KEYDOWN = 0x300,
98  /* Mouse events */
99  SDL_MOUSEMOTION = 0x400,
104  /* Joystick events */
113  /* Game controller events */
121  /* Touch events */
122  SDL_FINGERDOWN = 0x700,
125 
126  /* Gesture events */
130 
131  /* Clipboard events */
134  /* Drag and drop events */
135  SDL_DROPFILE = 0x1000,
140  SDL_USEREVENT = 0x8000,
141 
145  SDL_LASTEVENT = 0xFFFF
146 } SDL_EventType;
147 
151 typedef struct SDL_CommonEvent
152 {
156 
160 typedef struct SDL_WindowEvent
161 {
172 
176 typedef struct SDL_KeyboardEvent
177 {
187 
188 #define SDL_TEXTEDITINGEVENT_TEXT_SIZE (32)
189 
192 typedef struct SDL_TextEditingEvent
193 {
201 
202 
203 #define SDL_TEXTINPUTEVENT_TEXT_SIZE (32)
204 
207 typedef struct SDL_TextInputEvent
208 {
214 
218 typedef struct SDL_MouseMotionEvent
219 {
230 
234 typedef struct SDL_MouseButtonEvent
235 {
247 
251 typedef struct SDL_MouseWheelEvent
252 {
260 
264 typedef struct SDL_JoyAxisEvent
265 {
276 
280 typedef struct SDL_JoyBallEvent
281 {
292 
296 typedef struct SDL_JoyHatEvent
297 {
312 
316 typedef struct SDL_JoyButtonEvent
317 {
326 
330 typedef struct SDL_JoyDeviceEvent
331 {
336 
337 
342 {
353 
354 
359 {
368 
369 
374 {
379 
380 
384 typedef struct SDL_TouchFingerEvent
385 {
390  float x;
391  float y;
392  float dx;
393  float dy;
394  float pressure;
396 
397 
401 typedef struct SDL_MultiGestureEvent
402 {
406  float dTheta;
407  float dDist;
408  float x;
409  float y;
413 
414 
419 {
425  float error;
426  float x;
427  float y;
429 
430 
436 typedef struct SDL_DropEvent
437 {
440  char *file;
441 } SDL_DropEvent;
442 
443 
447 typedef struct SDL_QuitEvent
448 {
451 } SDL_QuitEvent;
452 
456 typedef struct SDL_OSEvent
457 {
460 } SDL_OSEvent;
461 
465 typedef struct SDL_UserEvent
466 {
471  void *data1;
472  void *data2;
473 } SDL_UserEvent;
474 
475 
476 struct SDL_SysWMmsg;
477 typedef struct SDL_SysWMmsg SDL_SysWMmsg;
478 
485 typedef struct SDL_SysWMEvent
486 {
491 
495 typedef union SDL_Event
496 {
522  /* This is necessary for ABI compatibility between Visual C++ and GCC
523  Visual C++ will respect the push pack pragma and use 52 bytes for
524  this structure, and GCC will use the alignment of the largest datatype
525  within the union, which is 8 bytes.
526 
527  So... we'll add padding to force the size to be 56 bytes for both.
528  */
530 } SDL_Event;
531 
532 
533 /* Function prototypes */
534 
542 extern DECLSPEC void SDLCALL SDL_PumpEvents(void);
543 
544 /* @{ */
545 typedef enum
546 {
551 
570 extern DECLSPEC int SDLCALL SDL_PeepEvents(SDL_Event * events, int numevents,
571  SDL_eventaction action,
572  Uint32 minType, Uint32 maxType);
573 /* @} */
574 
579 extern DECLSPEC SDL_bool SDLCALL SDL_HasEvents(Uint32 minType, Uint32 maxType);
580 
585 extern DECLSPEC void SDLCALL SDL_FlushEvents(Uint32 minType, Uint32 maxType);
586 
596 
606 
618  int timeout);
619 
627 
628 typedef int (SDLCALL * SDL_EventFilter) (void *userdata, SDL_Event * event);
629 
655 extern DECLSPEC void SDLCALL SDL_SetEventFilter(SDL_EventFilter filter,
656  void *userdata);
657 
662 extern DECLSPEC SDL_bool SDLCALL SDL_GetEventFilter(SDL_EventFilter * filter,
663  void **userdata);
664 
668 extern DECLSPEC void SDLCALL SDL_AddEventWatch(SDL_EventFilter filter,
669  void *userdata);
670 
674 extern DECLSPEC void SDLCALL SDL_DelEventWatch(SDL_EventFilter filter,
675  void *userdata);
676 
681 extern DECLSPEC void SDLCALL SDL_FilterEvents(SDL_EventFilter filter,
682  void *userdata);
683 
684 /* @{ */
685 #define SDL_QUERY -1
686 #define SDL_IGNORE 0
687 #define SDL_DISABLE 0
688 #define SDL_ENABLE 1
689 
699 extern DECLSPEC Uint8 SDLCALL SDL_EventState(Uint32 type, int state);
700 /* @} */
701 #define SDL_GetEventState(type) SDL_EventState(type, SDL_QUERY)
702 
710 extern DECLSPEC Uint32 SDLCALL SDL_RegisterEvents(int numevents);
711 
712 /* Ends C function definitions when using C++ */
713 #ifdef __cplusplus
714 }
715 #endif
716 #include "close_code.h"
717 
718 #endif /* _SDL_events_h */
719 
720 /* vi: set ts=4 sw=4 expandtab: */
void * data1
Definition: SDL_events.h:471
SDL_JoystickID which
Definition: SDL_events.h:345
SDL_eventaction
Definition: SDL_events.h:545
SDL_MouseMotionEvent motion
Definition: SDL_events.h:503
SDL_JoystickID which
Definition: SDL_events.h:320
struct SDL_DollarGestureEvent SDL_DollarGestureEvent
Dollar Gesture Event (event.dgesture.*)
DECLSPEC void SDLCALL SDL_FlushEvents(Uint32 minType, Uint32 maxType)
Definition: SDL_events.c:364
struct SDL_TouchFingerEvent SDL_TouchFingerEvent
Touch finger event structure (event.tfinger.*)
Uint8 padding[56]
Definition: SDL_events.h:529
SDL_ControllerAxisEvent caxis
Definition: SDL_events.h:511
DECLSPEC int SDLCALL SDL_PushEvent(SDL_Event *event)
Add an event to the event queue.
Definition: SDL_events.c:457
SDL_JoyDeviceEvent jdevice
Definition: SDL_events.h:510
The &quot;quit requested&quot; event.
Definition: SDL_events.h:447
Controller device event structure (event.cdevice.*)
Definition: SDL_events.h:373
int32_t Sint32
A signed 32-bit integer type.
Definition: SDL_stdinc.h:141
GLint GLenum GLsizei GLsizei GLsizei GLint GLenum GLenum type
Definition: gl2ext.h:845
SDL_DollarGestureEvent dgesture
Definition: SDL_events.h:519
Joystick button event structure (event.jbutton.*)
Definition: SDL_events.h:316
Sint64 SDL_TouchID
Definition: SDL_touch.h:41
GLint GLint GLint GLint GLint GLint GLint GLbitfield GLenum filter
Definition: gl2ext.h:961
void * data2
Definition: SDL_events.h:472
SDL_ControllerDeviceEvent cdevice
Definition: SDL_events.h:513
SDL_JoyButtonEvent jbutton
Definition: SDL_events.h:509
DECLSPEC int SDLCALL SDL_WaitEvent(SDL_Event *event)
Waits indefinitely for the next available event.
Definition: SDL_events.c:421
struct SDL_ControllerDeviceEvent SDL_ControllerDeviceEvent
Controller device event structure (event.cdevice.*)
Sint64 SDL_FingerID
Definition: SDL_touch.h:42
SDL_bool
Definition: SDL_stdinc.h:116
Joystick axis motion event structure (event.jaxis.*)
Definition: SDL_events.h:264
struct SDL_JoyDeviceEvent SDL_JoyDeviceEvent
Joystick device event structure (event.jdevice.*)
SDL_SysWMmsg * msg
Definition: SDL_events.h:489
Sint32 SDL_JoystickID
Definition: SDL_joystick.h:72
struct SDL_UserEvent SDL_UserEvent
A user-defined event type (event.user.*)
struct SDL_ControllerAxisEvent SDL_ControllerAxisEvent
Game controller axis motion event structure (event.caxis.*)
DECLSPEC int SDLCALL SDL_PollEvent(SDL_Event *event)
Polls for currently pending events.
Definition: SDL_events.c:415
SDL_JoyBallEvent jball
Definition: SDL_events.h:507
SDL_JoystickID which
Definition: SDL_events.h:268
SDL_TouchID touchId
Definition: SDL_events.h:388
Uint32 timestamp
Definition: SDL_events.h:450
struct SDL_MouseWheelEvent SDL_MouseWheelEvent
Mouse wheel event structure (event.wheel.*)
Keyboard text editing event structure (event.edit.*)
Definition: SDL_events.h:192
#define DECLSPEC
Definition: begin_code.h:62
The SDL keysym structure, used in key events.
Definition: SDL_keyboard.h:47
DECLSPEC Uint8 SDLCALL SDL_EventState(Uint32 type, int state)
Definition: SDL_events.c:555
DECLSPEC void SDLCALL SDL_PumpEvents(void)
Definition: SDL_events.c:396
Game controller axis motion event structure (event.caxis.*)
Definition: SDL_events.h:341
SDL_QuitEvent quit
Definition: SDL_events.h:514
#define SDLCALL
Definition: begin_code.h:72
SDL_GestureID gestureId
Definition: SDL_events.h:423
Uint32 timestamp
Definition: SDL_events.h:468
struct SDL_MultiGestureEvent SDL_MultiGestureEvent
Multiple Finger Gesture Event (event.mgesture.*)
Dollar Gesture Event (event.dgesture.*)
Definition: SDL_events.h:418
SDL_JoystickID which
Definition: SDL_events.h:362
OS Specific event.
Definition: SDL_events.h:456
Keyboard text input event structure (event.text.*)
Definition: SDL_events.h:207
SDL_MouseWheelEvent wheel
Definition: SDL_events.h:505
Joystick trackball motion event structure (event.jball.*)
Definition: SDL_events.h:280
union SDL_Event SDL_Event
General event structure.
DECLSPEC int SDLCALL SDL_PeepEvents(SDL_Event *events, int numevents, SDL_eventaction action, Uint32 minType, Uint32 maxType)
Definition: SDL_events.c:265
SDL_WindowEvent window
Definition: SDL_events.h:499
uint32_t Uint32
An unsigned 32-bit integer type.
Definition: SDL_stdinc.h:145
Uint32 timestamp
Definition: SDL_events.h:488
A user-defined event type (event.user.*)
Definition: SDL_events.h:465
An event used to request a file open by the system (event.drop.*) This event is disabled by default...
Definition: SDL_events.h:436
Fields shared by every event.
Definition: SDL_events.h:151
struct SDL_TextInputEvent SDL_TextInputEvent
Keyboard text input event structure (event.text.*)
struct SDL_WindowEvent SDL_WindowEvent
Window state change event data (event.window.*)
SDL_JoystickID which
Definition: SDL_events.h:284
Keyboard button event structure (event.key.*)
Definition: SDL_events.h:176
SDL_TextInputEvent text
Definition: SDL_events.h:502
char text[SDL_TEXTINPUTEVENT_TEXT_SIZE]
Definition: SDL_events.h:212
Uint32 timestamp
Definition: SDL_events.h:439
int
Definition: SDL_systhread.c:37
SDL_JoyAxisEvent jaxis
Definition: SDL_events.h:506
Touch finger event structure (event.tfinger.*)
Definition: SDL_events.h:384
SDL_MultiGestureEvent mgesture
Definition: SDL_events.h:518
Sint64 SDL_GestureID
Definition: SDL_gesture.h:44
struct SDL_ControllerButtonEvent SDL_ControllerButtonEvent
Game controller button event structure (event.cbutton.*)
struct SDL_SysWMEvent SDL_SysWMEvent
A video driver dependent system event (event.syswm.*) This event is disabled by default, you can enable it with SDL_EventState()
struct SDL_JoyHatEvent SDL_JoyHatEvent
Joystick hat position change event structure (event.jhat.*)
struct SDL_TextEditingEvent SDL_TextEditingEvent
Keyboard text editing event structure (event.edit.*)
SDL_EventType
The types of events that can be delivered.
Definition: SDL_events.h:55
char text[SDL_TEXTEDITINGEVENT_TEXT_SIZE]
Definition: SDL_events.h:197
struct SDL_KeyboardEvent SDL_KeyboardEvent
Keyboard button event structure (event.key.*)
Uint32 windowID
Definition: SDL_events.h:469
struct SDL_OSEvent SDL_OSEvent
OS Specific event.
Uint32 timestamp
Definition: SDL_events.h:299
SDL_Keysym keysym
Definition: SDL_events.h:185
GLbitfield GLuint64 timeout
Definition: glew.h:5938
struct SDL_JoyBallEvent SDL_JoyBallEvent
Joystick trackball motion event structure (event.jball.*)
Mouse wheel event structure (event.wheel.*)
Definition: SDL_events.h:251
DECLSPEC int SDLCALL SDL_WaitEventTimeout(SDL_Event *event, int timeout)
Waits until the specified timeout (in milliseconds) for the next available event. ...
Definition: SDL_events.c:427
DECLSPEC void SDLCALL SDL_AddEventWatch(SDL_EventFilter filter, void *userdata)
Definition: SDL_events.c:504
Window state change event data (event.window.*)
Definition: SDL_events.h:160
DECLSPEC SDL_bool SDLCALL SDL_GetEventFilter(SDL_EventFilter *filter, void **userdata)
Definition: SDL_events.c:491
Uint32 timestamp
Definition: SDL_events.h:163
Uint32 timestamp
Definition: SDL_events.h:459
DECLSPEC SDL_bool SDLCALL SDL_HasEvent(Uint32 type)
Definition: SDL_events.c:346
SDL_TextEditingEvent edit
Definition: SDL_events.h:501
DECLSPEC void SDLCALL SDL_SetEventFilter(SDL_EventFilter filter, void *userdata)
Definition: SDL_events.c:481
SDL_SysWMEvent syswm
Definition: SDL_events.h:516
DECLSPEC void SDLCALL SDL_DelEventWatch(SDL_EventFilter filter, void *userdata)
Definition: SDL_events.c:521
Mouse motion event structure (event.motion.*)
Definition: SDL_events.h:218
DECLSPEC SDL_bool SDLCALL SDL_HasEvents(Uint32 minType, Uint32 maxType)
Definition: SDL_events.c:352
Game controller button event structure (event.cbutton.*)
Definition: SDL_events.h:358
SDL_KeyboardEvent key
Definition: SDL_events.h:500
Joystick hat position change event structure (event.jhat.*)
Definition: SDL_events.h:296
SDL_ControllerButtonEvent cbutton
Definition: SDL_events.h:512
uint8_t Uint8
An unsigned 8-bit integer type.
Definition: SDL_stdinc.h:129
Mouse button event structure (event.button.*)
Definition: SDL_events.h:234
A video driver dependent system event (event.syswm.*) This event is disabled by default, you can enable it with SDL_EventState()
Definition: SDL_events.h:485
Uint32 timestamp
Definition: SDL_events.h:154
int16_t Sint16
A signed 16-bit integer type.
Definition: SDL_stdinc.h:133
SDL_FingerID fingerId
Definition: SDL_events.h:389
SDL_MouseButtonEvent button
Definition: SDL_events.h:504
DECLSPEC Uint32 SDLCALL SDL_RegisterEvents(int numevents)
Definition: SDL_events.c:596
DECLSPEC void SDLCALL SDL_FlushEvent(Uint32 type)
Definition: SDL_events.c:358
struct SDL_CommonEvent SDL_CommonEvent
Fields shared by every event.
uint16_t Uint16
An unsigned 16-bit integer type.
Definition: SDL_stdinc.h:137
General event structure.
Definition: SDL_events.h:495
SDL_UserEvent user
Definition: SDL_events.h:515
#define SDL_TEXTINPUTEVENT_TEXT_SIZE
Definition: SDL_events.h:203
Uint32 type
Definition: SDL_events.h:458
struct SDL_JoyAxisEvent SDL_JoyAxisEvent
Joystick axis motion event structure (event.jaxis.*)
struct SDL_MouseMotionEvent SDL_MouseMotionEvent
Mouse motion event structure (event.motion.*)
SDL_JoyHatEvent jhat
Definition: SDL_events.h:508
SDL_CommonEvent common
Definition: SDL_events.h:498
DECLSPEC void SDLCALL SDL_FilterEvents(SDL_EventFilter filter, void *userdata)
Definition: SDL_events.c:540
Joystick device event structure (event.jdevice.*)
Definition: SDL_events.h:330
struct SDL_DropEvent SDL_DropEvent
An event used to request a file open by the system (event.drop.*) This event is disabled by default...
SDL_JoystickID which
Definition: SDL_events.h:300
SDL_TouchID touchId
Definition: SDL_events.h:405
SDL_DropEvent drop
Definition: SDL_events.h:520
Uint32 type
Definition: SDL_events.h:497
struct SDL_MouseButtonEvent SDL_MouseButtonEvent
Mouse button event structure (event.button.*)
#define SDL_TEXTEDITINGEVENT_TEXT_SIZE
Definition: SDL_events.h:188
cl_event event
Definition: glew.h:3556
struct SDL_JoyButtonEvent SDL_JoyButtonEvent
Joystick button event structure (event.jbutton.*)
struct SDL_QuitEvent SDL_QuitEvent
The &quot;quit requested&quot; event.
Multiple Finger Gesture Event (event.mgesture.*)
Definition: SDL_events.h:401
SDL_TouchFingerEvent tfinger
Definition: SDL_events.h:517