slouken@0
|
1 |
/*
|
slouken@0
|
2 |
SDL - Simple DirectMedia Layer
|
slouken@1312
|
3 |
Copyright (C) 1997-2006 Sam Lantinga
|
slouken@0
|
4 |
|
slouken@0
|
5 |
This library is free software; you can redistribute it and/or
|
slouken@1312
|
6 |
modify it under the terms of the GNU Lesser General Public
|
slouken@0
|
7 |
License as published by the Free Software Foundation; either
|
slouken@1312
|
8 |
version 2.1 of the License, or (at your option) any later version.
|
slouken@0
|
9 |
|
slouken@0
|
10 |
This library is distributed in the hope that it will be useful,
|
slouken@0
|
11 |
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
slouken@0
|
12 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
slouken@1312
|
13 |
Lesser General Public License for more details.
|
slouken@0
|
14 |
|
slouken@1312
|
15 |
You should have received a copy of the GNU Lesser General Public
|
slouken@1312
|
16 |
License along with this library; if not, write to the Free Software
|
slouken@1312
|
17 |
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
slouken@0
|
18 |
|
slouken@0
|
19 |
Sam Lantinga
|
slouken@251
|
20 |
slouken@libsdl.org
|
slouken@0
|
21 |
*/
|
slouken@0
|
22 |
|
slouken@1895
|
23 |
/**
|
slouken@1895
|
24 |
* \file SDL_events.h
|
slouken@1895
|
25 |
*
|
slouken@1895
|
26 |
* Include file for SDL event handling
|
slouken@1895
|
27 |
*/
|
slouken@0
|
28 |
|
slouken@0
|
29 |
#ifndef _SDL_events_h
|
slouken@0
|
30 |
#define _SDL_events_h
|
slouken@0
|
31 |
|
slouken@1356
|
32 |
#include "SDL_stdinc.h"
|
slouken@1358
|
33 |
#include "SDL_error.h"
|
slouken@1895
|
34 |
#include "SDL_video.h"
|
slouken@0
|
35 |
#include "SDL_keyboard.h"
|
slouken@0
|
36 |
#include "SDL_mouse.h"
|
slouken@0
|
37 |
#include "SDL_joystick.h"
|
slouken@0
|
38 |
#include "SDL_quit.h"
|
slouken@0
|
39 |
|
slouken@0
|
40 |
#include "begin_code.h"
|
slouken@0
|
41 |
/* Set up for C function definitions, even when using C++ */
|
slouken@0
|
42 |
#ifdef __cplusplus
|
slouken@1895
|
43 |
/* *INDENT-OFF* */
|
slouken@0
|
44 |
extern "C" {
|
slouken@1895
|
45 |
/* *INDENT-ON* */
|
slouken@0
|
46 |
#endif
|
slouken@0
|
47 |
|
slouken@1330
|
48 |
/* General keyboard/mouse state definitions */
|
slouken@1330
|
49 |
#define SDL_RELEASED 0
|
slouken@1330
|
50 |
#define SDL_PRESSED 1
|
slouken@1330
|
51 |
|
slouken@1895
|
52 |
/**
|
slouken@1895
|
53 |
* \enum SDL_EventType
|
slouken@1895
|
54 |
*
|
slouken@1895
|
55 |
* \brief The types of events that can be delivered
|
slouken@1895
|
56 |
*/
|
slouken@1895
|
57 |
typedef enum
|
slouken@1895
|
58 |
{
|
slouken@1895
|
59 |
SDL_NOEVENT = 0, /**< Unused (do not remove) */
|
slouken@1895
|
60 |
SDL_WINDOWEVENT, /**< Window state change */
|
slouken@1895
|
61 |
SDL_KEYDOWN, /**< Keys pressed */
|
slouken@1895
|
62 |
SDL_KEYUP, /**< Keys released */
|
slouken@1957
|
63 |
SDL_TEXTINPUT, /**< Keyboard text input */
|
slouken@1895
|
64 |
SDL_MOUSEMOTION, /**< Mouse moved */
|
slouken@1895
|
65 |
SDL_MOUSEBUTTONDOWN, /**< Mouse button pressed */
|
slouken@1895
|
66 |
SDL_MOUSEBUTTONUP, /**< Mouse button released */
|
slouken@1957
|
67 |
SDL_MOUSEWHEEL, /**< Mouse wheel motion */
|
slouken@1895
|
68 |
SDL_JOYAXISMOTION, /**< Joystick axis motion */
|
slouken@1895
|
69 |
SDL_JOYBALLMOTION, /**< Joystick trackball motion */
|
slouken@1895
|
70 |
SDL_JOYHATMOTION, /**< Joystick hat position change */
|
slouken@1895
|
71 |
SDL_JOYBUTTONDOWN, /**< Joystick button pressed */
|
slouken@1895
|
72 |
SDL_JOYBUTTONUP, /**< Joystick button released */
|
slouken@1895
|
73 |
SDL_QUIT, /**< User-requested quit */
|
slouken@1895
|
74 |
SDL_SYSWMEVENT, /**< System specific event */
|
kazeuser@3763
|
75 |
SDL_PROXIMITYIN, /**< Proximity In event */
|
kazeuser@3763
|
76 |
SDL_PROXIMITYOUT, /**< Proximity Out event */
|
slouken@1895
|
77 |
SDL_EVENT_RESERVED1, /**< Reserved for future use... */
|
kazeuser@3763
|
78 |
SDL_EVENT_RESERVED2,
|
kazeuser@3763
|
79 |
SDL_EVENT_RESERVED3,
|
slouken@1895
|
80 |
/* Events SDL_USEREVENT through SDL_MAXEVENTS-1 are for your use */
|
slouken@1895
|
81 |
SDL_USEREVENT = 24,
|
slouken@1895
|
82 |
/* This last event is only for bounding internal arrays
|
slouken@1895
|
83 |
It is the number of bits in the event mask datatype -- Uint32
|
slouken@1895
|
84 |
*/
|
slouken@1895
|
85 |
SDL_NUMEVENTS = 32
|
slouken@1294
|
86 |
} SDL_EventType;
|
slouken@0
|
87 |
|
slouken@1895
|
88 |
/**
|
slouken@1895
|
89 |
* \enum SDL_EventMask
|
slouken@1895
|
90 |
*
|
slouken@1895
|
91 |
* \brief Predefined event masks
|
slouken@1895
|
92 |
*/
|
slouken@0
|
93 |
#define SDL_EVENTMASK(X) (1<<(X))
|
slouken@1895
|
94 |
typedef enum
|
slouken@1895
|
95 |
{
|
slouken@1895
|
96 |
SDL_WINDOWEVENTMASK = SDL_EVENTMASK(SDL_WINDOWEVENT),
|
slouken@1895
|
97 |
SDL_KEYDOWNMASK = SDL_EVENTMASK(SDL_KEYDOWN),
|
slouken@1895
|
98 |
SDL_KEYUPMASK = SDL_EVENTMASK(SDL_KEYUP),
|
slouken@1895
|
99 |
SDL_KEYEVENTMASK = SDL_EVENTMASK(SDL_KEYDOWN) | SDL_EVENTMASK(SDL_KEYUP),
|
slouken@1895
|
100 |
SDL_TEXTINPUTMASK = SDL_EVENTMASK(SDL_TEXTINPUT),
|
slouken@1895
|
101 |
SDL_MOUSEMOTIONMASK = SDL_EVENTMASK(SDL_MOUSEMOTION),
|
slouken@1895
|
102 |
SDL_MOUSEBUTTONDOWNMASK = SDL_EVENTMASK(SDL_MOUSEBUTTONDOWN),
|
slouken@1895
|
103 |
SDL_MOUSEBUTTONUPMASK = SDL_EVENTMASK(SDL_MOUSEBUTTONUP),
|
slouken@1895
|
104 |
SDL_MOUSEWHEELMASK = SDL_EVENTMASK(SDL_MOUSEWHEEL),
|
slouken@1895
|
105 |
SDL_MOUSEEVENTMASK = SDL_EVENTMASK(SDL_MOUSEMOTION) |
|
slouken@1895
|
106 |
SDL_EVENTMASK(SDL_MOUSEBUTTONDOWN) | SDL_EVENTMASK(SDL_MOUSEBUTTONUP),
|
slouken@1895
|
107 |
SDL_JOYAXISMOTIONMASK = SDL_EVENTMASK(SDL_JOYAXISMOTION),
|
slouken@1895
|
108 |
SDL_JOYBALLMOTIONMASK = SDL_EVENTMASK(SDL_JOYBALLMOTION),
|
slouken@1895
|
109 |
SDL_JOYHATMOTIONMASK = SDL_EVENTMASK(SDL_JOYHATMOTION),
|
slouken@1895
|
110 |
SDL_JOYBUTTONDOWNMASK = SDL_EVENTMASK(SDL_JOYBUTTONDOWN),
|
slouken@1895
|
111 |
SDL_JOYBUTTONUPMASK = SDL_EVENTMASK(SDL_JOYBUTTONUP),
|
slouken@1895
|
112 |
SDL_JOYEVENTMASK = SDL_EVENTMASK(SDL_JOYAXISMOTION) |
|
slouken@1895
|
113 |
SDL_EVENTMASK(SDL_JOYBALLMOTION) |
|
slouken@1895
|
114 |
SDL_EVENTMASK(SDL_JOYHATMOTION) |
|
slouken@1895
|
115 |
SDL_EVENTMASK(SDL_JOYBUTTONDOWN) | SDL_EVENTMASK(SDL_JOYBUTTONUP),
|
slouken@1895
|
116 |
SDL_QUITMASK = SDL_EVENTMASK(SDL_QUIT),
|
kazeuser@3763
|
117 |
SDL_SYSWMEVENTMASK = SDL_EVENTMASK(SDL_SYSWMEVENT),
|
kazeuser@3763
|
118 |
SDL_PROXIMITYINMASK = SDL_EVENTMASK(SDL_PROXIMITYIN),
|
kazeuser@3763
|
119 |
SDL_PROXIMITYOUTMASK = SDL_EVENTMASK(SDL_PROXIMITYOUT)
|
slouken@1895
|
120 |
} SDL_EventMask;
|
slouken@0
|
121 |
#define SDL_ALLEVENTS 0xFFFFFFFF
|
slouken@0
|
122 |
|
slouken@1895
|
123 |
/**
|
slouken@1895
|
124 |
* \struct SDL_WindowEvent
|
slouken@1895
|
125 |
*
|
slouken@1914
|
126 |
* \brief Window state change event data (event.window.*)
|
slouken@1895
|
127 |
*/
|
slouken@1895
|
128 |
typedef struct SDL_WindowEvent
|
slouken@1895
|
129 |
{
|
slouken@1895
|
130 |
Uint8 type; /**< SDL_WINDOWEVENT */
|
slouken@1895
|
131 |
Uint8 event; /**< SDL_WindowEventID */
|
slouken@1895
|
132 |
int data1; /**< event dependent data */
|
slouken@1895
|
133 |
int data2; /**< event dependent data */
|
slouken@1895
|
134 |
SDL_WindowID windowID; /**< The associated window */
|
slouken@1895
|
135 |
} SDL_WindowEvent;
|
slouken@0
|
136 |
|
slouken@1895
|
137 |
/**
|
slouken@1895
|
138 |
* \struct SDL_KeyboardEvent
|
slouken@1895
|
139 |
*
|
slouken@1914
|
140 |
* \brief Keyboard button event structure (event.key.*)
|
slouken@1895
|
141 |
*/
|
slouken@1895
|
142 |
typedef struct SDL_KeyboardEvent
|
slouken@1895
|
143 |
{
|
slouken@1895
|
144 |
Uint8 type; /**< SDL_KEYDOWN or SDL_KEYUP */
|
slouken@1895
|
145 |
Uint8 which; /**< The keyboard device index */
|
slouken@1895
|
146 |
Uint8 state; /**< SDL_PRESSED or SDL_RELEASED */
|
slouken@1895
|
147 |
SDL_keysym keysym; /**< The key that was pressed or released */
|
slouken@1895
|
148 |
SDL_WindowID windowID; /**< The window with keyboard focus, if any */
|
slouken@0
|
149 |
} SDL_KeyboardEvent;
|
slouken@0
|
150 |
|
slouken@1895
|
151 |
/**
|
slouken@1895
|
152 |
* \struct SDL_TextInputEvent
|
slouken@1895
|
153 |
*
|
slouken@1914
|
154 |
* \brief Keyboard text input event structure (event.text.*)
|
slouken@1895
|
155 |
*/
|
bob@2300
|
156 |
#define SDL_TEXTINPUTEVENT_TEXT_SIZE (32)
|
slouken@1895
|
157 |
typedef struct SDL_TextInputEvent
|
slouken@1895
|
158 |
{
|
bob@2300
|
159 |
Uint8 type; /**< SDL_TEXTINPUT */
|
bob@2300
|
160 |
Uint8 which; /**< The keyboard device index */
|
bob@2300
|
161 |
char text[SDL_TEXTINPUTEVENT_TEXT_SIZE]; /**< The input text */
|
bob@2300
|
162 |
SDL_WindowID windowID; /**< The window with keyboard focus, if any */
|
slouken@1895
|
163 |
} SDL_TextInputEvent;
|
slouken@1895
|
164 |
|
slouken@1895
|
165 |
/**
|
slouken@1895
|
166 |
* \struct SDL_MouseMotionEvent
|
slouken@1895
|
167 |
*
|
slouken@1914
|
168 |
* \brief Mouse motion event structure (event.motion.*)
|
slouken@1895
|
169 |
*/
|
slouken@1895
|
170 |
typedef struct SDL_MouseMotionEvent
|
slouken@1895
|
171 |
{
|
slouken@1895
|
172 |
Uint8 type; /**< SDL_MOUSEMOTION */
|
slouken@1895
|
173 |
Uint8 which; /**< The mouse device index */
|
slouken@1895
|
174 |
Uint8 state; /**< The current button state */
|
slouken@1895
|
175 |
int x; /**< X coordinate, relative to window */
|
slouken@1895
|
176 |
int y; /**< Y coordinate, relative to window */
|
kazeuser@3765
|
177 |
int z; /**< Z coordinate, for future use*/
|
kazeuser@3765
|
178 |
int pressure; /**< Pressure reported by tablets */
|
kazeuser@3766
|
179 |
int pressure_max; /**< Maximum value of the pressure reported by the device*/
|
kazeuser@3766
|
180 |
int pressure_min; /**< Minimum value of the pressure reported by the device*/
|
kazeuser@3765
|
181 |
int rotation; /**<For future use */
|
kazeuser@3765
|
182 |
int tilt; /**<For future use */
|
slouken@1895
|
183 |
int xrel; /**< The relative motion in the X direction */
|
slouken@1895
|
184 |
int yrel; /**< The relative motion in the Y direction */
|
slouken@1895
|
185 |
SDL_WindowID windowID; /**< The window with mouse focus, if any */
|
slouken@0
|
186 |
} SDL_MouseMotionEvent;
|
slouken@0
|
187 |
|
slouken@1895
|
188 |
/**
|
slouken@1895
|
189 |
* \struct SDL_MouseButtonEvent
|
slouken@1895
|
190 |
*
|
slouken@1914
|
191 |
* \brief Mouse button event structure (event.button.*)
|
slouken@1895
|
192 |
*/
|
slouken@1895
|
193 |
typedef struct SDL_MouseButtonEvent
|
slouken@1895
|
194 |
{
|
slouken@1895
|
195 |
Uint8 type; /**< SDL_MOUSEBUTTONDOWN or SDL_MOUSEBUTTONUP */
|
slouken@1895
|
196 |
Uint8 which; /**< The mouse device index */
|
slouken@1895
|
197 |
Uint8 button; /**< The mouse button index */
|
slouken@1895
|
198 |
Uint8 state; /**< SDL_PRESSED or SDL_RELEASED */
|
slouken@1895
|
199 |
int x; /**< X coordinate, relative to window */
|
slouken@1895
|
200 |
int y; /**< Y coordinate, relative to window */
|
slouken@1895
|
201 |
SDL_WindowID windowID; /**< The window with mouse focus, if any */
|
slouken@0
|
202 |
} SDL_MouseButtonEvent;
|
slouken@0
|
203 |
|
slouken@1895
|
204 |
/**
|
slouken@1895
|
205 |
* \struct SDL_MouseWheelEvent
|
slouken@1895
|
206 |
*
|
slouken@1914
|
207 |
* \brief Mouse wheel event structure (event.wheel.*)
|
slouken@1895
|
208 |
*/
|
slouken@1895
|
209 |
typedef struct SDL_MouseWheelEvent
|
slouken@1895
|
210 |
{
|
slouken@1895
|
211 |
Uint8 type; /**< SDL_MOUSEWHEEL */
|
slouken@1895
|
212 |
Uint8 which; /**< The mouse device index */
|
slouken@2152
|
213 |
int x; /**< The amount scrolled horizontally */
|
slouken@2152
|
214 |
int y; /**< The amount scrolled vertically */
|
slouken@1895
|
215 |
SDL_WindowID windowID; /**< The window with mouse focus, if any */
|
slouken@1895
|
216 |
} SDL_MouseWheelEvent;
|
slouken@1895
|
217 |
|
slouken@1895
|
218 |
/**
|
slouken@1895
|
219 |
* \struct SDL_JoyAxisEvent
|
slouken@1895
|
220 |
*
|
slouken@1914
|
221 |
* \brief Joystick axis motion event structure (event.jaxis.*)
|
slouken@1895
|
222 |
*/
|
slouken@1895
|
223 |
typedef struct SDL_JoyAxisEvent
|
slouken@1895
|
224 |
{
|
slouken@1895
|
225 |
Uint8 type; /**< SDL_JOYAXISMOTION */
|
slouken@1895
|
226 |
Uint8 which; /**< The joystick device index */
|
slouken@1895
|
227 |
Uint8 axis; /**< The joystick axis index */
|
slouken@1895
|
228 |
int value; /**< The axis value (range: -32768 to 32767) */
|
slouken@0
|
229 |
} SDL_JoyAxisEvent;
|
slouken@0
|
230 |
|
slouken@1895
|
231 |
/**
|
slouken@1895
|
232 |
* \struct SDL_JoyBallEvent
|
slouken@1895
|
233 |
*
|
slouken@1914
|
234 |
* \brief Joystick trackball motion event structure (event.jball.*)
|
slouken@1895
|
235 |
*/
|
slouken@1895
|
236 |
typedef struct SDL_JoyBallEvent
|
slouken@1895
|
237 |
{
|
slouken@1895
|
238 |
Uint8 type; /**< SDL_JOYBALLMOTION */
|
slouken@1895
|
239 |
Uint8 which; /**< The joystick device index */
|
slouken@1895
|
240 |
Uint8 ball; /**< The joystick trackball index */
|
slouken@1895
|
241 |
int xrel; /**< The relative motion in the X direction */
|
slouken@1895
|
242 |
int yrel; /**< The relative motion in the Y direction */
|
slouken@0
|
243 |
} SDL_JoyBallEvent;
|
slouken@0
|
244 |
|
slouken@1895
|
245 |
/**
|
slouken@1895
|
246 |
* \struct SDL_JoyHatEvent
|
slouken@1895
|
247 |
*
|
slouken@1914
|
248 |
* \brief Joystick hat position change event structure (event.jhat.*)
|
slouken@1895
|
249 |
*/
|
slouken@1895
|
250 |
typedef struct SDL_JoyHatEvent
|
slouken@1895
|
251 |
{
|
slouken@1895
|
252 |
Uint8 type; /**< SDL_JOYHATMOTION */
|
slouken@1895
|
253 |
Uint8 which; /**< The joystick device index */
|
slouken@1895
|
254 |
Uint8 hat; /**< The joystick hat index */
|
slouken@1895
|
255 |
Uint8 value; /**< The hat position value:
|
slouken@1895
|
256 |
SDL_HAT_LEFTUP SDL_HAT_UP SDL_HAT_RIGHTUP
|
slouken@1895
|
257 |
SDL_HAT_LEFT SDL_HAT_CENTERED SDL_HAT_RIGHT
|
slouken@1895
|
258 |
SDL_HAT_LEFTDOWN SDL_HAT_DOWN SDL_HAT_RIGHTDOWN
|
slouken@1895
|
259 |
Note that zero means the POV is centered.
|
slouken@1895
|
260 |
*/
|
slouken@0
|
261 |
} SDL_JoyHatEvent;
|
slouken@0
|
262 |
|
slouken@1895
|
263 |
/**
|
slouken@1895
|
264 |
* \struct SDL_JoyButtonEvent
|
slouken@1895
|
265 |
*
|
slouken@1914
|
266 |
* \brief Joystick button event structure (event.jbutton.*)
|
slouken@1895
|
267 |
*/
|
slouken@1895
|
268 |
typedef struct SDL_JoyButtonEvent
|
slouken@1895
|
269 |
{
|
slouken@1895
|
270 |
Uint8 type; /**< SDL_JOYBUTTONDOWN or SDL_JOYBUTTONUP */
|
slouken@1895
|
271 |
Uint8 which; /**< The joystick device index */
|
slouken@1895
|
272 |
Uint8 button; /**< The joystick button index */
|
slouken@1895
|
273 |
Uint8 state; /**< SDL_PRESSED or SDL_RELEASED */
|
slouken@0
|
274 |
} SDL_JoyButtonEvent;
|
slouken@0
|
275 |
|
slouken@1895
|
276 |
/**
|
slouken@1895
|
277 |
* \struct SDL_QuitEvent
|
slouken@1895
|
278 |
*
|
slouken@1895
|
279 |
* \brief The "quit requested" event
|
slouken@0
|
280 |
*/
|
slouken@1895
|
281 |
typedef struct SDL_QuitEvent
|
slouken@1895
|
282 |
{
|
slouken@1895
|
283 |
Uint8 type; /**< SDL_QUIT */
|
slouken@0
|
284 |
} SDL_QuitEvent;
|
slouken@0
|
285 |
|
slouken@1895
|
286 |
/**
|
slouken@1895
|
287 |
* \struct SDL_UserEvent
|
slouken@1895
|
288 |
*
|
slouken@1914
|
289 |
* \brief A user-defined event type (event.user.*)
|
slouken@1895
|
290 |
*/
|
slouken@1895
|
291 |
typedef struct SDL_UserEvent
|
slouken@1895
|
292 |
{
|
bob@2131
|
293 |
Uint8 type; /**< SDL_USEREVENT through SDL_NUMEVENTS-1 */
|
bob@2131
|
294 |
int code; /**< User defined event code */
|
bob@2131
|
295 |
void *data1; /**< User defined data pointer */
|
bob@2131
|
296 |
void *data2; /**< User defined data pointer */
|
bob@2131
|
297 |
SDL_WindowID windowID; /**< The associated window if any*/
|
slouken@0
|
298 |
} SDL_UserEvent;
|
slouken@0
|
299 |
|
slouken@1895
|
300 |
/**
|
slouken@1895
|
301 |
* \struct SDL_SysWMEvent
|
slouken@1895
|
302 |
*
|
slouken@1914
|
303 |
* \brief A video driver dependent system event (event.syswm.*)
|
slouken@1895
|
304 |
*
|
slouken@1895
|
305 |
* \note If you want to use this event, you should include SDL_syswm.h
|
slouken@1895
|
306 |
*/
|
slouken@0
|
307 |
struct SDL_SysWMmsg;
|
slouken@0
|
308 |
typedef struct SDL_SysWMmsg SDL_SysWMmsg;
|
slouken@1895
|
309 |
typedef struct SDL_SysWMEvent
|
slouken@1895
|
310 |
{
|
slouken@1895
|
311 |
Uint8 type; /**< SDL_SYSWMEVENT */
|
slouken@1895
|
312 |
SDL_SysWMmsg *msg; /**< driver dependent data, defined in SDL_syswm.h */
|
slouken@0
|
313 |
} SDL_SysWMEvent;
|
slouken@0
|
314 |
|
slouken@1895
|
315 |
/* Typedefs for backwards compatibility */
|
slouken@1895
|
316 |
typedef struct SDL_ActiveEvent
|
slouken@1895
|
317 |
{
|
slouken@1895
|
318 |
Uint8 type;
|
slouken@1895
|
319 |
Uint8 gain;
|
slouken@1895
|
320 |
Uint8 state;
|
slouken@1895
|
321 |
} SDL_ActiveEvent;
|
slouken@1895
|
322 |
typedef struct SDL_ResizeEvent
|
slouken@1895
|
323 |
{
|
slouken@1895
|
324 |
Uint8 type;
|
slouken@1895
|
325 |
int w;
|
slouken@1895
|
326 |
int h;
|
slouken@1895
|
327 |
} SDL_ResizeEvent;
|
slouken@1895
|
328 |
|
kazeuser@3763
|
329 |
typedef struct SDL_ProximityEvent
|
kazeuser@3763
|
330 |
{
|
kazeuser@3763
|
331 |
Uint8 which;
|
kazeuser@3763
|
332 |
Uint8 type;
|
kazeuser@3763
|
333 |
int x;
|
kazeuser@3763
|
334 |
int y;
|
kazeuser@3763
|
335 |
} SDL_ProximityEvent;
|
kazeuser@3763
|
336 |
|
slouken@1895
|
337 |
/**
|
slouken@1895
|
338 |
* \union SDL_Event
|
slouken@1895
|
339 |
*
|
slouken@1895
|
340 |
* \brief General event structure
|
slouken@1895
|
341 |
*/
|
slouken@1895
|
342 |
typedef union SDL_Event
|
slouken@1895
|
343 |
{
|
slouken@1895
|
344 |
Uint8 type; /**< Event type, shared with all events */
|
slouken@1895
|
345 |
SDL_WindowEvent window; /**< Window event data */
|
slouken@1895
|
346 |
SDL_KeyboardEvent key; /**< Keyboard event data */
|
bob@2300
|
347 |
SDL_TextInputEvent text; /**< Text input event data */
|
slouken@1895
|
348 |
SDL_MouseMotionEvent motion; /**< Mouse motion event data */
|
slouken@1895
|
349 |
SDL_MouseButtonEvent button; /**< Mouse button event data */
|
bob@2300
|
350 |
SDL_MouseWheelEvent wheel; /**< Mouse wheel event data */
|
slouken@1895
|
351 |
SDL_JoyAxisEvent jaxis; /**< Joystick axis event data */
|
slouken@1895
|
352 |
SDL_JoyBallEvent jball; /**< Joystick ball event data */
|
slouken@1895
|
353 |
SDL_JoyHatEvent jhat; /**< Joystick hat event data */
|
slouken@1895
|
354 |
SDL_JoyButtonEvent jbutton; /**< Joystick button event data */
|
slouken@1895
|
355 |
SDL_QuitEvent quit; /**< Quit request event data */
|
slouken@1895
|
356 |
SDL_UserEvent user; /**< Custom event data */
|
slouken@1895
|
357 |
SDL_SysWMEvent syswm; /**< System dependent window event data */
|
kazeuser@3763
|
358 |
SDL_ProximityEvent proximity; /**< Proximity In or Out event */
|
slouken@1895
|
359 |
/* Temporarily here for backwards compatibility */
|
slouken@1895
|
360 |
SDL_ActiveEvent active;
|
slouken@1895
|
361 |
SDL_ResizeEvent resize;
|
slouken@0
|
362 |
} SDL_Event;
|
slouken@0
|
363 |
|
slouken@0
|
364 |
|
slouken@0
|
365 |
/* Function prototypes */
|
slouken@0
|
366 |
|
slouken@0
|
367 |
/* Pumps the event loop, gathering events from the input devices.
|
slouken@0
|
368 |
This function updates the event queue and internal input device state.
|
slouken@0
|
369 |
This should only be run in the thread that sets the video mode.
|
slouken@0
|
370 |
*/
|
slouken@337
|
371 |
extern DECLSPEC void SDLCALL SDL_PumpEvents(void);
|
slouken@0
|
372 |
|
slouken@0
|
373 |
/* Checks the event queue for messages and optionally returns them.
|
slouken@0
|
374 |
If 'action' is SDL_ADDEVENT, up to 'numevents' events will be added to
|
slouken@0
|
375 |
the back of the event queue.
|
slouken@0
|
376 |
If 'action' is SDL_PEEKEVENT, up to 'numevents' events at the front
|
slouken@0
|
377 |
of the event queue, matching 'mask', will be returned and will not
|
slouken@0
|
378 |
be removed from the queue.
|
slouken@0
|
379 |
If 'action' is SDL_GETEVENT, up to 'numevents' events at the front
|
slouken@0
|
380 |
of the event queue, matching 'mask', will be returned and will be
|
slouken@0
|
381 |
removed from the queue.
|
slouken@0
|
382 |
This function returns the number of events actually stored, or -1
|
slouken@0
|
383 |
if there was an error. This function is thread-safe.
|
slouken@0
|
384 |
*/
|
slouken@1895
|
385 |
typedef enum
|
slouken@1895
|
386 |
{
|
slouken@1895
|
387 |
SDL_ADDEVENT,
|
slouken@1895
|
388 |
SDL_PEEKEVENT,
|
slouken@1895
|
389 |
SDL_GETEVENT
|
slouken@0
|
390 |
} SDL_eventaction;
|
slouken@0
|
391 |
/* */
|
slouken@1895
|
392 |
extern DECLSPEC int SDLCALL SDL_PeepEvents(SDL_Event * events, int numevents,
|
slouken@1895
|
393 |
SDL_eventaction action,
|
slouken@1895
|
394 |
Uint32 mask);
|
slouken@1895
|
395 |
|
slouken@1895
|
396 |
/* Checks to see if certain event types are in the event queue.
|
slouken@1895
|
397 |
*/
|
slouken@1895
|
398 |
extern DECLSPEC SDL_bool SDLCALL SDL_HasEvent(Uint32 mask);
|
slouken@0
|
399 |
|
slouken@0
|
400 |
/* Polls for currently pending events, and returns 1 if there are any pending
|
slouken@0
|
401 |
events, or 0 if there are none available. If 'event' is not NULL, the next
|
slouken@0
|
402 |
event is removed from the queue and stored in that area.
|
slouken@0
|
403 |
*/
|
slouken@1895
|
404 |
extern DECLSPEC int SDLCALL SDL_PollEvent(SDL_Event * event);
|
slouken@0
|
405 |
|
slouken@0
|
406 |
/* Waits indefinitely for the next available event, returning 1, or 0 if there
|
slouken@0
|
407 |
was an error while waiting for events. If 'event' is not NULL, the next
|
slouken@0
|
408 |
event is removed from the queue and stored in that area.
|
slouken@0
|
409 |
*/
|
slouken@1895
|
410 |
extern DECLSPEC int SDLCALL SDL_WaitEvent(SDL_Event * event);
|
slouken@0
|
411 |
|
slouken@0
|
412 |
/* Add an event to the event queue.
|
slouken@1895
|
413 |
This function returns 1 on success, 0 if the event was filtered,
|
slouken@1895
|
414 |
or -1 if the event queue was full or there was some other error.
|
slouken@0
|
415 |
*/
|
slouken@1895
|
416 |
extern DECLSPEC int SDLCALL SDL_PushEvent(SDL_Event * event);
|
slouken@0
|
417 |
|
slouken@0
|
418 |
/*
|
slouken@0
|
419 |
This function sets up a filter to process all events before they
|
slouken@0
|
420 |
change internal state and are posted to the internal event queue.
|
slouken@0
|
421 |
|
slouken@0
|
422 |
The filter is protypted as:
|
slouken@0
|
423 |
*/
|
slouken@1895
|
424 |
typedef int (SDLCALL * SDL_EventFilter) (void *userdata, SDL_Event * event);
|
slouken@0
|
425 |
/*
|
slouken@0
|
426 |
If the filter returns 1, then the event will be added to the internal queue.
|
slouken@0
|
427 |
If it returns 0, then the event will be dropped from the queue, but the
|
slouken@0
|
428 |
internal state will still be updated. This allows selective filtering of
|
slouken@0
|
429 |
dynamically arriving events.
|
slouken@0
|
430 |
|
slouken@0
|
431 |
WARNING: Be very careful of what you do in the event filter function, as
|
slouken@0
|
432 |
it may run in a different thread!
|
slouken@0
|
433 |
|
slouken@0
|
434 |
There is one caveat when dealing with the SDL_QUITEVENT event type. The
|
slouken@0
|
435 |
event filter is only called when the window manager desires to close the
|
slouken@0
|
436 |
application window. If the event filter returns 1, then the window will
|
slouken@0
|
437 |
be closed, otherwise the window will remain open if possible.
|
slouken@0
|
438 |
If the quit event is generated by an interrupt signal, it will bypass the
|
slouken@0
|
439 |
internal queue and be delivered to the application at the next event poll.
|
slouken@0
|
440 |
*/
|
slouken@1895
|
441 |
extern DECLSPEC void SDLCALL SDL_SetEventFilter(SDL_EventFilter filter,
|
slouken@1895
|
442 |
void *userdata);
|
slouken@0
|
443 |
|
slouken@0
|
444 |
/*
|
slouken@0
|
445 |
Return the current event filter - can be used to "chain" filters.
|
slouken@1895
|
446 |
If there is no event filter set, this function returns SDL_FALSE.
|
slouken@0
|
447 |
*/
|
slouken@1895
|
448 |
extern DECLSPEC SDL_bool SDLCALL SDL_GetEventFilter(SDL_EventFilter * filter,
|
slouken@1895
|
449 |
void **userdata);
|
slouken@1895
|
450 |
|
slouken@1895
|
451 |
/*
|
slouken@1895
|
452 |
Run the filter function on the current event queue, removing any
|
slouken@1895
|
453 |
events for which the filter returns 0.
|
slouken@1895
|
454 |
*/
|
slouken@1895
|
455 |
extern DECLSPEC void SDLCALL SDL_FilterEvents(SDL_EventFilter filter,
|
slouken@1895
|
456 |
void *userdata);
|
slouken@0
|
457 |
|
slouken@0
|
458 |
/*
|
slouken@0
|
459 |
This function allows you to set the state of processing certain events.
|
slouken@0
|
460 |
If 'state' is set to SDL_IGNORE, that event will be automatically dropped
|
slouken@0
|
461 |
from the event queue and will not event be filtered.
|
slouken@0
|
462 |
If 'state' is set to SDL_ENABLE, that event will be processed normally.
|
slouken@0
|
463 |
If 'state' is set to SDL_QUERY, SDL_EventState() will return the
|
slouken@0
|
464 |
current processing state of the specified event.
|
slouken@0
|
465 |
*/
|
slouken@0
|
466 |
#define SDL_QUERY -1
|
slouken@0
|
467 |
#define SDL_IGNORE 0
|
slouken@0
|
468 |
#define SDL_DISABLE 0
|
slouken@0
|
469 |
#define SDL_ENABLE 1
|
slouken@337
|
470 |
extern DECLSPEC Uint8 SDLCALL SDL_EventState(Uint8 type, int state);
|
slouken@0
|
471 |
|
slouken@0
|
472 |
|
slouken@0
|
473 |
/* Ends C function definitions when using C++ */
|
slouken@0
|
474 |
#ifdef __cplusplus
|
slouken@1895
|
475 |
/* *INDENT-OFF* */
|
slouken@0
|
476 |
}
|
slouken@1895
|
477 |
/* *INDENT-ON* */
|
slouken@0
|
478 |
#endif
|
slouken@0
|
479 |
#include "close_code.h"
|
slouken@0
|
480 |
|
slouken@0
|
481 |
#endif /* _SDL_events_h */
|
slouken@1895
|
482 |
|
slouken@1895
|
483 |
/* vi: set ts=4 sw=4 expandtab: */
|