1SDL_UserEvent(3) SDL API Reference SDL_UserEvent(3)
2
3
4
6 SDL_UserEvent - A user-defined event type
7
9 typedef struct{
10 Uint8 type;
11 int code;
12 void *data1;
13 void *data2;
14 } SDL_UserEvent;
15
17 type SDL_USEREVENT through to SDL_NUMEVENTS-1
18
19 code User defined event code
20
21 data1 User defined data pointer
22
23 data2 User defined data pointer
24
26 SDL_UserEvent is in the user member of the structure SDL_Event. This
27 event is unique, it is never created by SDL but only by the user. The
28 event can be pushed onto the event queue using SDL_PushEvent. The con‐
29 tents of the structure members or completely up to the programmer, the
30 only requirement is that type is a value from SDL_USEREVENT to
31 SDL_NUMEVENTS-1 (inclusive).
32
34 SDL_Event event;
35
36 event.type = SDL_USEREVENT;
37 event.user.code = my_event_code;
38 event.user.data1 = significant_data;
39 event.user.data2 = 0;
40 SDL_PushEvent(&event);
41
43 SDL_Event, SDL_PushEvent
44
45
46
47SDL Tue 11 Sep 2001, 23:00 SDL_UserEvent(3)