desktop_color_depth(3)

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

✨ NAME ✨

okay so bestie, meet desktop_color_depth(3) β€” the function that literally finds out the desktop color depth. It lives in the Allegro game programming library, and it's here to help your program vibe with the user's actual desktop instead of guessing. πŸ’–

🌈 SYNOPSIS 🌈

#include <allegro.h>

int desktop_color_depth();

πŸ¦‹ DESCRIPTION πŸ¦‹

So what does it do? It finds out the currently selected desktop color depth. That's the info you need to make your program use the same color depth as the desktop. Why do you care? Because matching the desktop will likely make your program run faster β€” the graphic driver won't be doing unnecessary color conversions behind your back. No cap, it's giving performance. ✨

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 skip this step, bestie, or you'll get the wrong number. 😭

Example, periodt:

allegro_init();
...
if ((depth = desktop_color_depth()) != 0) {
   set_color_depth(depth);
}

πŸ’– RETURN VALUE πŸ’–

It returns the color depth, or 0 on platforms where this information is not available or does not apply. So if you get zero, that's the universe saying "not today, bestie." 🫢

πŸ‘‘ SEE ALSO πŸ‘‘


k bye bestie πŸ’… this was the Allegro manual, version 4.4.3, for desktop_color_depth(3) β€” go slay some graphics modes βœ¨πŸ‘‘

πŸ“¦ where this page comes from