set_color_depth(3alleg4)

set_color_depth πŸ’–

okay bestie, welcome to the Allegro manual β€” specifically the set_color_depth(3alleg4) page, and yes it's the Allegro game programming library, we're being ✨fancy✨ today.


✨ NAME ✨

set_color_depth β€” sets the global pixel color depth πŸ’… (Allegro game programming library, for all my game-dev girlies πŸŽ€)


πŸ¦‹ SYNOPSIS πŸ¦‹

#include <allegro.h>

void set_color_depth(int depth);

🌸 DESCRIPTION 🌸

So basically this function sets the pixel format that all your future calls to set_gfx_mode() and create_bitmap() are gonna use. It's giving "setting the vibe before the party starts" πŸ‘‘

The valid depths are 8 (which is the default, no cap), 15, 16, 24, and 32 bits. Pick your fighter πŸ’–

Example, since a demo always eats:

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");
}
⚠️ okay important, don't skip this: the screen color depth won't actually change until the next successful call to set_gfx_mode(). So like, setting it does nothing visible on its own. It's the setup, not the show. fr fr 🫢

πŸ’œ SEE ALSO πŸ’œ


and that's the whole page, bestie!! this was Allegro version 4.4.3, served fresh from the set_color_depth(3alleg4) manual page, and honestly? iconic. go set your color depth and slay πŸ’…βœ¨πŸŒˆπŸ‘‘