fli_bmp_dirty_from(3)
π fli_bmp_dirty_from, fli_bmp_dirty_to π
okay bestie, so this is from the Allegro manual (yes, the game programming library, the one that lives in fli_bmp_dirty_from(3)) and it's genuinely such a small page but it's SO useful, i promise π«Ά
β¨ NAME β¨
fli_bmp_dirty_from, fli_bmp_dirty_to β literally just telling you which parts of the image have changed. that's it. that's the whole job. Allegro game programming library, periodt π
πΈ SYNOPSIS πΈ
#include <allegro.h>
extern int fli_bmp_dirty_from;
extern int fli_bmp_dirty_to;
two lil extern int globals, living their best life π
π¦ DESCRIPTION π¦
okay so listen. these two variables get set by next_fli_frame() and what they do is tell you which part of the fli_bitmap has changed since the last time somebody called reset_fli_variables(). iconic behaviour honestly π
here's the vibe check on the logic:
- if
fli_bmp_dirty_fromis greater thanfli_bmp_dirty_toβ the bitmap has not changed. nothing happened. it's giving "no thoughts, head empty" π - otherwise β lines
fli_bmp_dirty_fromtofli_bmp_dirty_to(inclusive, bestie, don't forget the inclusive part) have altered.
so when are these actually useful?? when you're copying the fli_bitmap onto the screen!! because why would you move data you don't need to move?? that's just wasted effort and we don't do that here π
avoid moving data unnecessarily, slay.
example time, and i mean the exact example, no cap:
if (fli_bmp_dirty_from <= fli_bmp_dirty_to)
blit(fli_bitmap, screen, 0, fli_bmp_dirty_from,
0, fli_bmp_dirty_from, fli_bitmap->w,
fli_bmp_dirty_to - fli_bmp_dirty_from + 1);
look at that guard clause doing its little <= check before it even thinks about blitting. main character energy fr fr β¨
π SEE ALSO π
go read those too, iykyk π
lowkey this is one of those pages that's short but you WILL come back to it, so maybe bookmark it or whatever π
and that's the whole page!! mwah π this has been the Allegro manual, version 4.4.3, and yeah that's the date it was working with β catch you on the next manpage, bestie π¦β¨π
π¦ where this page comes from
- fedora 43: allegro-devel 4.4.3.1-18.fc43 Β· Giftware
- fedora 43: allegro-devel 4.4.3.1-18.fc43 Β· Giftware
- fedora 44: allegro-devel 4.4.3.1-20.fc44 Β· Giftware
- fedora 44: allegro-devel 4.4.3.1-20.fc44 Β· Giftware
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms