set_palette_range(3alleg4)
π set_palette_range β Allegro manual, bestie edition π
okay so you're in the Allegro game programming library, poking at palettes, and you want to update just a lil slice of it instead of the whole thing? say less. this is the one. β¨
β¨ NAME β¨
set_palette_range β sets a specific range of the palette. literally just that. Allegro game programming library, mwah π
π SYNOPSIS π
#include <allegro.h>
void set_palette_range(const PALETTE p, int from, int to, int vsync);
π¦ DESCRIPTION π¦
so here's the vibe: set_palette_range sets the palette entries between from and to, and yes bestie, that's inclusive on both ends π«Ά. want the entire palette? pass 0 and 255 and you're done, no cap.
now the vsync parameter, okay, this is the important part:
- if
vsyncis set, it waits for the vertical retrace before doing the thing - otherwise it just sets the colors immediately
both are valid, just depends on whether you want to be polite to your display or not π
example time, here's the exact one:
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);
see how 0, 15, 1 is giving "first sixteen entries, and yeah wait for vsync please"? iconic. π
π SEE ALSO π
k that's the whole page bestie, go forth and recolor π
this was the Allegro manual, version 4.4.3 β thanks for reading, ily, bye!! πβ¨π¦
π¦ where this page comes from
- debian bookworm: allegro4-doc 2:4.4.3.1-3 Β· Allegro-gift-ware
- debian trixie: allegro4-doc 2:4.4.3.1-5 Β· Allegro-gift-ware
- ubuntu jammy: allegro4-doc 2:4.4.3.1-2 Β· Allegro-gift-ware
- ubuntu noble: allegro4-doc 2:4.4.3.1-4.1build3 Β· Allegro-gift-ware
- ubuntu questing: allegro4-doc 2:4.4.3.1-6
- ubuntu resolute: allegro4-doc 2:4.4.3.1-7 Β· Allegro-gift-ware
- ubuntu stonking: allegro4-doc 2:4.4.3.1-9 Β· Allegro-gift-ware
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms