Mercurial > sdl-ios-xcode
comparison include/SDL_events.h @ 1662:782fd950bd46 SDL-1.3
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
WARNING: None of the video drivers have been updated for the new API yet! The API is still under design and very fluid.
The code is now run through a consistent indent format:
indent -i4 -nut -nsc -br -ce
The headers are being converted to automatically generate doxygen documentation.
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Sun, 28 May 2006 13:04:16 +0000 |
parents | c71e05b4dc2e |
children | 4da1ee79c9af |
comparison
equal
deleted
inserted
replaced
1661:281d3f4870e5 | 1662:782fd950bd46 |
---|---|
18 | 18 |
19 Sam Lantinga | 19 Sam Lantinga |
20 slouken@libsdl.org | 20 slouken@libsdl.org |
21 */ | 21 */ |
22 | 22 |
23 /* Include file for SDL event handling */ | 23 /** |
24 * \file SDL_events.h | |
25 * | |
26 * Include file for SDL event handling | |
27 */ | |
24 | 28 |
25 #ifndef _SDL_events_h | 29 #ifndef _SDL_events_h |
26 #define _SDL_events_h | 30 #define _SDL_events_h |
27 | 31 |
28 #include "SDL_stdinc.h" | 32 #include "SDL_stdinc.h" |
29 #include "SDL_error.h" | 33 #include "SDL_error.h" |
30 #include "SDL_active.h" | 34 #include "SDL_video.h" |
31 #include "SDL_keyboard.h" | 35 #include "SDL_keyboard.h" |
32 #include "SDL_mouse.h" | 36 #include "SDL_mouse.h" |
33 #include "SDL_joystick.h" | 37 #include "SDL_joystick.h" |
34 #include "SDL_quit.h" | 38 #include "SDL_quit.h" |
35 | 39 |
36 #include "begin_code.h" | 40 #include "begin_code.h" |
37 /* Set up for C function definitions, even when using C++ */ | 41 /* Set up for C function definitions, even when using C++ */ |
38 #ifdef __cplusplus | 42 #ifdef __cplusplus |
43 /* *INDENT-OFF* */ | |
39 extern "C" { | 44 extern "C" { |
45 /* *INDENT-ON* */ | |
40 #endif | 46 #endif |
41 | 47 |
42 /* General keyboard/mouse state definitions */ | 48 /* General keyboard/mouse state definitions */ |
43 #define SDL_RELEASED 0 | 49 #define SDL_RELEASED 0 |
44 #define SDL_PRESSED 1 | 50 #define SDL_PRESSED 1 |
45 | 51 |
46 /* Event enumerations */ | 52 /** |
47 typedef enum { | 53 * \enum SDL_EventType |
48 SDL_NOEVENT = 0, /* Unused (do not remove) */ | 54 * |
49 SDL_ACTIVEEVENT, /* Application loses/gains visibility */ | 55 * \brief The types of events that can be delivered |
50 SDL_KEYDOWN, /* Keys pressed */ | 56 */ |
51 SDL_KEYUP, /* Keys released */ | 57 typedef enum |
52 SDL_MOUSEMOTION, /* Mouse moved */ | 58 { |
53 SDL_MOUSEBUTTONDOWN, /* Mouse button pressed */ | 59 SDL_NOEVENT = 0, /**< Unused (do not remove) */ |
54 SDL_MOUSEBUTTONUP, /* Mouse button released */ | 60 SDL_WINDOWEVENT, /**< Window state change */ |
55 SDL_JOYAXISMOTION, /* Joystick axis motion */ | 61 SDL_KEYDOWN, /**< Keys pressed */ |
56 SDL_JOYBALLMOTION, /* Joystick trackball motion */ | 62 SDL_KEYUP, /**< Keys released */ |
57 SDL_JOYHATMOTION, /* Joystick hat position change */ | 63 SDL_MOUSEMOTION, /**< Mouse moved */ |
58 SDL_JOYBUTTONDOWN, /* Joystick button pressed */ | 64 SDL_MOUSEBUTTONDOWN, /**< Mouse button pressed */ |
59 SDL_JOYBUTTONUP, /* Joystick button released */ | 65 SDL_MOUSEBUTTONUP, /**< Mouse button released */ |
60 SDL_QUIT, /* User-requested quit */ | 66 SDL_JOYAXISMOTION, /**< Joystick axis motion */ |
61 SDL_SYSWMEVENT, /* System specific event */ | 67 SDL_JOYBALLMOTION, /**< Joystick trackball motion */ |
62 SDL_EVENT_RESERVEDA, /* Reserved for future use.. */ | 68 SDL_JOYHATMOTION, /**< Joystick hat position change */ |
63 SDL_EVENT_RESERVEDB, /* Reserved for future use.. */ | 69 SDL_JOYBUTTONDOWN, /**< Joystick button pressed */ |
64 SDL_VIDEORESIZE, /* User resized video mode */ | 70 SDL_JOYBUTTONUP, /**< Joystick button released */ |
65 SDL_VIDEOEXPOSE, /* Screen needs to be redrawn */ | 71 SDL_QUIT, /**< User-requested quit */ |
66 SDL_EVENT_RESERVED2, /* Reserved for future use.. */ | 72 SDL_SYSWMEVENT, /**< System specific event */ |
67 SDL_EVENT_RESERVED3, /* Reserved for future use.. */ | 73 SDL_EVENT_RESERVED1, /**< Reserved for future use... */ |
68 SDL_EVENT_RESERVED4, /* Reserved for future use.. */ | 74 SDL_EVENT_RESERVED2, /**< Reserved for future use... */ |
69 SDL_EVENT_RESERVED5, /* Reserved for future use.. */ | 75 SDL_EVENT_RESERVED3, /**< Reserved for future use... */ |
70 SDL_EVENT_RESERVED6, /* Reserved for future use.. */ | 76 /* Events SDL_USEREVENT through SDL_MAXEVENTS-1 are for your use */ |
71 SDL_EVENT_RESERVED7, /* Reserved for future use.. */ | 77 SDL_USEREVENT = 24, |
72 /* Events SDL_USEREVENT through SDL_MAXEVENTS-1 are for your use */ | 78 /* This last event is only for bounding internal arrays |
73 SDL_USEREVENT = 24, | 79 It is the number of bits in the event mask datatype -- Uint32 |
74 /* This last event is only for bounding internal arrays | 80 */ |
75 It is the number of bits in the event mask datatype -- Uint32 | 81 SDL_NUMEVENTS = 32 |
76 */ | |
77 SDL_NUMEVENTS = 32 | |
78 } SDL_EventType; | 82 } SDL_EventType; |
79 | 83 |
80 /* Predefined event masks */ | 84 /** |
85 * \enum SDL_EventMask | |
86 * | |
87 * \brief Predefined event masks | |
88 */ | |
81 #define SDL_EVENTMASK(X) (1<<(X)) | 89 #define SDL_EVENTMASK(X) (1<<(X)) |
82 typedef enum { | 90 typedef enum |
83 SDL_ACTIVEEVENTMASK = SDL_EVENTMASK(SDL_ACTIVEEVENT), | 91 { |
84 SDL_KEYDOWNMASK = SDL_EVENTMASK(SDL_KEYDOWN), | 92 SDL_WINDOWEVENTMASK = SDL_EVENTMASK (SDL_WINDOWEVENT), |
85 SDL_KEYUPMASK = SDL_EVENTMASK(SDL_KEYUP), | 93 SDL_KEYDOWNMASK = SDL_EVENTMASK (SDL_KEYDOWN), |
86 SDL_KEYEVENTMASK = SDL_EVENTMASK(SDL_KEYDOWN)| | 94 SDL_KEYUPMASK = SDL_EVENTMASK (SDL_KEYUP), |
87 SDL_EVENTMASK(SDL_KEYUP), | 95 SDL_KEYEVENTMASK = SDL_EVENTMASK (SDL_KEYDOWN) | |
88 SDL_MOUSEMOTIONMASK = SDL_EVENTMASK(SDL_MOUSEMOTION), | 96 SDL_EVENTMASK (SDL_KEYUP), |
89 SDL_MOUSEBUTTONDOWNMASK = SDL_EVENTMASK(SDL_MOUSEBUTTONDOWN), | 97 SDL_MOUSEMOTIONMASK = SDL_EVENTMASK (SDL_MOUSEMOTION), |
90 SDL_MOUSEBUTTONUPMASK = SDL_EVENTMASK(SDL_MOUSEBUTTONUP), | 98 SDL_MOUSEBUTTONDOWNMASK = SDL_EVENTMASK (SDL_MOUSEBUTTONDOWN), |
91 SDL_MOUSEEVENTMASK = SDL_EVENTMASK(SDL_MOUSEMOTION)| | 99 SDL_MOUSEBUTTONUPMASK = SDL_EVENTMASK (SDL_MOUSEBUTTONUP), |
92 SDL_EVENTMASK(SDL_MOUSEBUTTONDOWN)| | 100 SDL_MOUSEEVENTMASK = SDL_EVENTMASK (SDL_MOUSEMOTION) | |
93 SDL_EVENTMASK(SDL_MOUSEBUTTONUP), | 101 SDL_EVENTMASK (SDL_MOUSEBUTTONDOWN) | |
94 SDL_JOYAXISMOTIONMASK = SDL_EVENTMASK(SDL_JOYAXISMOTION), | 102 SDL_EVENTMASK (SDL_MOUSEBUTTONUP), |
95 SDL_JOYBALLMOTIONMASK = SDL_EVENTMASK(SDL_JOYBALLMOTION), | 103 SDL_JOYAXISMOTIONMASK = SDL_EVENTMASK (SDL_JOYAXISMOTION), |
96 SDL_JOYHATMOTIONMASK = SDL_EVENTMASK(SDL_JOYHATMOTION), | 104 SDL_JOYBALLMOTIONMASK = SDL_EVENTMASK (SDL_JOYBALLMOTION), |
97 SDL_JOYBUTTONDOWNMASK = SDL_EVENTMASK(SDL_JOYBUTTONDOWN), | 105 SDL_JOYHATMOTIONMASK = SDL_EVENTMASK (SDL_JOYHATMOTION), |
98 SDL_JOYBUTTONUPMASK = SDL_EVENTMASK(SDL_JOYBUTTONUP), | 106 SDL_JOYBUTTONDOWNMASK = SDL_EVENTMASK (SDL_JOYBUTTONDOWN), |
99 SDL_JOYEVENTMASK = SDL_EVENTMASK(SDL_JOYAXISMOTION)| | 107 SDL_JOYBUTTONUPMASK = SDL_EVENTMASK (SDL_JOYBUTTONUP), |
100 SDL_EVENTMASK(SDL_JOYBALLMOTION)| | 108 SDL_JOYEVENTMASK = SDL_EVENTMASK (SDL_JOYAXISMOTION) | |
101 SDL_EVENTMASK(SDL_JOYHATMOTION)| | 109 SDL_EVENTMASK (SDL_JOYBALLMOTION) | |
102 SDL_EVENTMASK(SDL_JOYBUTTONDOWN)| | 110 SDL_EVENTMASK (SDL_JOYHATMOTION) | |
103 SDL_EVENTMASK(SDL_JOYBUTTONUP), | 111 SDL_EVENTMASK (SDL_JOYBUTTONDOWN) | SDL_EVENTMASK (SDL_JOYBUTTONUP), |
104 SDL_VIDEORESIZEMASK = SDL_EVENTMASK(SDL_VIDEORESIZE), | 112 SDL_QUITMASK = SDL_EVENTMASK (SDL_QUIT), |
105 SDL_VIDEOEXPOSEMASK = SDL_EVENTMASK(SDL_VIDEOEXPOSE), | 113 SDL_SYSWMEVENTMASK = SDL_EVENTMASK (SDL_SYSWMEVENT) |
106 SDL_QUITMASK = SDL_EVENTMASK(SDL_QUIT), | 114 } SDL_EventMask; |
107 SDL_SYSWMEVENTMASK = SDL_EVENTMASK(SDL_SYSWMEVENT) | |
108 } SDL_EventMask ; | |
109 #define SDL_ALLEVENTS 0xFFFFFFFF | 115 #define SDL_ALLEVENTS 0xFFFFFFFF |
110 | 116 |
111 /* Application visibility event structure */ | 117 /** |
112 typedef struct SDL_ActiveEvent { | 118 * \struct SDL_WindowEvent |
113 Uint8 type; /* SDL_ACTIVEEVENT */ | 119 * |
114 Uint8 gain; /* Whether given states were gained or lost (1/0) */ | 120 * \brief Window state change event data |
115 Uint8 state; /* A mask of the focus states */ | 121 */ |
116 } SDL_ActiveEvent; | 122 typedef struct SDL_WindowEvent |
117 | 123 { |
118 /* Keyboard event structure */ | 124 Uint8 type; /**< SDL_WINDOWEVENT */ |
119 typedef struct SDL_KeyboardEvent { | 125 Uint8 event; /**< SDL_WindowEventID */ |
120 Uint8 type; /* SDL_KEYDOWN or SDL_KEYUP */ | 126 int data1; /**< event dependent data */ |
121 Uint8 which; /* The keyboard device index */ | 127 int data2; /**< event dependent data */ |
122 Uint8 state; /* SDL_PRESSED or SDL_RELEASED */ | 128 SDL_WindowID windowID; /**< The associated window */ |
123 SDL_keysym keysym; | 129 } SDL_WindowEvent; |
130 | |
131 /** | |
132 * \struct SDL_KeyboardEvent | |
133 * | |
134 * \brief Keyboard event structure | |
135 */ | |
136 typedef struct SDL_KeyboardEvent | |
137 { | |
138 Uint8 type; /**< SDL_KEYDOWN or SDL_KEYUP */ | |
139 Uint8 which; /**< The keyboard device index */ | |
140 Uint8 state; /**< SDL_PRESSED or SDL_RELEASED */ | |
141 SDL_keysym keysym; /**< The key that was pressed or released */ | |
142 SDL_WindowID windowID; /**< The window with keyboard focus, if any */ | |
124 } SDL_KeyboardEvent; | 143 } SDL_KeyboardEvent; |
125 | 144 |
126 /* Mouse motion event structure */ | 145 /** |
127 typedef struct SDL_MouseMotionEvent { | 146 * \struct SDL_MouseMotionEvent |
128 Uint8 type; /* SDL_MOUSEMOTION */ | 147 * |
129 Uint8 which; /* The mouse device index */ | 148 * \brief Mouse motion event structure |
130 Uint8 state; /* The current button state */ | 149 */ |
131 Uint16 x, y; /* The X/Y coordinates of the mouse */ | 150 typedef struct SDL_MouseMotionEvent |
132 Sint16 xrel; /* The relative motion in the X direction */ | 151 { |
133 Sint16 yrel; /* The relative motion in the Y direction */ | 152 Uint8 type; /**< SDL_MOUSEMOTION */ |
153 Uint8 which; /**< The mouse device index */ | |
154 Uint8 state; /**< The current button state */ | |
155 int x; /**< X coordinate, relative to window */ | |
156 int y; /**< Y coordinate, relative to window */ | |
157 int xrel; /**< The relative motion in the X direction */ | |
158 int yrel; /**< The relative motion in the Y direction */ | |
159 SDL_WindowID windowID; /**< The window with mouse focus, if any */ | |
134 } SDL_MouseMotionEvent; | 160 } SDL_MouseMotionEvent; |
135 | 161 |
136 /* Mouse button event structure */ | 162 /** |
137 typedef struct SDL_MouseButtonEvent { | 163 * \struct SDL_MouseButtonEvent |
138 Uint8 type; /* SDL_MOUSEBUTTONDOWN or SDL_MOUSEBUTTONUP */ | 164 * |
139 Uint8 which; /* The mouse device index */ | 165 * \brief Mouse button event structure |
140 Uint8 button; /* The mouse button index */ | 166 */ |
141 Uint8 state; /* SDL_PRESSED or SDL_RELEASED */ | 167 typedef struct SDL_MouseButtonEvent |
142 Uint16 x, y; /* The X/Y coordinates of the mouse at press time */ | 168 { |
169 Uint8 type; /**< SDL_MOUSEBUTTONDOWN or SDL_MOUSEBUTTONUP */ | |
170 Uint8 which; /**< The mouse device index */ | |
171 Uint8 button; /**< The mouse button index */ | |
172 Uint8 state; /**< SDL_PRESSED or SDL_RELEASED */ | |
173 int x; /**< X coordinate, relative to window */ | |
174 int y; /**< Y coordinate, relative to window */ | |
175 SDL_WindowID windowID; /**< The window with mouse focus, if any */ | |
143 } SDL_MouseButtonEvent; | 176 } SDL_MouseButtonEvent; |
144 | 177 |
145 /* Joystick axis motion event structure */ | 178 /** |
146 typedef struct SDL_JoyAxisEvent { | 179 * \struct SDL_JoyAxisEvent |
147 Uint8 type; /* SDL_JOYAXISMOTION */ | 180 * |
148 Uint8 which; /* The joystick device index */ | 181 * \brief Joystick axis motion event structure |
149 Uint8 axis; /* The joystick axis index */ | 182 */ |
150 Sint16 value; /* The axis value (range: -32768 to 32767) */ | 183 typedef struct SDL_JoyAxisEvent |
184 { | |
185 Uint8 type; /**< SDL_JOYAXISMOTION */ | |
186 Uint8 which; /**< The joystick device index */ | |
187 Uint8 axis; /**< The joystick axis index */ | |
188 int value; /**< The axis value (range: -32768 to 32767) */ | |
151 } SDL_JoyAxisEvent; | 189 } SDL_JoyAxisEvent; |
152 | 190 |
153 /* Joystick trackball motion event structure */ | 191 /** |
154 typedef struct SDL_JoyBallEvent { | 192 * \struct SDL_JoyBallEvent |
155 Uint8 type; /* SDL_JOYBALLMOTION */ | 193 * |
156 Uint8 which; /* The joystick device index */ | 194 * \brief Joystick trackball motion event structure |
157 Uint8 ball; /* The joystick trackball index */ | 195 */ |
158 Sint16 xrel; /* The relative motion in the X direction */ | 196 typedef struct SDL_JoyBallEvent |
159 Sint16 yrel; /* The relative motion in the Y direction */ | 197 { |
198 Uint8 type; /**< SDL_JOYBALLMOTION */ | |
199 Uint8 which; /**< The joystick device index */ | |
200 Uint8 ball; /**< The joystick trackball index */ | |
201 int xrel; /**< The relative motion in the X direction */ | |
202 int yrel; /**< The relative motion in the Y direction */ | |
160 } SDL_JoyBallEvent; | 203 } SDL_JoyBallEvent; |
161 | 204 |
162 /* Joystick hat position change event structure */ | 205 /** |
163 typedef struct SDL_JoyHatEvent { | 206 * \struct SDL_JoyHatEvent |
164 Uint8 type; /* SDL_JOYHATMOTION */ | 207 * |
165 Uint8 which; /* The joystick device index */ | 208 * \brief Joystick hat position change event structure |
166 Uint8 hat; /* The joystick hat index */ | 209 */ |
167 Uint8 value; /* The hat position value: | 210 typedef struct SDL_JoyHatEvent |
168 SDL_HAT_LEFTUP SDL_HAT_UP SDL_HAT_RIGHTUP | 211 { |
169 SDL_HAT_LEFT SDL_HAT_CENTERED SDL_HAT_RIGHT | 212 Uint8 type; /**< SDL_JOYHATMOTION */ |
170 SDL_HAT_LEFTDOWN SDL_HAT_DOWN SDL_HAT_RIGHTDOWN | 213 Uint8 which; /**< The joystick device index */ |
171 Note that zero means the POV is centered. | 214 Uint8 hat; /**< The joystick hat index */ |
172 */ | 215 Uint8 value; /**< The hat position value: |
216 SDL_HAT_LEFTUP SDL_HAT_UP SDL_HAT_RIGHTUP | |
217 SDL_HAT_LEFT SDL_HAT_CENTERED SDL_HAT_RIGHT | |
218 SDL_HAT_LEFTDOWN SDL_HAT_DOWN SDL_HAT_RIGHTDOWN | |
219 Note that zero means the POV is centered. | |
220 */ | |
173 } SDL_JoyHatEvent; | 221 } SDL_JoyHatEvent; |
174 | 222 |
175 /* Joystick button event structure */ | 223 /** |
176 typedef struct SDL_JoyButtonEvent { | 224 * \struct SDL_JoyButtonEvent |
177 Uint8 type; /* SDL_JOYBUTTONDOWN or SDL_JOYBUTTONUP */ | 225 * |
178 Uint8 which; /* The joystick device index */ | 226 * \brief Joystick button event structure |
179 Uint8 button; /* The joystick button index */ | 227 */ |
180 Uint8 state; /* SDL_PRESSED or SDL_RELEASED */ | 228 typedef struct SDL_JoyButtonEvent |
229 { | |
230 Uint8 type; /**< SDL_JOYBUTTONDOWN or SDL_JOYBUTTONUP */ | |
231 Uint8 which; /**< The joystick device index */ | |
232 Uint8 button; /**< The joystick button index */ | |
233 Uint8 state; /**< SDL_PRESSED or SDL_RELEASED */ | |
181 } SDL_JoyButtonEvent; | 234 } SDL_JoyButtonEvent; |
182 | 235 |
183 /* The "window resized" event | 236 /** |
184 When you get this event, you are responsible for setting a new video | 237 * \struct SDL_QuitEvent |
185 mode with the new width and height. | 238 * |
186 */ | 239 * \brief The "quit requested" event |
187 typedef struct SDL_ResizeEvent { | 240 */ |
188 Uint8 type; /* SDL_VIDEORESIZE */ | 241 typedef struct SDL_QuitEvent |
189 int w; /* New width */ | 242 { |
190 int h; /* New height */ | 243 Uint8 type; /**< SDL_QUIT */ |
191 } SDL_ResizeEvent; | |
192 | |
193 /* The "screen redraw" event */ | |
194 typedef struct SDL_ExposeEvent { | |
195 Uint8 type; /* SDL_VIDEOEXPOSE */ | |
196 } SDL_ExposeEvent; | |
197 | |
198 /* The "quit requested" event */ | |
199 typedef struct SDL_QuitEvent { | |
200 Uint8 type; /* SDL_QUIT */ | |
201 } SDL_QuitEvent; | 244 } SDL_QuitEvent; |
202 | 245 |
203 /* A user-defined event type */ | 246 /** |
204 typedef struct SDL_UserEvent { | 247 * \struct SDL_UserEvent |
205 Uint8 type; /* SDL_USEREVENT through SDL_NUMEVENTS-1 */ | 248 * |
206 int code; /* User defined event code */ | 249 * \brief A user-defined event type |
207 void *data1; /* User defined data pointer */ | 250 */ |
208 void *data2; /* User defined data pointer */ | 251 typedef struct SDL_UserEvent |
252 { | |
253 Uint8 type; /**< SDL_USEREVENT through SDL_NUMEVENTS-1 */ | |
254 int code; /**< User defined event code */ | |
255 void *data1; /**< User defined data pointer */ | |
256 void *data2; /**< User defined data pointer */ | |
209 } SDL_UserEvent; | 257 } SDL_UserEvent; |
210 | 258 |
211 /* If you want to use this event, you should include SDL_syswm.h */ | 259 /** |
260 * \struct SDL_SysWMEvent | |
261 * | |
262 * \brief A video driver dependent system event | |
263 * | |
264 * \note If you want to use this event, you should include SDL_syswm.h | |
265 */ | |
212 struct SDL_SysWMmsg; | 266 struct SDL_SysWMmsg; |
213 typedef struct SDL_SysWMmsg SDL_SysWMmsg; | 267 typedef struct SDL_SysWMmsg SDL_SysWMmsg; |
214 typedef struct SDL_SysWMEvent { | 268 typedef struct SDL_SysWMEvent |
215 Uint8 type; | 269 { |
216 SDL_SysWMmsg *msg; | 270 Uint8 type; /**< SDL_SYSWMEVENT */ |
271 SDL_SysWMmsg *msg; /**< driver dependent data, defined in SDL_syswm.h */ | |
217 } SDL_SysWMEvent; | 272 } SDL_SysWMEvent; |
218 | 273 |
219 /* General event structure */ | 274 /** |
220 typedef union SDL_Event { | 275 * \union SDL_Event |
221 Uint8 type; | 276 * |
222 SDL_ActiveEvent active; | 277 * \brief General event structure |
223 SDL_KeyboardEvent key; | 278 */ |
224 SDL_MouseMotionEvent motion; | 279 typedef union SDL_Event |
225 SDL_MouseButtonEvent button; | 280 { |
226 SDL_JoyAxisEvent jaxis; | 281 Uint8 type; /**< Event type, shared with all events */ |
227 SDL_JoyBallEvent jball; | 282 SDL_WindowEvent window; /**< Window event data */ |
228 SDL_JoyHatEvent jhat; | 283 SDL_KeyboardEvent key; /**< Keyboard event data */ |
229 SDL_JoyButtonEvent jbutton; | 284 SDL_MouseMotionEvent motion; /**< Mouse motion event data */ |
230 SDL_ResizeEvent resize; | 285 SDL_MouseButtonEvent button; /**< Mouse button event data */ |
231 SDL_ExposeEvent expose; | 286 SDL_JoyAxisEvent jaxis; /**< Joystick axis event data */ |
232 SDL_QuitEvent quit; | 287 SDL_JoyBallEvent jball; /**< Joystick ball event data */ |
233 SDL_UserEvent user; | 288 SDL_JoyHatEvent jhat; /**< Joystick hat event data */ |
234 SDL_SysWMEvent syswm; | 289 SDL_JoyButtonEvent jbutton; /**< Joystick button event data */ |
290 SDL_QuitEvent quit; /**< Quit request event data */ | |
291 SDL_UserEvent user; /**< Custom event data */ | |
292 SDL_SysWMEvent syswm; /**< System dependent window event data */ | |
235 } SDL_Event; | 293 } SDL_Event; |
236 | 294 |
237 | 295 |
238 /* Function prototypes */ | 296 /* Function prototypes */ |
239 | 297 |
240 /* Pumps the event loop, gathering events from the input devices. | 298 /* Pumps the event loop, gathering events from the input devices. |
241 This function updates the event queue and internal input device state. | 299 This function updates the event queue and internal input device state. |
242 This should only be run in the thread that sets the video mode. | 300 This should only be run in the thread that sets the video mode. |
243 */ | 301 */ |
244 extern DECLSPEC void SDLCALL SDL_PumpEvents(void); | 302 extern DECLSPEC void SDLCALL SDL_PumpEvents (void); |
245 | 303 |
246 /* Checks the event queue for messages and optionally returns them. | 304 /* Checks the event queue for messages and optionally returns them. |
247 If 'action' is SDL_ADDEVENT, up to 'numevents' events will be added to | 305 If 'action' is SDL_ADDEVENT, up to 'numevents' events will be added to |
248 the back of the event queue. | 306 the back of the event queue. |
249 If 'action' is SDL_PEEKEVENT, up to 'numevents' events at the front | 307 If 'action' is SDL_PEEKEVENT, up to 'numevents' events at the front |
253 of the event queue, matching 'mask', will be returned and will be | 311 of the event queue, matching 'mask', will be returned and will be |
254 removed from the queue. | 312 removed from the queue. |
255 This function returns the number of events actually stored, or -1 | 313 This function returns the number of events actually stored, or -1 |
256 if there was an error. This function is thread-safe. | 314 if there was an error. This function is thread-safe. |
257 */ | 315 */ |
258 typedef enum { | 316 typedef enum |
259 SDL_ADDEVENT, | 317 { |
260 SDL_PEEKEVENT, | 318 SDL_ADDEVENT, |
261 SDL_GETEVENT | 319 SDL_PEEKEVENT, |
320 SDL_GETEVENT | |
262 } SDL_eventaction; | 321 } SDL_eventaction; |
263 /* */ | 322 /* */ |
264 extern DECLSPEC int SDLCALL SDL_PeepEvents(SDL_Event *events, int numevents, | 323 extern DECLSPEC int SDLCALL SDL_PeepEvents (SDL_Event * events, int numevents, |
265 SDL_eventaction action, Uint32 mask); | 324 SDL_eventaction action, |
325 Uint32 mask); | |
266 | 326 |
267 /* Polls for currently pending events, and returns 1 if there are any pending | 327 /* Polls for currently pending events, and returns 1 if there are any pending |
268 events, or 0 if there are none available. If 'event' is not NULL, the next | 328 events, or 0 if there are none available. If 'event' is not NULL, the next |
269 event is removed from the queue and stored in that area. | 329 event is removed from the queue and stored in that area. |
270 */ | 330 */ |
271 extern DECLSPEC int SDLCALL SDL_PollEvent(SDL_Event *event); | 331 extern DECLSPEC int SDLCALL SDL_PollEvent (SDL_Event * event); |
272 | 332 |
273 /* Waits indefinitely for the next available event, returning 1, or 0 if there | 333 /* Waits indefinitely for the next available event, returning 1, or 0 if there |
274 was an error while waiting for events. If 'event' is not NULL, the next | 334 was an error while waiting for events. If 'event' is not NULL, the next |
275 event is removed from the queue and stored in that area. | 335 event is removed from the queue and stored in that area. |
276 */ | 336 */ |
277 extern DECLSPEC int SDLCALL SDL_WaitEvent(SDL_Event *event); | 337 extern DECLSPEC int SDLCALL SDL_WaitEvent (SDL_Event * event); |
278 | 338 |
279 /* Add an event to the event queue. | 339 /* Add an event to the event queue. |
280 This function returns 0 on success, or -1 if the event queue was full | 340 This function returns 0 on success, or -1 if the event queue was full |
281 or there was some other error. | 341 or there was some other error. |
282 */ | 342 */ |
283 extern DECLSPEC int SDLCALL SDL_PushEvent(SDL_Event *event); | 343 extern DECLSPEC int SDLCALL SDL_PushEvent (SDL_Event * event); |
284 | 344 |
285 /* | 345 /* |
286 This function sets up a filter to process all events before they | 346 This function sets up a filter to process all events before they |
287 change internal state and are posted to the internal event queue. | 347 change internal state and are posted to the internal event queue. |
288 | 348 |
289 The filter is protypted as: | 349 The filter is protypted as: |
290 */ | 350 */ |
291 typedef int (SDLCALL *SDL_EventFilter)(const SDL_Event *event); | 351 typedef int (SDLCALL * SDL_EventFilter) (const SDL_Event * event); |
292 /* | 352 /* |
293 If the filter returns 1, then the event will be added to the internal queue. | 353 If the filter returns 1, then the event will be added to the internal queue. |
294 If it returns 0, then the event will be dropped from the queue, but the | 354 If it returns 0, then the event will be dropped from the queue, but the |
295 internal state will still be updated. This allows selective filtering of | 355 internal state will still be updated. This allows selective filtering of |
296 dynamically arriving events. | 356 dynamically arriving events. |
303 application window. If the event filter returns 1, then the window will | 363 application window. If the event filter returns 1, then the window will |
304 be closed, otherwise the window will remain open if possible. | 364 be closed, otherwise the window will remain open if possible. |
305 If the quit event is generated by an interrupt signal, it will bypass the | 365 If the quit event is generated by an interrupt signal, it will bypass the |
306 internal queue and be delivered to the application at the next event poll. | 366 internal queue and be delivered to the application at the next event poll. |
307 */ | 367 */ |
308 extern DECLSPEC void SDLCALL SDL_SetEventFilter(SDL_EventFilter filter); | 368 extern DECLSPEC void SDLCALL SDL_SetEventFilter (SDL_EventFilter filter); |
309 | 369 |
310 /* | 370 /* |
311 Return the current event filter - can be used to "chain" filters. | 371 Return the current event filter - can be used to "chain" filters. |
312 If there is no event filter set, this function returns NULL. | 372 If there is no event filter set, this function returns NULL. |
313 */ | 373 */ |
314 extern DECLSPEC SDL_EventFilter SDLCALL SDL_GetEventFilter(void); | 374 extern DECLSPEC SDL_EventFilter SDLCALL SDL_GetEventFilter (void); |
315 | 375 |
316 /* | 376 /* |
317 This function allows you to set the state of processing certain events. | 377 This function allows you to set the state of processing certain events. |
318 If 'state' is set to SDL_IGNORE, that event will be automatically dropped | 378 If 'state' is set to SDL_IGNORE, that event will be automatically dropped |
319 from the event queue and will not event be filtered. | 379 from the event queue and will not event be filtered. |
323 */ | 383 */ |
324 #define SDL_QUERY -1 | 384 #define SDL_QUERY -1 |
325 #define SDL_IGNORE 0 | 385 #define SDL_IGNORE 0 |
326 #define SDL_DISABLE 0 | 386 #define SDL_DISABLE 0 |
327 #define SDL_ENABLE 1 | 387 #define SDL_ENABLE 1 |
328 extern DECLSPEC Uint8 SDLCALL SDL_EventState(Uint8 type, int state); | 388 extern DECLSPEC Uint8 SDLCALL SDL_EventState (Uint8 type, int state); |
329 | 389 |
330 | 390 |
331 /* Ends C function definitions when using C++ */ | 391 /* Ends C function definitions when using C++ */ |
332 #ifdef __cplusplus | 392 #ifdef __cplusplus |
393 /* *INDENT-OFF* */ | |
333 } | 394 } |
395 /* *INDENT-ON* */ | |
334 #endif | 396 #endif |
335 #include "close_code.h" | 397 #include "close_code.h" |
336 | 398 |
337 #endif /* _SDL_events_h */ | 399 #endif /* _SDL_events_h */ |
400 | |
401 /* vi: set ts=4 sw=4 expandtab: */ |