do_arc(3alleg4)
π do_arc π
okay bestie, you're in the Allegro manual, the game programming library, and this page is all about do_arc β the lil function that goes "hey, here's every single point on this arc, do whatever you want with them." β¨
β¨ SYNOPSIS β¨
#include <allegro.h>
void do_arc(BITMAP *bmp, int x, int y, fixed a1, fixed a2, int r, int d,
void (*proc)(BITMAP *bmp, int x, int y, int d));
πΈ DESCRIPTION πΈ
So basically π
β do_arc calculates all the points in a circular arc around the point (x, y) with radius r, and for each one it calls the function you handed it. Obsessed, honestly.
That supplied function gets passed:
- a copy of the
bmpparameter - the
xandyposition - a copy of the
dparameter
...which means it's literally perfect for pairing with putpixel(). π«Ά
The arc gets plotted anticlockwise, starting from the angle a1 and ending when it reaches a2. Those values are in 16.16 fixed point format β where 256 equals a full circle, 64 a right angle, etc. Zero is to the right of the centre point, and larger values rotate anticlockwise from there. slay. π
Example, bestie:
void draw_explosion_ring(BITMAP *bmp, int x, int y, int d)
{
...
}
do_arc(screen, SCREEN_W/2, SCREEN_H/2,
itofix(-21), itofix(43), 50, flame_color,
draw_explosion_ring);
π¦ SEE ALSO π¦
and that's the whole vibe, queen π this page lives in Allegro version 4.4.3, so if you're out here arcing your little heart out, that's the version you're doing it in. 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