desktop_color_depth(3alleg4)
β¨ desktop_color_depth β¨
okay bestie, we're in the Allegro manual and today's main character is desktop_color_depth β a lil function from the Allegro game programming library that finds out what your desktop's color depth is. π
πΈ NAME πΈ
desktop_color_depth β finds out the desktop color depth. Allegro game programming library. periodt. π
π SYNOPSIS π
#include <allegro.h>
int desktop_color_depth();
π¦ DESCRIPTION π¦
so literally what this does is find out the currently selected desktop color depth. and why do you care?? because you can use that info to make your program run at the same color depth as the desktop, which will likely make it run faster since the graphic driver won't be doing a bunch of unnecessary color conversions behind your back. the way it was secretly doing extra work the whole time π slay that we can stop it.
π«Ά heads up bestie: under some OSes, switching to a full screen graphics mode may automatically change the desktop color depth. so you have, therefore, to call this function before setting any graphics mode in order to retrieve the real desktop color depth. don't do it after, it's giving lies.
example, because we love a visual:
allegro_init();
...
if ((depth = desktop_color_depth()) != 0) {
set_color_depth(depth);
}
π RETURN VALUE π
returns the color depth β¨ or zero on platforms where this information is not available or does not apply. zero is the "idk bestie, not my business" answer. π
π SEE ALSO π
get_desktop_resolution(3alleg4)π«set_color_depth(3alleg4)π¨set_gfx_mode(3alleg4)π₯οΈ
and that's the whole vibe!! go forth and match your color depth, you absolute icon π
Allegro, version 4.4.3 β mwah, tysm for reading, ily, see u in the next manpage bestie πππ¦πΈπ π«Άβ¨
π¦ where this page comes from
- debian bookworm: allegro4-doc 2:4.4.3.1-3 Β· Allegro-gift-ware
- debian trixie: allegro4-doc 2:4.4.3.1-5 Β· Allegro-gift-ware
- ubuntu jammy: allegro4-doc 2:4.4.3.1-2 Β· Allegro-gift-ware
- ubuntu noble: allegro4-doc 2:4.4.3.1-4.1build3 Β· Allegro-gift-ware
- ubuntu questing: allegro4-doc 2:4.4.3.1-6
- ubuntu resolute: allegro4-doc 2:4.4.3.1-7 Β· Allegro-gift-ware
- ubuntu stonking: allegro4-doc 2:4.4.3.1-9 Β· Allegro-gift-ware
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms