set_palette_range(3)

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

✨ NAME ✨

okay so this is set_palette_range(3), straight out of the Allegro manual πŸ’– β€” and it does exactly one iconic thing: it sets a specific range of the palette. no cap.

set_palette_range β€” Sets a specific range of the palette. Allegro game programming library.


πŸŽ€ SYNOPSIS πŸŽ€

#include <allegro.h>

void set_palette_range(const PALETTE p, int from, int to, int vsync);

πŸ¦‹ DESCRIPTION πŸ¦‹

bestie, listen. this function sets the palette entries between from and to β€” and yes, inclusive, so both endpoints get changed too πŸ’…. if you wanna set the entire palette, you pass 0 and 255. periodt.

now about vsync: if it's set, the function waits for the vertical retrace before doing its thing. if it's not set, it sets the colors immediately. no waiting, no drama, just colors. ✨

example time, because seeing it is believing:

PALETTE palette;
...
/* Modify the first 16 entries. */
change_first_16_colors(palette);
/* Now update them waiting for vsync. */
set_palette_range(palette, 0, 15, 1);

like… the way that it updates entries 0 through 15 and waits for vsync? obsessed. 🫢


🌸 SEE ALSO 🌸


and that's the whole vibe check, bestie. go forth and palette responsibly πŸ’–

Allegro version 4.4.3 β€” set_palette_range(3) β€” mwah, slay, bye πŸ‘‘πŸ’…βœ¨

πŸ“¦ where this page comes from