fli_pal_dirty_from(3alleg4)
π fli_pal_dirty_from β bestie edition
okay so this is from the Allegro manual (yes, the Allegro game programming library, we love her) and the page is called fli_pal_dirty_from(3alleg4). Two lil global ints, one big job: telling you which slice of your palette just changed. let's get into it π
β¨ NAME β¨
fli_pal_dirty_from, fli_pal_dirty_to β indicate which parts of the palette have changed. Allegro game programming library. periodt.
πΈ SYNOPSIS πΈ
#include <allegro.h>
extern int fli_pal_dirty_from;
extern int fli_pal_dirty_to;
π¦ DESCRIPTION π¦
okay so picture this: these two variables get set by next_fli_frame(), and what they're telling you is which part of the fli_palette has changed since the last time somebody called reset_fli_variables(). it's giving receipts π
here's the tea tho, the logic is lowkey backwards-cute:
- if
fli_pal_dirty_fromis greater thanfli_pal_dirty_to, that means the palette has not changed at all. nothing happened. go home. π - otherwise, colors
fli_pal_dirty_fromtofli_pal_dirty_to(inclusive, bestie, don't forget the endpoints) have altered. π
and the whole point of knowing this?? it's so you can use it while you're updating the hardware palette and avoid unnecessary calls to set_palette(). no cap, stop wasting cycles on palette ranges that didn't even move. she's efficient. she's iconic. π«Ά
example, fresh from the source:
if (fli_pal_dirty_from <= fli_pal_dirty_to)
set_palette_range(fli_palette, fli_pal_dirty_from,
fli_pal_dirty_to, 1);
see how she checks the condition first? main character energy fr fr π₯
π SEE ALSO π
go read those next, iykyk π
ngl this is the kind of tiny optimization that makes you feel like a genius. use it. π
and that's the whole page babes β¨ this was Allegro, version 4.4.3 β fli_pal_dirty_from(3alleg4), brought to you with love, extern int energy, and exactly zero unnecessary set_palette() calls. mwah ππ
π¦ 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