00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00028 #ifndef _SDL_events_h
00029 #define _SDL_events_h
00030
00031 #include "SDL_stdinc.h"
00032 #include "SDL_error.h"
00033 #include "SDL_active.h"
00034 #include "SDL_keyboard.h"
00035 #include "SDL_mouse.h"
00036 #include "SDL_joystick.h"
00037 #include "SDL_quit.h"
00038
00039 #include "begin_code.h"
00040
00041 #ifdef __cplusplus
00042 extern "C" {
00043 #endif
00044
00047 #define SDL_RELEASED 0
00048 #define SDL_PRESSED 1
00049
00052 typedef enum {
00053 SDL_NOEVENT = 0,
00054 SDL_ACTIVEEVENT,
00055 SDL_KEYDOWN,
00056 SDL_KEYUP,
00057 SDL_MOUSEMOTION,
00058 SDL_MOUSEBUTTONDOWN,
00059 SDL_MOUSEBUTTONUP,
00060 SDL_JOYAXISMOTION,
00061 SDL_JOYBALLMOTION,
00062 SDL_JOYHATMOTION,
00063 SDL_JOYBUTTONDOWN,
00064 SDL_JOYBUTTONUP,
00065 SDL_QUIT,
00066 SDL_SYSWMEVENT,
00067 SDL_EVENT_RESERVEDA,
00068 SDL_EVENT_RESERVEDB,
00069 SDL_VIDEORESIZE,
00070 SDL_VIDEOEXPOSE,
00071 SDL_EVENT_RESERVED2,
00072 SDL_EVENT_RESERVED3,
00073 SDL_EVENT_RESERVED4,
00074 SDL_EVENT_RESERVED5,
00075 SDL_EVENT_RESERVED6,
00076 SDL_EVENT_RESERVED7,
00078 SDL_USEREVENT = 24,
00082 SDL_NUMEVENTS = 32
00083 } SDL_EventType;
00084
00087 #define SDL_EVENTMASK(X) (1<<(X))
00088 typedef enum {
00089 SDL_ACTIVEEVENTMASK = SDL_EVENTMASK(SDL_ACTIVEEVENT),
00090 SDL_KEYDOWNMASK = SDL_EVENTMASK(SDL_KEYDOWN),
00091 SDL_KEYUPMASK = SDL_EVENTMASK(SDL_KEYUP),
00092 SDL_KEYEVENTMASK = SDL_EVENTMASK(SDL_KEYDOWN)|
00093 SDL_EVENTMASK(SDL_KEYUP),
00094 SDL_MOUSEMOTIONMASK = SDL_EVENTMASK(SDL_MOUSEMOTION),
00095 SDL_MOUSEBUTTONDOWNMASK = SDL_EVENTMASK(SDL_MOUSEBUTTONDOWN),
00096 SDL_MOUSEBUTTONUPMASK = SDL_EVENTMASK(SDL_MOUSEBUTTONUP),
00097 SDL_MOUSEEVENTMASK = SDL_EVENTMASK(SDL_MOUSEMOTION)|
00098 SDL_EVENTMASK(SDL_MOUSEBUTTONDOWN)|
00099 SDL_EVENTMASK(SDL_MOUSEBUTTONUP),
00100 SDL_JOYAXISMOTIONMASK = SDL_EVENTMASK(SDL_JOYAXISMOTION),
00101 SDL_JOYBALLMOTIONMASK = SDL_EVENTMASK(SDL_JOYBALLMOTION),
00102 SDL_JOYHATMOTIONMASK = SDL_EVENTMASK(SDL_JOYHATMOTION),
00103 SDL_JOYBUTTONDOWNMASK = SDL_EVENTMASK(SDL_JOYBUTTONDOWN),
00104 SDL_JOYBUTTONUPMASK = SDL_EVENTMASK(SDL_JOYBUTTONUP),
00105 SDL_JOYEVENTMASK = SDL_EVENTMASK(SDL_JOYAXISMOTION)|
00106 SDL_EVENTMASK(SDL_JOYBALLMOTION)|
00107 SDL_EVENTMASK(SDL_JOYHATMOTION)|
00108 SDL_EVENTMASK(SDL_JOYBUTTONDOWN)|
00109 SDL_EVENTMASK(SDL_JOYBUTTONUP),
00110 SDL_VIDEORESIZEMASK = SDL_EVENTMASK(SDL_VIDEORESIZE),
00111 SDL_VIDEOEXPOSEMASK = SDL_EVENTMASK(SDL_VIDEOEXPOSE),
00112 SDL_QUITMASK = SDL_EVENTMASK(SDL_QUIT),
00113 SDL_SYSWMEVENTMASK = SDL_EVENTMASK(SDL_SYSWMEVENT)
00114 } SDL_EventMask ;
00115 #define SDL_ALLEVENTS 0xFFFFFFFF
00116
00119 typedef struct SDL_ActiveEvent {
00120 Uint8 type;
00121 Uint8 gain;
00122 Uint8 state;
00123 } SDL_ActiveEvent;
00124
00126 typedef struct SDL_KeyboardEvent {
00127 Uint8 type;
00128 Uint8 which;
00129 Uint8 state;
00130 SDL_keysym keysym;
00131 } SDL_KeyboardEvent;
00132
00134 typedef struct SDL_MouseMotionEvent {
00135 Uint8 type;
00136 Uint8 which;
00137 Uint8 state;
00138 Uint16 x, y;
00139 Sint16 xrel;
00140 Sint16 yrel;
00141 } SDL_MouseMotionEvent;
00142
00144 typedef struct SDL_MouseButtonEvent {
00145 Uint8 type;
00146 Uint8 which;
00147 Uint8 button;
00148 Uint8 state;
00149 Uint16 x, y;
00150 } SDL_MouseButtonEvent;
00151
00153 typedef struct SDL_JoyAxisEvent {
00154 Uint8 type;
00155 Uint8 which;
00156 Uint8 axis;
00157 Sint16 value;
00158 } SDL_JoyAxisEvent;
00159
00161 typedef struct SDL_JoyBallEvent {
00162 Uint8 type;
00163 Uint8 which;
00164 Uint8 ball;
00165 Sint16 xrel;
00166 Sint16 yrel;
00167 } SDL_JoyBallEvent;
00168
00170 typedef struct SDL_JoyHatEvent {
00171 Uint8 type;
00172 Uint8 which;
00173 Uint8 hat;
00174 Uint8 value;
00180 } SDL_JoyHatEvent;
00181
00183 typedef struct SDL_JoyButtonEvent {
00184 Uint8 type;
00185 Uint8 which;
00186 Uint8 button;
00187 Uint8 state;
00188 } SDL_JoyButtonEvent;
00189
00194 typedef struct SDL_ResizeEvent {
00195 Uint8 type;
00196 int w;
00197 int h;
00198 } SDL_ResizeEvent;
00199
00201 typedef struct SDL_ExposeEvent {
00202 Uint8 type;
00203 } SDL_ExposeEvent;
00204
00206 typedef struct SDL_QuitEvent {
00207 Uint8 type;
00208 } SDL_QuitEvent;
00209
00211 typedef struct SDL_UserEvent {
00212 Uint8 type;
00213 int code;
00214 void *data1;
00215 void *data2;
00216 } SDL_UserEvent;
00217
00219 struct SDL_SysWMmsg;
00220 typedef struct SDL_SysWMmsg SDL_SysWMmsg;
00221 typedef struct SDL_SysWMEvent {
00222 Uint8 type;
00223 SDL_SysWMmsg *msg;
00224 } SDL_SysWMEvent;
00225
00227 typedef union SDL_Event {
00228 Uint8 type;
00229 SDL_ActiveEvent active;
00230 SDL_KeyboardEvent key;
00231 SDL_MouseMotionEvent motion;
00232 SDL_MouseButtonEvent button;
00233 SDL_JoyAxisEvent jaxis;
00234 SDL_JoyBallEvent jball;
00235 SDL_JoyHatEvent jhat;
00236 SDL_JoyButtonEvent jbutton;
00237 SDL_ResizeEvent resize;
00238 SDL_ExposeEvent expose;
00239 SDL_QuitEvent quit;
00240 SDL_UserEvent user;
00241 SDL_SysWMEvent syswm;
00242 } SDL_Event;
00243
00244
00245
00246
00251 extern DECLSPEC void SDLCALL SDL_PumpEvents(void);
00252
00253 typedef enum {
00254 SDL_ADDEVENT,
00255 SDL_PEEKEVENT,
00256 SDL_GETEVENT
00257 } SDL_eventaction;
00258
00277 extern DECLSPEC int SDLCALL SDL_PeepEvents(SDL_Event *events, int numevents,
00278 SDL_eventaction action, Uint32 mask);
00279
00284 extern DECLSPEC int SDLCALL SDL_PollEvent(SDL_Event *event);
00285
00290 extern DECLSPEC int SDLCALL SDL_WaitEvent(SDL_Event *event);
00291
00296 extern DECLSPEC int SDLCALL SDL_PushEvent(SDL_Event *event);
00297
00300 typedef int (SDLCALL *SDL_EventFilter)(const SDL_Event *event);
00323 extern DECLSPEC void SDLCALL SDL_SetEventFilter(SDL_EventFilter filter);
00324
00329 extern DECLSPEC SDL_EventFilter SDLCALL SDL_GetEventFilter(void);
00334 #define SDL_QUERY -1
00335 #define SDL_IGNORE 0
00336 #define SDL_DISABLE 0
00337 #define SDL_ENABLE 1
00338
00348 extern DECLSPEC Uint8 SDLCALL SDL_EventState(Uint8 type, int state);
00349
00350
00351 #ifdef __cplusplus
00352 }
00353 #endif
00354 #include "close_code.h"
00355
00356 #endif