get_gfx_mode_type(3alleg4)

๐Ÿ’– get_gfx_mode_type ๐Ÿ’–

okay bestie, so this one lives in the Allegro manual (yes, the Allegro game programming library, the one that makes graphics happen ๐ŸŽจโœจ) and it's called get_gfx_mode_type. She's a lil function with a big job and honestly? she ate.


๐ŸŒธ SYNOPSIS ๐ŸŒธ

#include <allegro.h>

int get_gfx_mode_type(int graphics_card);

like, one include, one call, zero drama. we love a low-maintenance icon. ๐Ÿซถ


โœจ DESCRIPTION โœจ

okay so here's the vibe: this function lets you figure out the types of operating modes that a specific graphics card driver operates in. like, is this driver a windowed girlie? a fullscreen girlie? is she definitely one of those?? is she a magic driver?? ๐Ÿ”ฎ this function will literally tell you. no cap.

The value it hands back is a bitfield, and that bitfield is made up of these fields:

  • GFX_TYPE_UNKNOWN
  • GFX_TYPE_WINDOWED
  • GFX_TYPE_FULLSCREEN
  • GFX_TYPE_DEFINITE
  • GFX_TYPE_MAGIC
okay important!! the return value will only be equivalent to GFX_TYPE_UNKNOWN when it's a driver that's unrecognized on that platform, or when it's just a bogus value. ๐Ÿ’€

Test for the other types by using a bitwise AND. and here's the cute part โ€” if the driver is windowed or fullscreen, it will also have the DEFINITE flag set. so you get a lil bonus flag, as a treat ๐ŸŽ€

for example:

int gfx_type = get_gfx_mode_type(GFX_AUTODETECT_WINDOWED);

in that case, gfx_type would have the GFX_TYPE_WINDOWED, GFX_TYPE_DEFINITE, and GFX_TYPE_MAGIC flags set. all three!! main character bitfield energy, honestly ๐Ÿ‘‘

also, before you do literally any of this: Allegro needs to be initialized first. don't skip that step bestie, that's the whole thing.

Example:

/* Accept the use of only windowed drivers in our selection dialog */
int accept_windowed(int card , int w , int h , int color_depth)
{
   if (get_gfx_mode_type(card) & GFX_TYPE_WINDOWED)
      return 0;
   return 1;
}

/* In main: */
gfx_mode_select_filter(&card, &w, &h, &color_depth, accept_windowed);

look at that callback go. she's filtering. she's returning. she's serving โœจ


๐ŸŒˆ RETURN VALUE ๐ŸŒˆ

Returns a bitfield describing the graphics mode type. that's it, that's the tea โ˜•๐Ÿ’…


๐Ÿฆ‹ SEE ALSO ๐Ÿฆ‹

go read those too, they're all in the same friend group fr fr ๐Ÿซ‚


and that's the whole page, bestie!! this was Allegro, version 4.4.3 โ€” mwah, love that for us. stay initialized out there ๐Ÿ’–โœจ๐ŸŽ€๐Ÿฆ‹๐ŸŒธ