全部博文(1958)
分类: LINUX
2011-03-17 17:39:50
SDL_Event -- General event structure
Structure Definitiontypedef union{ Uint8 type; //类型 SDL_ActiveEvent active; //激活 SDL_KeyboardEvent key; SDL_MouseMotionEvent motion; SDL_MouseButtonEvent button; SDL_JoyAxisEvent jaxis; SDL_JoyBallEvent jball; SDL_JoyHatEvent jhat; SDL_JoyButtonEvent jbutton; SDL_ResizeEvent resize; SDL_ExposeEvent expose; SDL_QuitEvent quit; SDL_UserEvent user; //SDL_UserEvent 这个类型的。用户定义事件。 SDL_SysWMEvent syswm; } SDL_Event;Structure Data
type | The type of event |
active | Activation event (see ) |
key | Keyboard event (see ) |
motion | Mouse motion event (see ) |
button | Mouse button event (see ) |
jaxis | Joystick axis motion event (see ) |
jball | Joystick trackball motion event (see ) |
jhat | Joystick hat motion event (see ) |
jbutton | Joystick button event (see ) |
resize | Application window resize event (see ) |
expose | Application window expose event (see ) |
quit | Application quit request event (see ) |
user | User defined event (see ) |
syswm | Undefined window manager event (see ) |
The union is the core to all event handling in SDL; it's probably the most important structure after . is a union of all event structures used in SDL, using it is a simple matter of knowing which union member relates to which event type.
Event type | Event Structure |
SDL_ACTIVEEVENT | |
SDL_KEYDOWN/UP | |
SDL_MOUSEMOTION | |
SDL_MOUSEBUTTONDOWN/UP | |
SDL_JOYAXISMOTION | |
SDL_JOYBALLMOTION | |
SDL_JOYHATMOTION | |
SDL_JOYBUTTONDOWN/UP | |
SDL_VIDEORESIZE | |
SDL_VIDEOEXPOSE | |
SDL_QUIT | |
SDL_USEREVENT | |
SDL_SYSWMEVENT |