ALLEGRO_USER_EVENT(3alleg5)
π ALLEGRO_USER_EVENT π
okay bestie, welcome to the Allegro 5 API β yes, that's the manual name, we're keeping it, and no we are not skipping anything. this is the whole page, every single field, every single line of code, all of it. slay. π«Ά
β¨ NAME β¨
ALLEGRO_USER_EVENT β the Allegro 5 API struct that lets you be the one cooking up events, not the library. main character energy, fr fr. π
π SYNOPSIS π
#include <allegro5/allegro.h>
typedef struct ALLEGRO_USER_EVENT ALLEGRO_USER_EVENT;
that's it. that's the whole vibe. π
π¦ DESCRIPTION π¦
so like β this is an event structure that can be emitted by user event sources. meaning: not the system, not the OS, not Allegro doing its thing behind the scenes β you. you're the event source now. iconic. β¨
these are the public fields, and bestie, we are listing all of them:
ALLEGRO_EVENT_SOURCE *source;intptr_t data1;intptr_t data2;intptr_t data3;intptr_t data4;
like every other event type out there, this structure is a part of the ALLEGRO_EVENT union. so if you've got an ALLEGRO_EVENT variable called ev, you reach into it like this:
ev.user.sourceev.user.data1ev.user.data2ev.user.data3ev.user.data4
no cap, that .user. is doing all the work. π
πΈ how to actually make one πΈ
to create a new user event you would do this β copy it exactly, it's not a suggestion, it's the recipe:
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);
look at that. al_init_user_event_source, a type tagged 'M','I','N','E', some data, and then al_emit_user_event. chef's kiss. ππ
π§ the rules, bestie π§
event type identifiers for user events are assigned by the user. that's you. that's your job now. π
please please please go read the docs for ALLEGRO_GET_EVENT_TYPE(3alleg5) because it lays out the rules you should follow when assigning those identifiers. not optional, don't freestyle it, iykyk. π
π SEE ALSO π
and that's the page!! π this was the Allegro reference manual, ALLEGRO_USER_EVENT(3alleg5) β go forth and emit your own events, bestie, you ate. π
β¨π¦
π¦ where this page comes from
- debian trixie: allegro5-doc 2:5.2.10.1+dfsg-1 Β· Zlib
- ubuntu questing: allegro5-doc 2:5.2.10.1+dfsg-1build1
- ubuntu resolute: allegro5-doc 2:5.2.11.3+dfsg-1 Β· Zlib
- ubuntu stonking: allegro5-doc 2:5.2.11.3+dfsg-1 Β· Zlib
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms