al_wait_for_event(3alleg5)

πŸ“¦
version 5.2.11.3 Β· 4 versions
, in debian trixie, ubuntu questing, ubuntu resolute, ubuntu stonking

πŸ’… al_wait_for_event β€” Allegro 5 API

okay bestie, sit down, hydrate, because this one is lowkey the moment you've been waiting for β€” literally. this is a page from the Allegro reference manual (the 3alleg5 era, if you're keeping track), and it's about one function and one function only: al_wait_for_event. she's simple, she's iconic, she's the bouncer at the door of your event queue. πŸŽ€


✨ SYNOPSIS ✨

#include <allegro5/allegro.h>

void al_wait_for_event(ALLEGRO_EVENT_QUEUE *queue, ALLEGRO_EVENT *ret_event)

that's it. two args. no drama. slay. πŸ’…


🌸 DESCRIPTION 🌸

so here's the vibe: al_wait_for_event does exactly what it says on the tin β€” it waits until the event queue you handed it is non-empty. not "polls", not "peeks", not "checks real quick and dips". it waits. main character energy, honestly β€” it's not moving until something shows up. πŸ¦‹

once the queue finally has something in it, here's where your second argument decides the plot:

  • if ret_event is not NULL, the first event in the queue gets copied into ret_event and then removed from the queue. so you got the event, the queue moved on, everybody ate. ✨
  • if ret_event is NULL, that first event just… stays there. right at the head of the queue. untouched. the function leaves it exactly where it was, like it never even touched it. πŸ™ˆ
ngl, that second case is the sneaky one β€” you blocked, you waited, and then you didn't actually take anything out of the queue. the event is still sitting there waiting for you. so if that's not what you wanted, that's on you, bestie. no cap. 😭

πŸ‘€ SEE ALSO πŸ‘€

the friend group, in order:

if al_wait_for_event is the one who waits forever, al_wait_for_event_timed and al_wait_for_event_until are the ones who wait with a deadline (they're the responsible ones), and al_get_next_event is the one who refuses to wait at all. pick your fighter. πŸ’œ


and that's the whole page, periodt. this masterpiece of documentation came out of the Allegro reference manual, under the page name al_wait_for_event(3alleg5) β€” so next time you cite it, cite it with respect. πŸ«ΆπŸ’– go forth and block your main loop responsibly. 🌈

πŸ“¦ where this page comes from