SCREEN_W(3alleg4)

πŸ’– SCREEN_W β€” okay bestie, it's giving screen dimensions πŸ’–

3alleg4 · the Allegro game programming library manual ✨


🌸 NAME 🌸

SCREEN_W, SCREEN_H β€” the global defines that hand you the size of the screen, no cap. Part of the Allegro game programming library πŸ’…


πŸŽ€ SYNOPSIS πŸŽ€

#include <allegro.h>

#define SCREEN_W;

#define SCREEN_H;

✨ DESCRIPTION ✨

So these are global defines, right? And they return the width and the height of the screen. That's it. That's the whole vibe. πŸ¦‹

But listen β€” and this is the important part β€” if the screen hasn't been initialised yet, they give you zero. Zero!! Not a crash, not a lie, just a big fat 0. So if your numbers are looking real empty, that's your sign to go init the screen first, bestie. 😭

Here's the example, and yes it's iconic:

char buf[100];
...
uszprintf(buf, sizeof(buf),
          "The screen size is %d x %d pixels",
          SCREEN_W, SCREEN_H);

Look at that. SCREEN_W and SCREEN_H just dropped straight into your uszprintf like they own the place. main character energy fr fr πŸ‘‘


πŸ’œ SEE ALSO πŸ’œ


Allegro, version 4.4.3 β€” and that's the SCREEN_W(3alleg4) page, mwah πŸ’‹ go forth and measure your screen, you've got this 🫢🌸