get_color_depth(3)

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

✨ get_color_depth ✨

okay so bestie, welcome to the Allegro manual πŸ’– this one's called get_color_depth(3) and it's genuinely so useful, no cap.


🌸 NAME 🌸

get_color_depth β€” returns the current pixel color depth. Part of the Allegro game programming library. πŸŽ€


πŸ¦‹ SYNOPSIS πŸ¦‹

#include <allegro.h>

int get_color_depth(void);

πŸ’… DESCRIPTION πŸ’…

So basically it returns the current pixel format. ✨

And like… why do you care? Because this is the move when you wanna write generic functions that internally pick a different code path depending on which color depth is being used. it's giving "one function, many depths", and honestly? iconic. πŸ‘‘

🫢 heads up bestie, this is the important part: the function returns whatever value you set previously with set_color_depth(), which can be different from the current color depth of the screen global variable. so if you really need to know the color depth of the screen, use bitmap_color_depth() instead. fr fr. don't get caught lacking. 😭

🌈 SEE ALSO 🌈


Allegro, version 4.4.3 β€” and that's the whole page, get_color_depth(3), slay πŸ’…βœ¨ go check your depths bestie, you got this πŸ¦‹πŸ’–πŸŽ€

πŸ“¦ where this page comes from