SCREEN_W(3)
π SCREEN_W, SCREEN_H π
okay bestie, so this is the Allegro manual, section 3, and today we're talking about two lil global defines that tell you how big your screen is. That's it. That's the whole vibe. It's giving "tiny but mighty" β¨
πΈ NAME πΈ
SCREEN_W, SCREEN_H β global defines to get the size of the screen. Part of the Allegro game programming library, obvi π
β¨ SYNOPSIS β¨
#include <allegro.h>
#define SCREEN_W;
#define SCREEN_H;
yes bestie, they're literally just defines. no arguments, no return values, no drama π
π¦ DESCRIPTION π¦
So these are global defines that hand you back the width and height of the screen. That's SCREEN_W for width and SCREEN_H for height, in case the names weren't already screaming it at you π
Important lil note: if the screen hasn't been initialised yet, they both return zero. So like, don't be out here doing math with them before you've set up your graphics mode, or you're gonna get a whole lot of nothing. Zero. Nada. π
Here's the example from the page, look how cute it is:
char buf[100];
...
uszprintf(buf, sizeof(buf),
"The screen size is %d x %d pixels",
SCREEN_W, SCREEN_H);
not me actually being obsessed with how clean that is π go off, uszprintf.
π₯ SEE ALSO π₯
and that's the whole page, bestie!! this gorgeous lil number is from Allegro, version 4.4.3 β go read it, go use it, go slay π πβ¨π«Ά
π¦ where this page comes from
- fedora 43: allegro-devel 4.4.3.1-18.fc43 Β· Giftware
- fedora 43: allegro-devel 4.4.3.1-18.fc43 Β· Giftware
- fedora 44: allegro-devel 4.4.3.1-20.fc44 Β· Giftware
- fedora 44: allegro-devel 4.4.3.1-20.fc44 Β· Giftware
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms