annotate include/SDL_events.h @ 4372:ca91f36ef3de SDL-1.2

1.2 branch: fixed assembly code register clobbering.
author Ryan C. Gordon <icculus@icculus.org>
date Sun, 01 Nov 2009 17:51:39 +0000
parents 4c4113c2162c
children
rev   line source
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
1 /*
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
2 SDL - Simple DirectMedia Layer
4159
a1b03ba2fcd0 Updated copyright date
Sam Lantinga <slouken@libsdl.org>
parents: 1358
diff changeset
3 Copyright (C) 1997-2009 Sam Lantinga
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
4
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
5 This library is free software; you can redistribute it and/or
1312
c9b51268668f Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents: 1301
diff changeset
6 modify it under the terms of the GNU Lesser General Public
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
7 License as published by the Free Software Foundation; either
1312
c9b51268668f Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents: 1301
diff changeset
8 version 2.1 of the License, or (at your option) any later version.
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
9
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
10 This library is distributed in the hope that it will be useful,
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1312
c9b51268668f Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents: 1301
diff changeset
13 Lesser General Public License for more details.
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
14
1312
c9b51268668f Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents: 1301
diff changeset
15 You should have received a copy of the GNU Lesser General Public
c9b51268668f Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents: 1301
diff changeset
16 License along with this library; if not, write to the Free Software
c9b51268668f Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents: 1301
diff changeset
17 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
18
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
19 Sam Lantinga
251
b8688cfdc232 Updated the headers with the correct e-mail address
Sam Lantinga <slouken@libsdl.org>
parents: 0
diff changeset
20 slouken@libsdl.org
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
21 */
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
22
4217
4c4113c2162c Fixed bug #706
Sam Lantinga <slouken@libsdl.org>
parents: 4159
diff changeset
23 /**
4c4113c2162c Fixed bug #706
Sam Lantinga <slouken@libsdl.org>
parents: 4159
diff changeset
24 * @file SDL_events.h
4c4113c2162c Fixed bug #706
Sam Lantinga <slouken@libsdl.org>
parents: 4159
diff changeset
25 * Include file for SDL event handling
4c4113c2162c Fixed bug #706
Sam Lantinga <slouken@libsdl.org>
parents: 4159
diff changeset
26 */
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
27
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
28 #ifndef _SDL_events_h
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
29 #define _SDL_events_h
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
30
1356
67114343400d *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 1330
diff changeset
31 #include "SDL_stdinc.h"
1358
c71e05b4dc2e More header massaging... works great on Windows. ;-)
Sam Lantinga <slouken@libsdl.org>
parents: 1356
diff changeset
32 #include "SDL_error.h"
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
33 #include "SDL_active.h"
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
34 #include "SDL_keyboard.h"
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
35 #include "SDL_mouse.h"
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
36 #include "SDL_joystick.h"
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
37 #include "SDL_quit.h"
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
38
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
39 #include "begin_code.h"
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
40 /* Set up for C function definitions, even when using C++ */
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
41 #ifdef __cplusplus
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
42 extern "C" {
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
43 #endif
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
44
4217
4c4113c2162c Fixed bug #706
Sam Lantinga <slouken@libsdl.org>
parents: 4159
diff changeset
45 /** @name General keyboard/mouse state definitions */
4c4113c2162c Fixed bug #706
Sam Lantinga <slouken@libsdl.org>
parents: 4159
diff changeset
46 /*@{*/
1330
450721ad5436 It's now possible to build SDL without any C runtime at all on Windows,
Sam Lantinga <slouken@libsdl.org>
parents: 1312
diff changeset
47 #define SDL_RELEASED 0
450721ad5436 It's now possible to build SDL without any C runtime at all on Windows,
Sam Lantinga <slouken@libsdl.org>
parents: 1312
diff changeset
48 #define SDL_PRESSED 1
4217
4c4113c2162c Fixed bug #706
Sam Lantinga <slouken@libsdl.org>
parents: 4159
diff changeset
49 /*@}*/
1330
450721ad5436 It's now possible to build SDL without any C runtime at all on Windows,
Sam Lantinga <slouken@libsdl.org>
parents: 1312
diff changeset
50
4217
4c4113c2162c Fixed bug #706
Sam Lantinga <slouken@libsdl.org>
parents: 4159
diff changeset
51 /** Event enumerations */
1294
1760ceb23bc6 Date: Fri, 18 Feb 2005 20:49:35 +0200 (EET)
Sam Lantinga <slouken@libsdl.org>
parents: 1258
diff changeset
52 typedef enum {
4217
4c4113c2162c Fixed bug #706
Sam Lantinga <slouken@libsdl.org>
parents: 4159
diff changeset
53 SDL_NOEVENT = 0, /**< Unused (do not remove) */
4c4113c2162c Fixed bug #706
Sam Lantinga <slouken@libsdl.org>
parents: 4159
diff changeset
54 SDL_ACTIVEEVENT, /**< Application loses/gains visibility */
4c4113c2162c Fixed bug #706
Sam Lantinga <slouken@libsdl.org>
parents: 4159
diff changeset
55 SDL_KEYDOWN, /**< Keys pressed */
4c4113c2162c Fixed bug #706
Sam Lantinga <slouken@libsdl.org>
parents: 4159
diff changeset
56 SDL_KEYUP, /**< Keys released */
4c4113c2162c Fixed bug #706
Sam Lantinga <slouken@libsdl.org>
parents: 4159
diff changeset
57 SDL_MOUSEMOTION, /**< Mouse moved */
4c4113c2162c Fixed bug #706
Sam Lantinga <slouken@libsdl.org>
parents: 4159
diff changeset
58 SDL_MOUSEBUTTONDOWN, /**< Mouse button pressed */
4c4113c2162c Fixed bug #706
Sam Lantinga <slouken@libsdl.org>
parents: 4159
diff changeset
59 SDL_MOUSEBUTTONUP, /**< Mouse button released */
4c4113c2162c Fixed bug #706
Sam Lantinga <slouken@libsdl.org>
parents: 4159
diff changeset
60 SDL_JOYAXISMOTION, /**< Joystick axis motion */
4c4113c2162c Fixed bug #706
Sam Lantinga <slouken@libsdl.org>
parents: 4159
diff changeset
61 SDL_JOYBALLMOTION, /**< Joystick trackball motion */
4c4113c2162c Fixed bug #706
Sam Lantinga <slouken@libsdl.org>
parents: 4159
diff changeset
62 SDL_JOYHATMOTION, /**< Joystick hat position change */
4c4113c2162c Fixed bug #706
Sam Lantinga <slouken@libsdl.org>
parents: 4159
diff changeset
63 SDL_JOYBUTTONDOWN, /**< Joystick button pressed */
4c4113c2162c Fixed bug #706
Sam Lantinga <slouken@libsdl.org>
parents: 4159
diff changeset
64 SDL_JOYBUTTONUP, /**< Joystick button released */
4c4113c2162c Fixed bug #706
Sam Lantinga <slouken@libsdl.org>
parents: 4159
diff changeset
65 SDL_QUIT, /**< User-requested quit */
4c4113c2162c Fixed bug #706
Sam Lantinga <slouken@libsdl.org>
parents: 4159
diff changeset
66 SDL_SYSWMEVENT, /**< System specific event */
4c4113c2162c Fixed bug #706
Sam Lantinga <slouken@libsdl.org>
parents: 4159
diff changeset
67 SDL_EVENT_RESERVEDA, /**< Reserved for future use.. */
4c4113c2162c Fixed bug #706
Sam Lantinga <slouken@libsdl.org>
parents: 4159
diff changeset
68 SDL_EVENT_RESERVEDB, /**< Reserved for future use.. */
4c4113c2162c Fixed bug #706
Sam Lantinga <slouken@libsdl.org>
parents: 4159
diff changeset
69 SDL_VIDEORESIZE, /**< User resized video mode */
4c4113c2162c Fixed bug #706
Sam Lantinga <slouken@libsdl.org>
parents: 4159
diff changeset
70 SDL_VIDEOEXPOSE, /**< Screen needs to be redrawn */
4c4113c2162c Fixed bug #706
Sam Lantinga <slouken@libsdl.org>
parents: 4159
diff changeset
71 SDL_EVENT_RESERVED2, /**< Reserved for future use.. */
4c4113c2162c Fixed bug #706
Sam Lantinga <slouken@libsdl.org>
parents: 4159
diff changeset
72 SDL_EVENT_RESERVED3, /**< Reserved for future use.. */
4c4113c2162c Fixed bug #706
Sam Lantinga <slouken@libsdl.org>
parents: 4159
diff changeset
73 SDL_EVENT_RESERVED4, /**< Reserved for future use.. */
4c4113c2162c Fixed bug #706
Sam Lantinga <slouken@libsdl.org>
parents: 4159
diff changeset
74 SDL_EVENT_RESERVED5, /**< Reserved for future use.. */
4c4113c2162c Fixed bug #706
Sam Lantinga <slouken@libsdl.org>
parents: 4159
diff changeset
75 SDL_EVENT_RESERVED6, /**< Reserved for future use.. */
4c4113c2162c Fixed bug #706
Sam Lantinga <slouken@libsdl.org>
parents: 4159
diff changeset
76 SDL_EVENT_RESERVED7, /**< Reserved for future use.. */
4c4113c2162c Fixed bug #706
Sam Lantinga <slouken@libsdl.org>
parents: 4159
diff changeset
77 /** Events SDL_USEREVENT through SDL_MAXEVENTS-1 are for your use */
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
78 SDL_USEREVENT = 24,
4217
4c4113c2162c Fixed bug #706
Sam Lantinga <slouken@libsdl.org>
parents: 4159
diff changeset
79 /** This last event is only for bounding internal arrays
4c4113c2162c Fixed bug #706
Sam Lantinga <slouken@libsdl.org>
parents: 4159
diff changeset
80 * It is the number of bits in the event mask datatype -- Uint32
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
81 */
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
82 SDL_NUMEVENTS = 32
1294
1760ceb23bc6 Date: Fri, 18 Feb 2005 20:49:35 +0200 (EET)
Sam Lantinga <slouken@libsdl.org>
parents: 1258
diff changeset
83 } SDL_EventType;
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
84
4217
4c4113c2162c Fixed bug #706
Sam Lantinga <slouken@libsdl.org>
parents: 4159
diff changeset
85 /** @name Predefined event masks */
4c4113c2162c Fixed bug #706
Sam Lantinga <slouken@libsdl.org>
parents: 4159
diff changeset
86 /*@{*/
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
87 #define SDL_EVENTMASK(X) (1<<(X))
1294
1760ceb23bc6 Date: Fri, 18 Feb 2005 20:49:35 +0200 (EET)
Sam Lantinga <slouken@libsdl.org>
parents: 1258
diff changeset
88 typedef enum {
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
89 SDL_ACTIVEEVENTMASK = SDL_EVENTMASK(SDL_ACTIVEEVENT),
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
90 SDL_KEYDOWNMASK = SDL_EVENTMASK(SDL_KEYDOWN),
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
91 SDL_KEYUPMASK = SDL_EVENTMASK(SDL_KEYUP),
1297
7b32c7a586c9 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 1294
diff changeset
92 SDL_KEYEVENTMASK = SDL_EVENTMASK(SDL_KEYDOWN)|
1301
Sam Lantinga <slouken@libsdl.org>
parents: 1297
diff changeset
93 SDL_EVENTMASK(SDL_KEYUP),
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
94 SDL_MOUSEMOTIONMASK = SDL_EVENTMASK(SDL_MOUSEMOTION),
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
95 SDL_MOUSEBUTTONDOWNMASK = SDL_EVENTMASK(SDL_MOUSEBUTTONDOWN),
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
96 SDL_MOUSEBUTTONUPMASK = SDL_EVENTMASK(SDL_MOUSEBUTTONUP),
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
97 SDL_MOUSEEVENTMASK = SDL_EVENTMASK(SDL_MOUSEMOTION)|
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
98 SDL_EVENTMASK(SDL_MOUSEBUTTONDOWN)|
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
99 SDL_EVENTMASK(SDL_MOUSEBUTTONUP),
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
100 SDL_JOYAXISMOTIONMASK = SDL_EVENTMASK(SDL_JOYAXISMOTION),
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
101 SDL_JOYBALLMOTIONMASK = SDL_EVENTMASK(SDL_JOYBALLMOTION),
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
102 SDL_JOYHATMOTIONMASK = SDL_EVENTMASK(SDL_JOYHATMOTION),
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
103 SDL_JOYBUTTONDOWNMASK = SDL_EVENTMASK(SDL_JOYBUTTONDOWN),
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
104 SDL_JOYBUTTONUPMASK = SDL_EVENTMASK(SDL_JOYBUTTONUP),
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
105 SDL_JOYEVENTMASK = SDL_EVENTMASK(SDL_JOYAXISMOTION)|
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
106 SDL_EVENTMASK(SDL_JOYBALLMOTION)|
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
107 SDL_EVENTMASK(SDL_JOYHATMOTION)|
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
108 SDL_EVENTMASK(SDL_JOYBUTTONDOWN)|
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
109 SDL_EVENTMASK(SDL_JOYBUTTONUP),
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
110 SDL_VIDEORESIZEMASK = SDL_EVENTMASK(SDL_VIDEORESIZE),
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
111 SDL_VIDEOEXPOSEMASK = SDL_EVENTMASK(SDL_VIDEOEXPOSE),
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
112 SDL_QUITMASK = SDL_EVENTMASK(SDL_QUIT),
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
113 SDL_SYSWMEVENTMASK = SDL_EVENTMASK(SDL_SYSWMEVENT)
1294
1760ceb23bc6 Date: Fri, 18 Feb 2005 20:49:35 +0200 (EET)
Sam Lantinga <slouken@libsdl.org>
parents: 1258
diff changeset
114 } SDL_EventMask ;
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
115 #define SDL_ALLEVENTS 0xFFFFFFFF
4217
4c4113c2162c Fixed bug #706
Sam Lantinga <slouken@libsdl.org>
parents: 4159
diff changeset
116 /*@}*/
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
117
4217
4c4113c2162c Fixed bug #706
Sam Lantinga <slouken@libsdl.org>
parents: 4159
diff changeset
118 /** Application visibility event structure */
911
04a403e4ccf5 Date: Mon, 3 May 2004 03:15:01 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 844
diff changeset
119 typedef struct SDL_ActiveEvent {
4217
4c4113c2162c Fixed bug #706
Sam Lantinga <slouken@libsdl.org>
parents: 4159
diff changeset
120 Uint8 type; /**< SDL_ACTIVEEVENT */
4c4113c2162c Fixed bug #706
Sam Lantinga <slouken@libsdl.org>
parents: 4159
diff changeset
121 Uint8 gain; /**< Whether given states were gained or lost (1/0) */
4c4113c2162c Fixed bug #706
Sam Lantinga <slouken@libsdl.org>
parents: 4159
diff changeset
122 Uint8 state; /**< A mask of the focus states */
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
123 } SDL_ActiveEvent;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
124
4217
4c4113c2162c Fixed bug #706
Sam Lantinga <slouken@libsdl.org>
parents: 4159
diff changeset
125 /** Keyboard event structure */
911
04a403e4ccf5 Date: Mon, 3 May 2004 03:15:01 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 844
diff changeset
126 typedef struct SDL_KeyboardEvent {
4217
4c4113c2162c Fixed bug #706
Sam Lantinga <slouken@libsdl.org>
parents: 4159
diff changeset
127 Uint8 type; /**< SDL_KEYDOWN or SDL_KEYUP */
4c4113c2162c Fixed bug #706
Sam Lantinga <slouken@libsdl.org>
parents: 4159
diff changeset
128 Uint8 which; /**< The keyboard device index */
4c4113c2162c Fixed bug #706
Sam Lantinga <slouken@libsdl.org>
parents: 4159
diff changeset
129 Uint8 state; /**< SDL_PRESSED or SDL_RELEASED */
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
130 SDL_keysym keysym;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
131 } SDL_KeyboardEvent;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
132
4217
4c4113c2162c Fixed bug #706
Sam Lantinga <slouken@libsdl.org>
parents: 4159
diff changeset
133 /** Mouse motion event structure */
911
04a403e4ccf5 Date: Mon, 3 May 2004 03:15:01 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 844
diff changeset
134 typedef struct SDL_MouseMotionEvent {
4217
4c4113c2162c Fixed bug #706
Sam Lantinga <slouken@libsdl.org>
parents: 4159
diff changeset
135 Uint8 type; /**< SDL_MOUSEMOTION */
4c4113c2162c Fixed bug #706
Sam Lantinga <slouken@libsdl.org>
parents: 4159
diff changeset
136 Uint8 which; /**< The mouse device index */
4c4113c2162c Fixed bug #706
Sam Lantinga <slouken@libsdl.org>
parents: 4159
diff changeset
137 Uint8 state; /**< The current button state */
4c4113c2162c Fixed bug #706
Sam Lantinga <slouken@libsdl.org>
parents: 4159
diff changeset
138 Uint16 x, y; /**< The X/Y coordinates of the mouse */
4c4113c2162c Fixed bug #706
Sam Lantinga <slouken@libsdl.org>
parents: 4159
diff changeset
139 Sint16 xrel; /**< The relative motion in the X direction */
4c4113c2162c Fixed bug #706
Sam Lantinga <slouken@libsdl.org>
parents: 4159
diff changeset
140 Sint16 yrel; /**< The relative motion in the Y direction */
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
141 } SDL_MouseMotionEvent;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
142
4217
4c4113c2162c Fixed bug #706
Sam Lantinga <slouken@libsdl.org>
parents: 4159
diff changeset
143 /** Mouse button event structure */
911
04a403e4ccf5 Date: Mon, 3 May 2004 03:15:01 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 844
diff changeset
144 typedef struct SDL_MouseButtonEvent {
4217
4c4113c2162c Fixed bug #706
Sam Lantinga <slouken@libsdl.org>
parents: 4159
diff changeset
145 Uint8 type; /**< SDL_MOUSEBUTTONDOWN or SDL_MOUSEBUTTONUP */
4c4113c2162c Fixed bug #706
Sam Lantinga <slouken@libsdl.org>
parents: 4159
diff changeset
146 Uint8 which; /**< The mouse device index */
4c4113c2162c Fixed bug #706
Sam Lantinga <slouken@libsdl.org>
parents: 4159
diff changeset
147 Uint8 button; /**< The mouse button index */
4c4113c2162c Fixed bug #706
Sam Lantinga <slouken@libsdl.org>
parents: 4159
diff changeset
148 Uint8 state; /**< SDL_PRESSED or SDL_RELEASED */
4c4113c2162c Fixed bug #706
Sam Lantinga <slouken@libsdl.org>
parents: 4159
diff changeset
149 Uint16 x, y; /**< The X/Y coordinates of the mouse at press time */
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
150 } SDL_MouseButtonEvent;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
151
4217
4c4113c2162c Fixed bug #706
Sam Lantinga <slouken@libsdl.org>
parents: 4159
diff changeset
152 /** Joystick axis motion event structure */
911
04a403e4ccf5 Date: Mon, 3 May 2004 03:15:01 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 844
diff changeset
153 typedef struct SDL_JoyAxisEvent {
4217
4c4113c2162c Fixed bug #706
Sam Lantinga <slouken@libsdl.org>
parents: 4159
diff changeset
154 Uint8 type; /**< SDL_JOYAXISMOTION */
4c4113c2162c Fixed bug #706
Sam Lantinga <slouken@libsdl.org>
parents: 4159
diff changeset
155 Uint8 which; /**< The joystick device index */
4c4113c2162c Fixed bug #706
Sam Lantinga <slouken@libsdl.org>
parents: 4159
diff changeset
156 Uint8 axis; /**< The joystick axis index */
4c4113c2162c Fixed bug #706
Sam Lantinga <slouken@libsdl.org>
parents: 4159
diff changeset
157 Sint16 value; /**< The axis value (range: -32768 to 32767) */
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
158 } SDL_JoyAxisEvent;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
159
4217
4c4113c2162c Fixed bug #706
Sam Lantinga <slouken@libsdl.org>
parents: 4159
diff changeset
160 /** Joystick trackball motion event structure */
911
04a403e4ccf5 Date: Mon, 3 May 2004 03:15:01 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 844
diff changeset
161 typedef struct SDL_JoyBallEvent {
4217
4c4113c2162c Fixed bug #706
Sam Lantinga <slouken@libsdl.org>
parents: 4159
diff changeset
162 Uint8 type; /**< SDL_JOYBALLMOTION */
4c4113c2162c Fixed bug #706
Sam Lantinga <slouken@libsdl.org>
parents: 4159
diff changeset
163 Uint8 which; /**< The joystick device index */
4c4113c2162c Fixed bug #706
Sam Lantinga <slouken@libsdl.org>
parents: 4159
diff changeset
164 Uint8 ball; /**< The joystick trackball index */
4c4113c2162c Fixed bug #706
Sam Lantinga <slouken@libsdl.org>
parents: 4159
diff changeset
165 Sint16 xrel; /**< The relative motion in the X direction */
4c4113c2162c Fixed bug #706
Sam Lantinga <slouken@libsdl.org>
parents: 4159
diff changeset
166 Sint16 yrel; /**< The relative motion in the Y direction */
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
167 } SDL_JoyBallEvent;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
168
4217
4c4113c2162c Fixed bug #706
Sam Lantinga <slouken@libsdl.org>
parents: 4159
diff changeset
169 /** Joystick hat position change event structure */
911
04a403e4ccf5 Date: Mon, 3 May 2004 03:15:01 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 844
diff changeset
170 typedef struct SDL_JoyHatEvent {
4217
4c4113c2162c Fixed bug #706
Sam Lantinga <slouken@libsdl.org>
parents: 4159
diff changeset
171 Uint8 type; /**< SDL_JOYHATMOTION */
4c4113c2162c Fixed bug #706
Sam Lantinga <slouken@libsdl.org>
parents: 4159
diff changeset
172 Uint8 which; /**< The joystick device index */
4c4113c2162c Fixed bug #706
Sam Lantinga <slouken@libsdl.org>
parents: 4159
diff changeset
173 Uint8 hat; /**< The joystick hat index */
4c4113c2162c Fixed bug #706
Sam Lantinga <slouken@libsdl.org>
parents: 4159
diff changeset
174 Uint8 value; /**< The hat position value:
4c4113c2162c Fixed bug #706
Sam Lantinga <slouken@libsdl.org>
parents: 4159
diff changeset
175 * SDL_HAT_LEFTUP SDL_HAT_UP SDL_HAT_RIGHTUP
4c4113c2162c Fixed bug #706
Sam Lantinga <slouken@libsdl.org>
parents: 4159
diff changeset
176 * SDL_HAT_LEFT SDL_HAT_CENTERED SDL_HAT_RIGHT
4c4113c2162c Fixed bug #706
Sam Lantinga <slouken@libsdl.org>
parents: 4159
diff changeset
177 * SDL_HAT_LEFTDOWN SDL_HAT_DOWN SDL_HAT_RIGHTDOWN
4c4113c2162c Fixed bug #706
Sam Lantinga <slouken@libsdl.org>
parents: 4159
diff changeset
178 * Note that zero means the POV is centered.
4c4113c2162c Fixed bug #706
Sam Lantinga <slouken@libsdl.org>
parents: 4159
diff changeset
179 */
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
180 } SDL_JoyHatEvent;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
181
4217
4c4113c2162c Fixed bug #706
Sam Lantinga <slouken@libsdl.org>
parents: 4159
diff changeset
182 /** Joystick button event structure */
911
04a403e4ccf5 Date: Mon, 3 May 2004 03:15:01 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 844
diff changeset
183 typedef struct SDL_JoyButtonEvent {
4217
4c4113c2162c Fixed bug #706
Sam Lantinga <slouken@libsdl.org>
parents: 4159
diff changeset
184 Uint8 type; /**< SDL_JOYBUTTONDOWN or SDL_JOYBUTTONUP */
4c4113c2162c Fixed bug #706
Sam Lantinga <slouken@libsdl.org>
parents: 4159
diff changeset
185 Uint8 which; /**< The joystick device index */
4c4113c2162c Fixed bug #706
Sam Lantinga <slouken@libsdl.org>
parents: 4159
diff changeset
186 Uint8 button; /**< The joystick button index */
4c4113c2162c Fixed bug #706
Sam Lantinga <slouken@libsdl.org>
parents: 4159
diff changeset
187 Uint8 state; /**< SDL_PRESSED or SDL_RELEASED */
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
188 } SDL_JoyButtonEvent;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
189
4217
4c4113c2162c Fixed bug #706
Sam Lantinga <slouken@libsdl.org>
parents: 4159
diff changeset
190 /** The "window resized" event
4c4113c2162c Fixed bug #706
Sam Lantinga <slouken@libsdl.org>
parents: 4159
diff changeset
191 * When you get this event, you are responsible for setting a new video
4c4113c2162c Fixed bug #706
Sam Lantinga <slouken@libsdl.org>
parents: 4159
diff changeset
192 * mode with the new width and height.
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
193 */
911
04a403e4ccf5 Date: Mon, 3 May 2004 03:15:01 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 844
diff changeset
194 typedef struct SDL_ResizeEvent {
4217
4c4113c2162c Fixed bug #706
Sam Lantinga <slouken@libsdl.org>
parents: 4159
diff changeset
195 Uint8 type; /**< SDL_VIDEORESIZE */
4c4113c2162c Fixed bug #706
Sam Lantinga <slouken@libsdl.org>
parents: 4159
diff changeset
196 int w; /**< New width */
4c4113c2162c Fixed bug #706
Sam Lantinga <slouken@libsdl.org>
parents: 4159
diff changeset
197 int h; /**< New height */
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
198 } SDL_ResizeEvent;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
199
4217
4c4113c2162c Fixed bug #706
Sam Lantinga <slouken@libsdl.org>
parents: 4159
diff changeset
200 /** The "screen redraw" event */
911
04a403e4ccf5 Date: Mon, 3 May 2004 03:15:01 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 844
diff changeset
201 typedef struct SDL_ExposeEvent {
4217
4c4113c2162c Fixed bug #706
Sam Lantinga <slouken@libsdl.org>
parents: 4159
diff changeset
202 Uint8 type; /**< SDL_VIDEOEXPOSE */
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
203 } SDL_ExposeEvent;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
204
4217
4c4113c2162c Fixed bug #706
Sam Lantinga <slouken@libsdl.org>
parents: 4159
diff changeset
205 /** The "quit requested" event */
911
04a403e4ccf5 Date: Mon, 3 May 2004 03:15:01 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 844
diff changeset
206 typedef struct SDL_QuitEvent {
4217
4c4113c2162c Fixed bug #706
Sam Lantinga <slouken@libsdl.org>
parents: 4159
diff changeset
207 Uint8 type; /**< SDL_QUIT */
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
208 } SDL_QuitEvent;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
209
4217
4c4113c2162c Fixed bug #706
Sam Lantinga <slouken@libsdl.org>
parents: 4159
diff changeset
210 /** A user-defined event type */
911
04a403e4ccf5 Date: Mon, 3 May 2004 03:15:01 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 844
diff changeset
211 typedef struct SDL_UserEvent {
4217
4c4113c2162c Fixed bug #706
Sam Lantinga <slouken@libsdl.org>
parents: 4159
diff changeset
212 Uint8 type; /**< SDL_USEREVENT through SDL_NUMEVENTS-1 */
4c4113c2162c Fixed bug #706
Sam Lantinga <slouken@libsdl.org>
parents: 4159
diff changeset
213 int code; /**< User defined event code */
4c4113c2162c Fixed bug #706
Sam Lantinga <slouken@libsdl.org>
parents: 4159
diff changeset
214 void *data1; /**< User defined data pointer */
4c4113c2162c Fixed bug #706
Sam Lantinga <slouken@libsdl.org>
parents: 4159
diff changeset
215 void *data2; /**< User defined data pointer */
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
216 } SDL_UserEvent;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
217
4217
4c4113c2162c Fixed bug #706
Sam Lantinga <slouken@libsdl.org>
parents: 4159
diff changeset
218 /** If you want to use this event, you should include SDL_syswm.h */
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
219 struct SDL_SysWMmsg;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
220 typedef struct SDL_SysWMmsg SDL_SysWMmsg;
911
04a403e4ccf5 Date: Mon, 3 May 2004 03:15:01 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 844
diff changeset
221 typedef struct SDL_SysWMEvent {
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
222 Uint8 type;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
223 SDL_SysWMmsg *msg;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
224 } SDL_SysWMEvent;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
225
4217
4c4113c2162c Fixed bug #706
Sam Lantinga <slouken@libsdl.org>
parents: 4159
diff changeset
226 /** General event structure */
1258
b2283b0ded26 Date: Thu, 19 Jan 2006 20:02:29 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 930
diff changeset
227 typedef union SDL_Event {
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
228 Uint8 type;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
229 SDL_ActiveEvent active;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
230 SDL_KeyboardEvent key;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
231 SDL_MouseMotionEvent motion;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
232 SDL_MouseButtonEvent button;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
233 SDL_JoyAxisEvent jaxis;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
234 SDL_JoyBallEvent jball;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
235 SDL_JoyHatEvent jhat;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
236 SDL_JoyButtonEvent jbutton;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
237 SDL_ResizeEvent resize;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
238 SDL_ExposeEvent expose;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
239 SDL_QuitEvent quit;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
240 SDL_UserEvent user;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
241 SDL_SysWMEvent syswm;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
242 } SDL_Event;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
243
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
244
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
245 /* Function prototypes */
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
246
4217
4c4113c2162c Fixed bug #706
Sam Lantinga <slouken@libsdl.org>
parents: 4159
diff changeset
247 /** Pumps the event loop, gathering events from the input devices.
4c4113c2162c Fixed bug #706
Sam Lantinga <slouken@libsdl.org>
parents: 4159
diff changeset
248 * This function updates the event queue and internal input device state.
4c4113c2162c Fixed bug #706
Sam Lantinga <slouken@libsdl.org>
parents: 4159
diff changeset
249 * This should only be run in the thread that sets the video mode.
4c4113c2162c Fixed bug #706
Sam Lantinga <slouken@libsdl.org>
parents: 4159
diff changeset
250 */
337
9154ec9ca3d2 Explicitly specify the SDL API calling convention (C by default)
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
251 extern DECLSPEC void SDLCALL SDL_PumpEvents(void);
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
252
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
253 typedef enum {
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
254 SDL_ADDEVENT,
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
255 SDL_PEEKEVENT,
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
256 SDL_GETEVENT
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
257 } SDL_eventaction;
4217
4c4113c2162c Fixed bug #706
Sam Lantinga <slouken@libsdl.org>
parents: 4159
diff changeset
258
4c4113c2162c Fixed bug #706
Sam Lantinga <slouken@libsdl.org>
parents: 4159
diff changeset
259 /**
4c4113c2162c Fixed bug #706
Sam Lantinga <slouken@libsdl.org>
parents: 4159
diff changeset
260 * Checks the event queue for messages and optionally returns them.
4c4113c2162c Fixed bug #706
Sam Lantinga <slouken@libsdl.org>
parents: 4159
diff changeset
261 *
4c4113c2162c Fixed bug #706
Sam Lantinga <slouken@libsdl.org>
parents: 4159
diff changeset
262 * If 'action' is SDL_ADDEVENT, up to 'numevents' events will be added to
4c4113c2162c Fixed bug #706
Sam Lantinga <slouken@libsdl.org>
parents: 4159
diff changeset
263 * the back of the event queue.
4c4113c2162c Fixed bug #706
Sam Lantinga <slouken@libsdl.org>
parents: 4159
diff changeset
264 * If 'action' is SDL_PEEKEVENT, up to 'numevents' events at the front
4c4113c2162c Fixed bug #706
Sam Lantinga <slouken@libsdl.org>
parents: 4159
diff changeset
265 * of the event queue, matching 'mask', will be returned and will not
4c4113c2162c Fixed bug #706
Sam Lantinga <slouken@libsdl.org>
parents: 4159
diff changeset
266 * be removed from the queue.
4c4113c2162c Fixed bug #706
Sam Lantinga <slouken@libsdl.org>
parents: 4159
diff changeset
267 * If 'action' is SDL_GETEVENT, up to 'numevents' events at the front
4c4113c2162c Fixed bug #706
Sam Lantinga <slouken@libsdl.org>
parents: 4159
diff changeset
268 * of the event queue, matching 'mask', will be returned and will be
4c4113c2162c Fixed bug #706
Sam Lantinga <slouken@libsdl.org>
parents: 4159
diff changeset
269 * removed from the queue.
4c4113c2162c Fixed bug #706
Sam Lantinga <slouken@libsdl.org>
parents: 4159
diff changeset
270 *
4c4113c2162c Fixed bug #706
Sam Lantinga <slouken@libsdl.org>
parents: 4159
diff changeset
271 * @return
4c4113c2162c Fixed bug #706
Sam Lantinga <slouken@libsdl.org>
parents: 4159
diff changeset
272 * This function returns the number of events actually stored, or -1
4c4113c2162c Fixed bug #706
Sam Lantinga <slouken@libsdl.org>
parents: 4159
diff changeset
273 * if there was an error.
4c4113c2162c Fixed bug #706
Sam Lantinga <slouken@libsdl.org>
parents: 4159
diff changeset
274 *
4c4113c2162c Fixed bug #706
Sam Lantinga <slouken@libsdl.org>
parents: 4159
diff changeset
275 * This function is thread-safe.
4c4113c2162c Fixed bug #706
Sam Lantinga <slouken@libsdl.org>
parents: 4159
diff changeset
276 */
337
9154ec9ca3d2 Explicitly specify the SDL API calling convention (C by default)
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
277 extern DECLSPEC int SDLCALL SDL_PeepEvents(SDL_Event *events, int numevents,
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
278 SDL_eventaction action, Uint32 mask);
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
279
4217
4c4113c2162c Fixed bug #706
Sam Lantinga <slouken@libsdl.org>
parents: 4159
diff changeset
280 /** Polls for currently pending events, and returns 1 if there are any pending
4c4113c2162c Fixed bug #706
Sam Lantinga <slouken@libsdl.org>
parents: 4159
diff changeset
281 * events, or 0 if there are none available. If 'event' is not NULL, the next
4c4113c2162c Fixed bug #706
Sam Lantinga <slouken@libsdl.org>
parents: 4159
diff changeset
282 * event is removed from the queue and stored in that area.
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
283 */
337
9154ec9ca3d2 Explicitly specify the SDL API calling convention (C by default)
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
284 extern DECLSPEC int SDLCALL SDL_PollEvent(SDL_Event *event);
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
285
4217
4c4113c2162c Fixed bug #706
Sam Lantinga <slouken@libsdl.org>
parents: 4159
diff changeset
286 /** Waits indefinitely for the next available event, returning 1, or 0 if there
4c4113c2162c Fixed bug #706
Sam Lantinga <slouken@libsdl.org>
parents: 4159
diff changeset
287 * was an error while waiting for events. If 'event' is not NULL, the next
4c4113c2162c Fixed bug #706
Sam Lantinga <slouken@libsdl.org>
parents: 4159
diff changeset
288 * event is removed from the queue and stored in that area.
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
289 */
337
9154ec9ca3d2 Explicitly specify the SDL API calling convention (C by default)
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
290 extern DECLSPEC int SDLCALL SDL_WaitEvent(SDL_Event *event);
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
291
4217
4c4113c2162c Fixed bug #706
Sam Lantinga <slouken@libsdl.org>
parents: 4159
diff changeset
292 /** Add an event to the event queue.
4c4113c2162c Fixed bug #706
Sam Lantinga <slouken@libsdl.org>
parents: 4159
diff changeset
293 * This function returns 0 on success, or -1 if the event queue was full
4c4113c2162c Fixed bug #706
Sam Lantinga <slouken@libsdl.org>
parents: 4159
diff changeset
294 * or there was some other error.
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
295 */
337
9154ec9ca3d2 Explicitly specify the SDL API calling convention (C by default)
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
296 extern DECLSPEC int SDLCALL SDL_PushEvent(SDL_Event *event);
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
297
4217
4c4113c2162c Fixed bug #706
Sam Lantinga <slouken@libsdl.org>
parents: 4159
diff changeset
298 /** @name Event Filtering */
4c4113c2162c Fixed bug #706
Sam Lantinga <slouken@libsdl.org>
parents: 4159
diff changeset
299 /*@{*/
930
02759105b989 Date: Fri, 20 Aug 2004 08:31:20 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 911
diff changeset
300 typedef int (SDLCALL *SDL_EventFilter)(const SDL_Event *event);
4217
4c4113c2162c Fixed bug #706
Sam Lantinga <slouken@libsdl.org>
parents: 4159
diff changeset
301 /**
4c4113c2162c Fixed bug #706
Sam Lantinga <slouken@libsdl.org>
parents: 4159
diff changeset
302 * This function sets up a filter to process all events before they
4c4113c2162c Fixed bug #706
Sam Lantinga <slouken@libsdl.org>
parents: 4159
diff changeset
303 * change internal state and are posted to the internal event queue.
4c4113c2162c Fixed bug #706
Sam Lantinga <slouken@libsdl.org>
parents: 4159
diff changeset
304 *
4c4113c2162c Fixed bug #706
Sam Lantinga <slouken@libsdl.org>
parents: 4159
diff changeset
305 * The filter is protypted as:
4c4113c2162c Fixed bug #706
Sam Lantinga <slouken@libsdl.org>
parents: 4159
diff changeset
306 * @code typedef int (SDLCALL *SDL_EventFilter)(const SDL_Event *event); @endcode
4c4113c2162c Fixed bug #706
Sam Lantinga <slouken@libsdl.org>
parents: 4159
diff changeset
307 *
4c4113c2162c Fixed bug #706
Sam Lantinga <slouken@libsdl.org>
parents: 4159
diff changeset
308 * If the filter returns 1, then the event will be added to the internal queue.
4c4113c2162c Fixed bug #706
Sam Lantinga <slouken@libsdl.org>
parents: 4159
diff changeset
309 * If it returns 0, then the event will be dropped from the queue, but the
4c4113c2162c Fixed bug #706
Sam Lantinga <slouken@libsdl.org>
parents: 4159
diff changeset
310 * internal state will still be updated. This allows selective filtering of
4c4113c2162c Fixed bug #706
Sam Lantinga <slouken@libsdl.org>
parents: 4159
diff changeset
311 * dynamically arriving events.
4c4113c2162c Fixed bug #706
Sam Lantinga <slouken@libsdl.org>
parents: 4159
diff changeset
312 *
4c4113c2162c Fixed bug #706
Sam Lantinga <slouken@libsdl.org>
parents: 4159
diff changeset
313 * @warning Be very careful of what you do in the event filter function, as
4c4113c2162c Fixed bug #706
Sam Lantinga <slouken@libsdl.org>
parents: 4159
diff changeset
314 * it may run in a different thread!
4c4113c2162c Fixed bug #706
Sam Lantinga <slouken@libsdl.org>
parents: 4159
diff changeset
315 *
4c4113c2162c Fixed bug #706
Sam Lantinga <slouken@libsdl.org>
parents: 4159
diff changeset
316 * There is one caveat when dealing with the SDL_QUITEVENT event type. The
4c4113c2162c Fixed bug #706
Sam Lantinga <slouken@libsdl.org>
parents: 4159
diff changeset
317 * event filter is only called when the window manager desires to close the
4c4113c2162c Fixed bug #706
Sam Lantinga <slouken@libsdl.org>
parents: 4159
diff changeset
318 * application window. If the event filter returns 1, then the window will
4c4113c2162c Fixed bug #706
Sam Lantinga <slouken@libsdl.org>
parents: 4159
diff changeset
319 * be closed, otherwise the window will remain open if possible.
4c4113c2162c Fixed bug #706
Sam Lantinga <slouken@libsdl.org>
parents: 4159
diff changeset
320 * If the quit event is generated by an interrupt signal, it will bypass the
4c4113c2162c Fixed bug #706
Sam Lantinga <slouken@libsdl.org>
parents: 4159
diff changeset
321 * internal queue and be delivered to the application at the next event poll.
4c4113c2162c Fixed bug #706
Sam Lantinga <slouken@libsdl.org>
parents: 4159
diff changeset
322 */
337
9154ec9ca3d2 Explicitly specify the SDL API calling convention (C by default)
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
323 extern DECLSPEC void SDLCALL SDL_SetEventFilter(SDL_EventFilter filter);
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
324
4217
4c4113c2162c Fixed bug #706
Sam Lantinga <slouken@libsdl.org>
parents: 4159
diff changeset
325 /**
4c4113c2162c Fixed bug #706
Sam Lantinga <slouken@libsdl.org>
parents: 4159
diff changeset
326 * Return the current event filter - can be used to "chain" filters.
4c4113c2162c Fixed bug #706
Sam Lantinga <slouken@libsdl.org>
parents: 4159
diff changeset
327 * If there is no event filter set, this function returns NULL.
4c4113c2162c Fixed bug #706
Sam Lantinga <slouken@libsdl.org>
parents: 4159
diff changeset
328 */
337
9154ec9ca3d2 Explicitly specify the SDL API calling convention (C by default)
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
329 extern DECLSPEC SDL_EventFilter SDLCALL SDL_GetEventFilter(void);
4217
4c4113c2162c Fixed bug #706
Sam Lantinga <slouken@libsdl.org>
parents: 4159
diff changeset
330 /*@}*/
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
331
4217
4c4113c2162c Fixed bug #706
Sam Lantinga <slouken@libsdl.org>
parents: 4159
diff changeset
332 /** @name Event State */
4c4113c2162c Fixed bug #706
Sam Lantinga <slouken@libsdl.org>
parents: 4159
diff changeset
333 /*@{*/
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
334 #define SDL_QUERY -1
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
335 #define SDL_IGNORE 0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
336 #define SDL_DISABLE 0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
337 #define SDL_ENABLE 1
4217
4c4113c2162c Fixed bug #706
Sam Lantinga <slouken@libsdl.org>
parents: 4159
diff changeset
338 /*@}*/
4c4113c2162c Fixed bug #706
Sam Lantinga <slouken@libsdl.org>
parents: 4159
diff changeset
339
4c4113c2162c Fixed bug #706
Sam Lantinga <slouken@libsdl.org>
parents: 4159
diff changeset
340 /**
4c4113c2162c Fixed bug #706
Sam Lantinga <slouken@libsdl.org>
parents: 4159
diff changeset
341 * This function allows you to set the state of processing certain events.
4c4113c2162c Fixed bug #706
Sam Lantinga <slouken@libsdl.org>
parents: 4159
diff changeset
342 * If 'state' is set to SDL_IGNORE, that event will be automatically dropped
4c4113c2162c Fixed bug #706
Sam Lantinga <slouken@libsdl.org>
parents: 4159
diff changeset
343 * from the event queue and will not event be filtered.
4c4113c2162c Fixed bug #706
Sam Lantinga <slouken@libsdl.org>
parents: 4159
diff changeset
344 * If 'state' is set to SDL_ENABLE, that event will be processed normally.
4c4113c2162c Fixed bug #706
Sam Lantinga <slouken@libsdl.org>
parents: 4159
diff changeset
345 * If 'state' is set to SDL_QUERY, SDL_EventState() will return the
4c4113c2162c Fixed bug #706
Sam Lantinga <slouken@libsdl.org>
parents: 4159
diff changeset
346 * current processing state of the specified event.
4c4113c2162c Fixed bug #706
Sam Lantinga <slouken@libsdl.org>
parents: 4159
diff changeset
347 */
337
9154ec9ca3d2 Explicitly specify the SDL API calling convention (C by default)
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
348 extern DECLSPEC Uint8 SDLCALL SDL_EventState(Uint8 type, int state);
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
349
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
350 /* Ends C function definitions when using C++ */
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
351 #ifdef __cplusplus
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
352 }
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
353 #endif
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
354 #include "close_code.h"
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
355
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
356 #endif /* _SDL_events_h */