1al_emit_user_event(3) al_emit_user_event(3)
2
3
4
6 al_emit_user_event - Allegro 5 API
7
9 #include <allegro5/allegro.h>
10
11 bool al_emit_user_event(ALLEGRO_EVENT_SOURCE *src,
12 ALLEGRO_EVENT *event, void (*dtor)(ALLEGRO_USER_EVENT *))
13
15 Emit an event from a user event source. The event source must have
16 been initialised with al_init_user_event_source(3). Returns false if
17 the event source isn’t registered with any queues, hence the event
18 wouldn’t have been delivered into any queues.
19
20 Events are copied in and out of event queues, so after this function
21 returns the memory pointed to by event may be freed or reused. Some
22 fields of the event being passed in may be modified by the function.
23
24 Reference counting will be performed if dtor is not NULL. Whenever a
25 copy of the event is made, the reference count increases. You need to
26 call al_unref_user_event(3) to decrease the reference count once you
27 are done with a user event that you have received from
28 al_get_next_event(3), al_peek_next_event(3), al_wait_for_event(3), etc.
29
30 Once the reference count drops to zero dtor will be called with a copy
31 of the event as an argument. It should free the resources associated
32 with the event, but not the event itself (since it is just a copy).
33
34 If dtor is NULL then reference counting will not be performed. It is
35 safe, but unnecessary, to call al_unref_user_event(3) on non-reference
36 counted user events.
37
38 You can use al_emit_user_event to emit both user and non-user events
39 from your user event source. Note that emitting input events will not
40 update the corresponding input device states. For example, you may
41 emit an event of type ALLEGRO_EVENT_KEY_DOWN(3), but it will not update
42 the ALLEGRO_KEYBOARD_STATE(3) returned by al_get_keyboard_state(3).
43
45 ALLEGRO_USER_EVENT(3), al_unref_user_event(3)
46
47
48
49Allegro reference manual al_emit_user_event(3)