set_color(3)

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

✨ set_color(3) ✨

okay bestie, welcome to the Allegro manual πŸ’– this one's a little guy but it's IMPORTANT, so let's go 🫢


🌸 NAME 🌸

set_color β€” sets the specified palette entry to the specified RGB triplet. it's giving Allegro game programming library energy πŸ’…


πŸŽ€ SYNOPSIS πŸŽ€

#include <allegro.h>

void set_color(int index, const RGB *p);

πŸ¦‹ DESCRIPTION πŸ¦‹

okay so, set_color sets the specified palette entry to the specified RGB triplet. that's the whole vibe, literally. you hand it an index and a pointer to an RGB, and it slots that colour right into your palette 🎨

BUT β€” and this is the part where you gotta pay attention, no cap β€” unlike the other palette functions, this one does NOT do any retrace synchronisation 😭 so if you just raw-dog it mid-frame you're gonna get snow problems on your screen. the fix? call vsync() before it, and you're golden ✨

example, bestie:

RGB rgb;
...
vsync();
set_color(192, &rgb);

see how the vsync() comes first? that's the whole trick, iykyk πŸ‘‘


🌈 SEE ALSO 🌈


and that's the whole page, periodt πŸ’œ this was the Allegro manual, version 4.4.3 β€” mwah, go make something pretty with it πŸ“πŸ§šπŸ’–

πŸ“¦ where this page comes from