ALLEGRO_MONITOR_INFO(3alleg5)

πŸ“¦
version 5.2.11.3 Β· 4 versions
, in debian trixie, ubuntu questing, ubuntu resolute, ubuntu stonking

πŸ’– 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, y1 are 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, y2 are the coordinates one beyond the bottom right pixel β€” that's the whole trick ✨ so x2-x1 hands you the width and y2-y1 hands 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 🌸


πŸŽ€ heads up: those negative x1/y1 values 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