Size: 767
Comment: update content - changeset 4624
|
Size: 1441
Comment: SDL_RegisterEvent -> SDL_RegisterEvents (from Feedback).
|
Deletions are marked like this. | Additions are marked like this. |
Line 3: | Line 3: |
||<tablewidth="100%" style="color: #FF0000;" :> DRAFT|| | |
Line 6: | Line 5: |
A structure that contains a user-defined event type (event.user.*). | A structure that contains an application-defined event type. |
Line 11: | Line 10: |
||Uint32||'''type'''||SDL_USEREVENT through SDL_NUMEVENTS-1|| | ||Uint32||'''type'''||value obtained from [[SDL_RegisterEvents]]()|| ||Uint32||'''timestamp'''||timestamp of the event|| |
Line 13: | Line 13: |
||int||'''code'''||user defined event code|| | ||Sint32||'''code'''||user defined event code|| |
Line 19: | Line 19: |
You can add your code example here | Uint32 myEventType = SDL_RegisterEvents(1); if (myEventType != ((Uint32)-1)) { SDL_Event event; SDL_zero(event); event.type = myEventType; event.user.code = my_event_code; event.user.data1 = significant_data; event.user.data2 = 0; SDL_PushEvent(&event); } |
Line 23: | Line 32: |
''You can add useful comments here'' | [[SDL_UserEvent]] is in the '''user''' member of the [[SDL_Event]] union. This event is unique; it is never created by SDL but only by the application. The event can be pushed onto the event queue using [[SDL_PushEvent]](). The contents of the structure members are completely up to the programmer; the only requirement is that '''type''' is a value obtained from [[SDL_RegisterEvents]](). |
Line 26: | Line 35: |
.[[SDL_EventType]]??? | .[[SDL_EventType]] |
Line 29: | Line 38: |
.[[SDL_RegisterEvents]] .[[SDL_PushEvent]] |
|
Line 31: | Line 42: |
[[CategoryStruct]] | [[CategoryStruct]], [[CategoryEvents]] |
SDL_UserEvent
A structure that contains an application-defined event type.
Data Fields
Uint32 |
type |
value obtained from SDL_RegisterEvents() |
Uint32 |
timestamp |
timestamp of the event |
Uint32 |
windowID |
the associated window, if any |
Sint32 |
code |
user defined event code |
void* |
data1 |
user defined data pointer |
void* |
data2 |
user defined data pointer |
Code Examples
Uint32 myEventType = SDL_RegisterEvents(1);
if (myEventType != ((Uint32)-1)) {
SDL_Event event;
SDL_zero(event);
event.type = myEventType;
event.user.code = my_event_code;
event.user.data1 = significant_data;
event.user.data2 = 0;
SDL_PushEvent(&event);
}
Remarks
SDL_UserEvent is in the user member of the SDL_Event union. This event is unique; it is never created by SDL but only by the application. The event can be pushed onto the event queue using SDL_PushEvent(). The contents of the structure members are completely up to the programmer; the only requirement is that type is a value obtained from SDL_RegisterEvents().
Related Enumerations