ALLEGRO_USER_EVENT
Allegro 5 API
- Provided by: allegro5-doc (Version: 2:5.0.11-2)
- Source: allegro5
- Report a bug
Allegro 5 API
#include <allegro5/allegro.h>
typedef struct ALLEGRO_USER_EVENT ALLEGRO_USER_EVENT;
An event structure that can be emitted by user event sources. These are the public fields:
Like all other event types this structure is a part of the ALLEGRO_EVENT union. To access the fields in an ALLEGRO_EVENT variable ev, you would use:
To create a new user event you would do this:
ALLEGRO_EVENT_SOURCE my_event_source;
ALLEGRO_EVENT my_event;
float some_var;
al_init_user_event_source(&my_event_source);
my_event.user.type = ALLEGRO_GET_EVENT_TYPE('M','I','N','E');
my_event.user.data1 = 1;
my_event.user.data2 = &some_var;
al_emit_user_event(&my_event_source, &my_event, NULL);
Event type identifiers for user events are assigned by the user. Please see the documentation for ALLEGRO_GET_EVENT_TYPE(3alleg5) for the rules you should follow when assigning identifiers.
al_emit_user_event(3alleg5), ALLEGRO_GET_EVENT_TYPE(3alleg5)