get_gfx_mode_list(3alleg4)

πŸ’– get_gfx_mode_list β€” bestie edition πŸ’–

okay so this one lives in the Allegro manual and it's section 3alleg4 if you're out here doing the whole man thing, slay. let's get into it 🫢


✨ NAME ✨

get_gfx_mode_list β€” obtains a list of available video modes. Allegro game programming library. periodt πŸ’…


🌸 SYNOPSIS 🌸

#include <allegro.h>

GFX_MODE_LIST *get_gfx_mode_list(int card);

look at her. so simple. so iconic. πŸ‘‘


πŸ¦‹ DESCRIPTION πŸ¦‹

so what this does is it attempts to create a list of all the supported video modes for a certain graphics driver, okay? and this list is made up from the GFX_MODE_LIST structure, which β€” and I need you to look at this β€” has the following definition:

typedef struct GFX_MODE_LIST
{
   int num_modes;
   GFX_MODE *mode;
} GFX_MODE_LIST;

and the mode entry points to the actual list of video modes. no cap. πŸ“

typedef struct GFX_MODE
{
   int width, height, bpp;
} GFX_MODE;

so it's giving width, height, and bpp for each one, and the list of video modes is terminated with an { 0, 0, 0 } entry β€” like a little "that's all bestie" sentinel at the end, iykyk 🌈

⚠️ okay so important one: the card parameter must refer to a _real_ driver. this function fails if you pass GFX_SAFE, GFX_AUTODETECT, or any other "magic" driver. the magic ones? not for this function. she said no thank u πŸ™ˆ

πŸ’œ RETURN VALUE πŸ’œ

returns a pointer to a list structure of the type GFX_MODE_LIST, or NULL if the request could not be satisfied. so like... check your pointers, bestie, that's the vibe check 😭


🌟 SEE ALSO 🌟

go read those too, they're all part of the same little friend group πŸ’–


and that's the whole page, my love ✨ this one's from Allegro, version 4.4.3, and the page itself is get_gfx_mode_list(3alleg4) β€” go forth and enumerate your video modes, main character energy only πŸ‘‘πŸŽ€πŸ’