alert(3)

πŸ“¦ version 4.4.3.1, in fedora 43, fedora 44

✨ alert(3) ✨

okay bestie, we're diving into the Allegro manual today and this one is literally the popup-alert-box function from the Allegro game programming library πŸ’–


🌸 NAME 🌸

alert β€” displays a popup alert box. yeah that's it. that's the whole job. Allegro game programming library, iykyk πŸŽ€


πŸ¦‹ SYNOPSIS πŸ¦‹

#include <allegro.h>

int alert(const char *s1, *s2, *s3, const char *b1, *b2, int c1, c2);

πŸ’… DESCRIPTION πŸ’…

So basically alert pops up a whole alert box on screen for you. it's giving three lines of text (s1–s3) plus one or two buttons. you pass the button text in b1 and b2 β€” and heads up, b2 is allowed to be NULL if you only want one button, no drama 🫢

the keyboard shortcuts for those buttons go in c1 and c2, as an ASCII value. periodt.

example time, and yes it's cute:

if (!exists(CONFIG_FILE))
   alert(CONFIG_FILE, "not found.", "Using defaults.",
         "&Continue", NULL, 'c', 0);

🌈 RETURN VALUE 🌈

returns 1 or 2 depending on which button got clicked. that's your vibe check on what the user chose πŸ‘‘

but okay here's the little plot twist: if the alert gets dismissed by pressing ESC and ESC is not one of the keyboard shortcuts, it treats that as a click on the second button. and honestly? that's consistent with the classic "Ok" / "Cancel" alert situation, so it makes sense, no cap πŸ’―


⭐ SEE ALSO ⭐


okay that's the whole page bestie, go forth and pop up some alerts πŸ’– this was the Allegro manual, version 4.4.3, and you just read alert(3) β€” slay βœ¨πŸŽ€πŸ¦‹

πŸ“¦ where this page comes from