alert(3alleg4)

πŸ’– alert β€” bestie edition πŸ’–

okay so real talk: this is a page from the Allegro manual (3alleg4), and it's all about that lil popup box that goes ding and tells you something. slay.


✨ NAME ✨

alert β€” pops up an alert box like "hey girl, heads up". it's part of the Allegro game programming library πŸŽ€


🌸 SYNOPSIS 🌸

#include <allegro.h>

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

πŸ¦‹ DESCRIPTION πŸ¦‹

so basically it displays a popup alert box, and this box is giving main character energy β€” it holds three lines of text (s1-s3), and it comes with either one or two buttons. your choice, diva.

the text on those buttons gets passed in b1 and b2 β€” and heads up, b2 may be NULL if you're only doing the one-button thing. no shame in being lowkey.

the keyboard shortcuts? those go in c1 and c2, passed as ASCII value. iykyk.

here's an example that's literally iconic:

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

πŸ‘‘ RETURN VALUE πŸ‘‘

it returns 1 or 2, depending on which button got clicked. simple as that, no cap.

⚠️ but wait β€” if the alert gets dismissed by pressing ESC when ESC is not one of the keyboard shortcuts, it treats that as a click on the second button. and fr fr that makes sense, it's consistent with the common "Ok", "Cancel" alert. so ESC = cancel, periodt.

🌈 SEE ALSO 🌈

go read those next bestie, they ate πŸ’…


this lil page came straight from the Allegro manual, version 4.4.3 β€” the 3alleg4 section, to be exact. mwah, bye πŸ’œβœ¨