SCREEN_W(3)

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

πŸ’– 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