set_color_depth(3)
π 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 cap15162432
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 toset_gfx_mode(). so don't be out here callingset_color_depth()and expecting the screen to glow up instantly. she's patient. she waits. π§
π SEE ALSO π
the squad, the friend group, the girlies:
get_color_depth(3)set_gfx_mode(3)set_color_conversion(3)makecol(3)getr(3)desktop_color_depth(3)
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
- fedora 43: allegro-devel 4.4.3.1-18.fc43 Β· Giftware
- fedora 43: allegro-devel 4.4.3.1-18.fc43 Β· Giftware
- fedora 44: allegro-devel 4.4.3.1-20.fc44 Β· Giftware
- fedora 44: allegro-devel 4.4.3.1-20.fc44 Β· Giftware
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms