set_palette(3alleg4)

✨ set_palette ✨

okay bestie, welcome to the set_palette(3alleg4) page from the Allegro manual β€” yes that Allegro, the game programming library, and yes we're about to talk about 256 colors of pure vibes πŸ’…


🌸 NAME 🌸

set_palette β€” sets the entire palette of 256 colors. Allegro game programming library. periodt.


πŸŽ€ SYNOPSIS πŸŽ€

#include <allegro.h>

void set_palette(const PALETTE p);

πŸ¦‹ DESCRIPTION πŸ¦‹

okay so here's the tea β˜• β€” this function sets the entire palette of 256 colors, all of them, the whole squad, no stragglers. You gotta hand it an array of 256 RGB structures and it will absolutely deliver. 🫢

and here's the part that lowkey makes it iconic: unlike set_color(), you do not need to call vsync() before this one. no pre-gaming required, she just goes. πŸ’–

Example, because a visual is everything:

BITMAP *bmp;
PALETTE palette;
...
bmp = load_bitmap(filename, palette);
if (!bmp)
   abort_on_error("Couldn't load bitmap!");
set_palette(palette);

see how it loads the bitmap and the palette in one move? main character energy fr fr. ✨


🌈 SEE ALSO 🌈

iykyk β€” go read those next, they're all in the same friend group. πŸ‘‘


and that's the whole page, bestie!! this was set_palette(3alleg4) from Allegro version 4.4.3 β€” the Allegro manual, section 3, living its best life. mwah, take care of your palettes and they'll take care of you πŸ’œπŸŽ€