|
⇤ ← Revision 1 as of 2010-07-29 16:41:02
Size: 939
Comment: create page, add content (7/28 changeset 4626)
|
Size: 794
Comment: Updated.
|
| Deletions are marked like this. | Additions are marked like this. |
| Line 3: | Line 3: |
| ||<tablewidth="100%" style="color: #FF0000;" :> DRAFT|| | |
| Line 16: | Line 15: |
| ||'''numevents'''||^the number of events to be allocated^|| | ||'''numevents'''||the number of events to be allocated|| |
| Line 22: | Line 21: |
| {{{#!highlight cpp You can add your code example here }}} |
<<Include(SDL_UserEvent, , , from="== Code Examples ==", to="== Remarks ==")>> |
| Line 27: | Line 24: |
| ''You can add useful comments here'' <<Color2(green,Is this a remark also or only a return value?)>> If there aren't enough user-defined events left, this function returns (Uint32)-1. |
Registering zero events is an error and will return (Uint32)-1. |
| Line 34: | Line 27: |
| .[[SDL_PushEvent]] |
SDL_RegisterEvents
Use this function to allocate a set of user-defined events, and return the beginning event number for that set of events.
Contents
Syntax
Uint32 SDL_RegisterEvents(int numevents)
Function Parameters
numevents |
the number of events to be allocated |
Return Value
The beginning event number, or (Uint32)-1 if there are not enough user-defined events left.
Code Examples
Uint32 myEventType = SDL_RegisterEvents(1);
if (myEventType != ((Uint32)-1)) {
SDL_Event event;
SDL_memset(&event, 0, sizeof(event)); /* or 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
Registering zero events is an error and will return (Uint32)-1.
