set_color_depth(3)

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

πŸ’… set_color_depth β€” Allegro manual, section 3 πŸŽ€

okay bestie, welcome to set_color_depth(3) β€” she's a lil Allegro library function from the Allegro manual and she's here to set your global pixel color depth. yes queen. global. πŸ¦‹


✨ SYNOPSIS ✨

#include <allegro.h>

void set_color_depth(int depth);

one function, one int, zero drama. she takes exactly one argument and returns nothing. periodt. πŸ’…


🌸 DESCRIPTION 🌸

so here's the tea: set_color_depth() sets the pixel format that all your subsequent calls to set_gfx_mode() and create_bitmap() are gonna use. it's giving "setting the vibe in advance" energy. ✨

the depths that are actually valid (aka the guest list πŸ’Œ):

  • 8 β€” and this one is the default, so if you never call this function, this is what you're getting, no cap
  • 15
  • 16
  • 24
  • 32

that's it. that's the list. if you pass something else, don't look at me. πŸ™ˆ

here's the iconic example, copy it, it's cute:

set_color_depth(32);
if (set_gfx_mode(GFX_AUTODETECT, 640, 480, 0, 0) != 0) {
   abort_on_error("Couldn't set a 32 bit color resolution");
}

see how she calls set_color_depth(32) first and then set_gfx_mode(...)? that's the order, bestie. that's the whole bit. πŸ”₯

⚠️ IMPORTANT SIDE QUEST: the screen color depth won't actually change until the next successful call to set_gfx_mode(). so don't be out here calling set_color_depth() and expecting the screen to glow up instantly. she's patient. she waits. 🧚

πŸ‘€ SEE ALSO πŸ‘€

the squad, the friend group, the girlies:

go read them too, they ate. πŸ’–


and that's the whole page!! tysm for coming to my ted talk, this was Allegro version 4.4.3 and the manual page was set_color_depth(3). mwah, love u, go make something pretty with 32-bit color. πŸ‘‘βœ¨πŸ’œ

πŸ“¦ where this page comes from