arc(3)
π« arc(3) π«
okay bestie, welcome to the Allegro manual β today's main character is arc, and she draws circles. well, parts of circles. iconic behaviour, honestly.
πΈ NAME πΈ
arc β draws a circular arc. it's giving Allegro game programming library, and it's giving geometry. π
β¨ SYNOPSIS β¨
#include <allegro.h>
void arc(BITMAP *bmp, int x, y, fixed ang1, ang2, int r, int color);
π¦ DESCRIPTION π¦
so here's the vibe: arc draws a circular arc with centre x, y and radius r, going in an anticlockwise direction, starting from the angle a1 and ending when it reaches a2. π
those angle values are in 16.16 fixed point format, and the math is lowkey cute:
256equals a full circle π64equals a right angle β- and so on, you get it
Zero is to the right of the centre point, and larger values rotate anticlockwise from there. no cap. π₯
example time, because seeing it is believing:
/* Draw a black arc from 4 to 1 o'clock. */
arc(screen, SCREEN_W/2, SCREEN_H/2,
itofix(-21), itofix(43), 50, makecol(0, 0, 0));
not me using itofix() to turn regular numbers into fixed point so the arc actually knows what angle I mean π that's the whole trick, bestie.
π SEE ALSO π
psa: angles are fixed point, not plain ints. if your arc is acting weird, that's why. itofix() is your friend, fr fr. π«Ά
and that's the whole page, bestie β this was Allegro, version 4.4.3, and yeah it's still filed under arc(3). go draw something pretty. ππ§β¨
π¦ 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