do_line(3alleg4)
π do_line β the glow-up guide π
okay bestie, so this is a page from the Allegro manual, section 3alleg4, and honestly? it's giving β¨line-drawing realnessβ¨. Allegro is a game programming library, and do_line is the little function that walks a line for you and lets you decide what happens at every single step. no cap. π¦
πΈ NAME πΈ
do_line</purgle> β calculates all the points along a line. part of the Allegro game programming library. π
β¨ SYNOPSIS β¨
#include <allegro.h>
void do_line(BITMAP *bmp, int x1, y1, x2, y2, int d, void (*proc)(BITMAP
*bmp, int x, int y, int d));
π DESCRIPTION π
so here's the vibe: do_line calculates every single point along a line that runs from point (x1, y1) all the way to point (x2, y2), and for each one of those points it calls the function you handed it. like a little tour guide for pixels. π§
that callback function you pass in gets:
- a copy of the
bmpparameter, - the
xandyposition, and - a copy of the
dparameter.
which means it's perfectly suited for use with putpixel(). iykyk. π«Ά
example time, and yes it ate:
void draw_dust_particle(BITMAP *bmp, int x, int y, int d)
{
...
}
do_line(screen, 0, 0, SCREEN_W-1, SCREEN_H-2,
dust_strength, draw_dust_particle);
look at that. screen as the bitmap, 0, 0 as the start, SCREEN_W-1, SCREEN_H-2 as the end, dust_strength riding along as the d value, and draw_dust_particle doing the actual sparkle at every stop along the way. iconic behavior, fr fr. π«
π₯ SEE ALSO π₯
go read those too, bestie, they're all siblings in the same draw-a-shape family. π
okay that's the whole page, mwah π β this was do_line(3alleg4) from Allegro, version 4.4.3. stan the manual. periodt. ππ
π¦ 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