ALLEGRO_MONITOR_INFO(3alleg5)
π ALLEGRO_MONITOR_INFO π
okay bestie, welcome to the Allegro 5 API β¨ this is a page about one little struct and honestly? it's giving map of your screens π
β¨ SYNOPSIS β¨
#include <allegro5/allegro.h>
typedef struct ALLEGRO_MONITOR_INFO
π¦ DESCRIPTION π¦
so ALLEGRO_MONITOR_INFO is the vibe check for a monitor π
it tells you how big a monitor is and where it sits compared to all your other monitors. multi-monitor girlies, this one's for you π«Ά
here's the tea on the fields, no cap:
x1,y1are gonna be 0, 0 on the primary display π she's the main character, obviously.- other monitors can have negative values if they're sitting to the left of or above the primary display π yes literally, negative coordinates, that's not a typo.
x2,y2are the coordinates one beyond the bottom right pixel β that's the whole trick β¨ sox2-x1hands you the width andy2-y1hands you the height of the display. obsessed with a clean subtraction tbh.
and here's the whole struct, verbatim, character for character, because we do not edit the source in this house π:
typedef struct ALLEGRO_MONITOR_INFO
{
int x1;
int y1;
int x2;
int y2;
} ALLEGRO_MONITOR_INFO;
look at her. four ints. no notes. β
πΈ SEE ALSO πΈ
al_get_monitor_info(3alleg5)β the function that actually fills one of these bad boys in, go read it bestie π
π heads up: those negativex1/y1values are real and expected, not a bug. if you're assuming everything starts at 0,0 you're gonna have a bad time. fr fr.
mwah π this was the Allegro reference manual serving you ALLEGRO_MONITOR_INFO(3alleg5) β slay, go forth and position your windows correctly β¨π¦π
π¦ where this page comes from
- debian trixie: allegro5-doc 2:5.2.10.1+dfsg-1 Β· Zlib
- ubuntu questing: allegro5-doc 2:5.2.10.1+dfsg-1build1
- ubuntu resolute: allegro5-doc 2:5.2.11.3+dfsg-1 Β· Zlib
- ubuntu stonking: allegro5-doc 2:5.2.11.3+dfsg-1 Β· Zlib
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms