00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00029 #ifndef _SDL_events_h
00030 #define _SDL_events_h
00031
00032 #include "SDL_stdinc.h"
00033 #include "SDL_error.h"
00034 #include "SDL_video.h"
00035 #include "SDL_keyboard.h"
00036 #include "SDL_mouse.h"
00037 #include "SDL_joystick.h"
00038 #include "SDL_quit.h"
00039
00040 #include "begin_code.h"
00041
00042 #ifdef __cplusplus
00043
00044 extern "C" {
00045
00046 #endif
00047
00048
00049 #define SDL_RELEASED 0
00050 #define SDL_PRESSED 1
00051
00057 typedef enum
00058 {
00059 SDL_NOEVENT = 0,
00060 SDL_WINDOWEVENT,
00061 SDL_KEYDOWN,
00062 SDL_KEYUP,
00063 SDL_TEXTEDITING,
00064 SDL_TEXTINPUT,
00065 SDL_MOUSEMOTION,
00066 SDL_MOUSEBUTTONDOWN,
00067 SDL_MOUSEBUTTONUP,
00068 SDL_MOUSEWHEEL,
00069 SDL_JOYAXISMOTION,
00070 SDL_JOYBALLMOTION,
00071 SDL_JOYHATMOTION,
00072 SDL_JOYBUTTONDOWN,
00073 SDL_JOYBUTTONUP,
00074 SDL_QUIT,
00075 SDL_SYSWMEVENT,
00076 SDL_PROXIMITYIN,
00077 SDL_PROXIMITYOUT,
00078 SDL_EVENT_RESERVED1,
00079 SDL_EVENT_RESERVED2,
00080 SDL_EVENT_RESERVED3,
00081
00082 SDL_USEREVENT = 24,
00083
00084
00085
00086 SDL_NUMEVENTS = 32
00087 } SDL_EventType;
00088
00094 #define SDL_EVENTMASK(X) (1<<(X))
00095 typedef enum
00096 {
00097 SDL_WINDOWEVENTMASK = SDL_EVENTMASK(SDL_WINDOWEVENT),
00098 SDL_KEYDOWNMASK = SDL_EVENTMASK(SDL_KEYDOWN),
00099 SDL_KEYUPMASK = SDL_EVENTMASK(SDL_KEYUP),
00100 SDL_KEYEVENTMASK = SDL_EVENTMASK(SDL_KEYDOWN) | SDL_EVENTMASK(SDL_KEYUP),
00101 SDL_TEXTEDITINGMASK = SDL_EVENTMASK(SDL_TEXTEDITING),
00102 SDL_TEXTINPUTMASK = SDL_EVENTMASK(SDL_TEXTINPUT),
00103 SDL_MOUSEMOTIONMASK = SDL_EVENTMASK(SDL_MOUSEMOTION),
00104 SDL_MOUSEBUTTONDOWNMASK = SDL_EVENTMASK(SDL_MOUSEBUTTONDOWN),
00105 SDL_MOUSEBUTTONUPMASK = SDL_EVENTMASK(SDL_MOUSEBUTTONUP),
00106 SDL_MOUSEWHEELMASK = SDL_EVENTMASK(SDL_MOUSEWHEEL),
00107 SDL_MOUSEEVENTMASK = SDL_EVENTMASK(SDL_MOUSEMOTION) |
00108 SDL_EVENTMASK(SDL_MOUSEBUTTONDOWN) | SDL_EVENTMASK(SDL_MOUSEBUTTONUP),
00109 SDL_JOYAXISMOTIONMASK = SDL_EVENTMASK(SDL_JOYAXISMOTION),
00110 SDL_JOYBALLMOTIONMASK = SDL_EVENTMASK(SDL_JOYBALLMOTION),
00111 SDL_JOYHATMOTIONMASK = SDL_EVENTMASK(SDL_JOYHATMOTION),
00112 SDL_JOYBUTTONDOWNMASK = SDL_EVENTMASK(SDL_JOYBUTTONDOWN),
00113 SDL_JOYBUTTONUPMASK = SDL_EVENTMASK(SDL_JOYBUTTONUP),
00114 SDL_JOYEVENTMASK = SDL_EVENTMASK(SDL_JOYAXISMOTION) |
00115 SDL_EVENTMASK(SDL_JOYBALLMOTION) |
00116 SDL_EVENTMASK(SDL_JOYHATMOTION) |
00117 SDL_EVENTMASK(SDL_JOYBUTTONDOWN) | SDL_EVENTMASK(SDL_JOYBUTTONUP),
00118 SDL_QUITMASK = SDL_EVENTMASK(SDL_QUIT),
00119 SDL_SYSWMEVENTMASK = SDL_EVENTMASK(SDL_SYSWMEVENT),
00120 SDL_PROXIMITYINMASK = SDL_EVENTMASK(SDL_PROXIMITYIN),
00121 SDL_PROXIMITYOUTMASK = SDL_EVENTMASK(SDL_PROXIMITYOUT)
00122 } SDL_EventMask;
00123 #define SDL_ALLEVENTS 0xFFFFFFFF
00124
00130 typedef struct SDL_WindowEvent
00131 {
00132 Uint8 type;
00133 SDL_WindowID windowID;
00134 Uint8 event;
00135 int data1;
00136 int data2;
00137 } SDL_WindowEvent;
00138
00144 typedef struct SDL_KeyboardEvent
00145 {
00146 Uint8 type;
00147 SDL_WindowID windowID;
00148 Uint8 which;
00149 Uint8 state;
00150 SDL_keysym keysym;
00151 } SDL_KeyboardEvent;
00152
00158 #define SDL_TEXTEDITINGEVENT_TEXT_SIZE (32)
00159 typedef struct SDL_TextEditingEvent
00160 {
00161 Uint8 type;
00162 char text[SDL_TEXTEDITINGEVENT_TEXT_SIZE];
00163 int start;
00164 int length;
00165 } SDL_TextEditingEvent;
00166
00172 #define SDL_TEXTINPUTEVENT_TEXT_SIZE (32)
00173 typedef struct SDL_TextInputEvent
00174 {
00175 Uint8 type;
00176 SDL_WindowID windowID;
00177 Uint8 which;
00178 char text[SDL_TEXTINPUTEVENT_TEXT_SIZE];
00179 } SDL_TextInputEvent;
00180
00186 typedef struct SDL_MouseMotionEvent
00187 {
00188 Uint8 type;
00189 SDL_WindowID windowID;
00190 Uint8 which;
00191 Uint8 state;
00192 int x;
00193 int y;
00194 int z;
00195 int pressure;
00196 int pressure_max;
00197 int pressure_min;
00198 int rotation;
00199 int tilt;
00200 int cursor;
00201 int xrel;
00202 int yrel;
00203 } SDL_MouseMotionEvent;
00204
00210 typedef struct SDL_MouseButtonEvent
00211 {
00212 Uint8 type;
00213 SDL_WindowID windowID;
00214 Uint8 which;
00215 Uint8 button;
00216 Uint8 state;
00217 int x;
00218 int y;
00219 } SDL_MouseButtonEvent;
00220
00226 typedef struct SDL_MouseWheelEvent
00227 {
00228 Uint8 type;
00229 SDL_WindowID windowID;
00230 Uint8 which;
00231 int x;
00232 int y;
00233 } SDL_MouseWheelEvent;
00234
00240 typedef struct SDL_JoyAxisEvent
00241 {
00242 Uint8 type;
00243 Uint8 which;
00244 Uint8 axis;
00245 int value;
00246 } SDL_JoyAxisEvent;
00247
00253 typedef struct SDL_JoyBallEvent
00254 {
00255 Uint8 type;
00256 Uint8 which;
00257 Uint8 ball;
00258 int xrel;
00259 int yrel;
00260 } SDL_JoyBallEvent;
00261
00267 typedef struct SDL_JoyHatEvent
00268 {
00269 Uint8 type;
00270 Uint8 which;
00271 Uint8 hat;
00272 Uint8 value;
00278 } SDL_JoyHatEvent;
00279
00285 typedef struct SDL_JoyButtonEvent
00286 {
00287 Uint8 type;
00288 Uint8 which;
00289 Uint8 button;
00290 Uint8 state;
00291 } SDL_JoyButtonEvent;
00292
00298 typedef struct SDL_QuitEvent
00299 {
00300 Uint8 type;
00301 } SDL_QuitEvent;
00302
00308 typedef struct SDL_UserEvent
00309 {
00310 Uint8 type;
00311 SDL_WindowID windowID;
00312 int code;
00313 void *data1;
00314 void *data2;
00315 } SDL_UserEvent;
00316
00324 struct SDL_SysWMmsg;
00325 typedef struct SDL_SysWMmsg SDL_SysWMmsg;
00326 typedef struct SDL_SysWMEvent
00327 {
00328 Uint8 type;
00329 SDL_SysWMmsg *msg;
00330 } SDL_SysWMEvent;
00331
00332 typedef struct SDL_ProximityEvent
00333 {
00334 Uint8 type;
00335 SDL_WindowID windowID;
00336 Uint8 which;
00337 int cursor;
00338 int x;
00339 int y;
00340 } SDL_ProximityEvent;
00341
00342
00343 #ifndef SDL_NO_COMPAT
00344 typedef struct SDL_ActiveEvent
00345 {
00346 Uint8 type;
00347 Uint8 gain;
00348 Uint8 state;
00349 } SDL_ActiveEvent;
00350
00351 typedef struct SDL_ResizeEvent
00352 {
00353 Uint8 type;
00354 int w;
00355 int h;
00356 } SDL_ResizeEvent;
00357 #endif
00358
00364 typedef union SDL_Event
00365 {
00366 Uint8 type;
00367 SDL_WindowEvent window;
00368 SDL_KeyboardEvent key;
00369 SDL_TextEditingEvent edit;
00370 SDL_TextInputEvent text;
00371 SDL_MouseMotionEvent motion;
00372 SDL_MouseButtonEvent button;
00373 SDL_MouseWheelEvent wheel;
00374 SDL_JoyAxisEvent jaxis;
00375 SDL_JoyBallEvent jball;
00376 SDL_JoyHatEvent jhat;
00377 SDL_JoyButtonEvent jbutton;
00378 SDL_QuitEvent quit;
00379 SDL_UserEvent user;
00380 SDL_SysWMEvent syswm;
00381 SDL_ProximityEvent proximity;
00383
00384 #ifndef SDL_NO_COMPAT
00385 SDL_ActiveEvent active;
00386 SDL_ResizeEvent resize;
00387 #endif
00388 } SDL_Event;
00389
00390
00391
00392
00393
00394
00395
00396
00397 extern DECLSPEC void SDLCALL SDL_PumpEvents(void);
00398
00399
00400
00401
00402
00403
00404
00405
00406
00407
00408
00409
00410
00411 typedef enum
00412 {
00413 SDL_ADDEVENT,
00414 SDL_PEEKEVENT,
00415 SDL_GETEVENT
00416 } SDL_eventaction;
00417
00418 extern DECLSPEC int SDLCALL SDL_PeepEvents(SDL_Event * events, int numevents,
00419 SDL_eventaction action,
00420 Uint32 mask);
00421
00422
00423
00424 extern DECLSPEC SDL_bool SDLCALL SDL_HasEvent(Uint32 mask);
00425
00426
00427
00428
00429
00430 extern DECLSPEC int SDLCALL SDL_PollEvent(SDL_Event * event);
00431
00432
00433
00434
00435
00436 extern DECLSPEC int SDLCALL SDL_WaitEvent(SDL_Event * event);
00437
00438
00439
00440
00441
00442
00443 extern DECLSPEC int SDLCALL SDL_WaitEventTimeout(SDL_Event * event,
00444 int timeout);
00445
00446
00447
00448
00449
00450 extern DECLSPEC int SDLCALL SDL_PushEvent(SDL_Event * event);
00451
00452
00453
00454
00455
00456
00457
00458 typedef int (SDLCALL * SDL_EventFilter) (void *userdata, SDL_Event * event);
00459
00460
00461
00462
00463
00464
00465
00466
00467
00468
00469
00470
00471
00472
00473
00474
00475 extern DECLSPEC void SDLCALL SDL_SetEventFilter(SDL_EventFilter filter,
00476 void *userdata);
00477
00478
00479
00480
00481
00482 extern DECLSPEC SDL_bool SDLCALL SDL_GetEventFilter(SDL_EventFilter * filter,
00483 void **userdata);
00484
00485
00486
00487
00488
00489 extern DECLSPEC void SDLCALL SDL_FilterEvents(SDL_EventFilter filter,
00490 void *userdata);
00491
00492
00493
00494
00495
00496
00497
00498
00499
00500 #define SDL_QUERY -1
00501 #define SDL_IGNORE 0
00502 #define SDL_DISABLE 0
00503 #define SDL_ENABLE 1
00504 extern DECLSPEC Uint8 SDLCALL SDL_EventState(Uint8 type, int state);
00505
00506
00507
00508 #ifdef __cplusplus
00509
00510 }
00511
00512 #endif
00513 #include "close_code.h"
00514
00515 #endif
00516
00517