Wiki Page Content

Differences between revisions 8 and 9
Revision 8 as of 2013-06-16 09:42:01
Size: 1539
Comment: Updated types to match SDL_events.h.
Revision 9 as of 2013-08-08 21:52:12
Size: 1258
Editor: RyanGordon
Comment: Edited
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 18: Line 17:
*<<BR>>
Line 21: Line 19:
SDL_zero(event);
Line 27: Line 25:
}}}<<BR>>*
<<Color2(green,Does this example need the '''windowID''' param added?)>>
}}}
Line 31: Line 28:
*<<BR>>[[SDL_UserEvent]] is in the '''user''' member of the ,,structure,, [[SDL_Event]] ^union^. This event is unique; it is never created by SDL but only by the user. The event can be pushed onto the event queue using [[SDL_PushEvent]](). The contents of the structure members <<Color2(green,(SDL_!UserEvent or SDL_Event? Unclear.)>> are completely up to the programmer, <<Color2(green,not sure of the comma here. Consider ; . -)>> the only requirement is that '''type''' is a value from SDL_USEREVENT to SDL_NUMEVENTS-1 (inclusive). <<BR>>* [[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 from SDL_USEREVENT to SDL_NUMEVENTS-1 (inclusive).

SDL_UserEvent

A structure that contains an application-defined event type.

Data Fields

Uint32

type

SDL_USEREVENT through SDL_NUMEVENTS-1

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

SDL_Event event;
SDL_zero(event);
event.type = SDL_USEREVENT;
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 from SDL_USEREVENT to SDL_NUMEVENTS-1 (inclusive).


CategoryStruct, CategoryEvents

None: SDL_UserEvent (last edited 2015-10-29 21:58:30 by PhilippWiesemann)

Feedback
Please include your contact information if you'd like to receive a reply.
Submit