arc(3alleg4)
π arc β the one where we draw a cute lil' slice of a circle π
okay bestie, gather round, we're doing the Allegro manual today and this one is a certified classic. it's a function from the Allegro game programming library, and it's giving "I just want a curved line, please." β¨
β¨ NAME β¨
arc β draws a circular arc. from the Allegro game programming library, obviously. π
πΈ SYNOPSIS πΈ
#include <allegro.h>
void arc(BITMAP *bmp, int x, y, fixed ang1, ang2, int r, int color);
like. look at her. so simple. so powerful. π
π¦ DESCRIPTION π¦
okay so here's the tea: arc draws a circular arc with its centre sitting at x, y, and a radius of r. π«Ά
it goes in an anticlockwise direction, starting from the angle a1 and stopping the moment it reaches a2. iconic behaviour, no notes.
now the angles β this is the part where you gotta pay attention, bestie, because these values are in 16.16 fixed point format π and the scale is:
256= a full circle (yes, a whole one, she's complete)64= a right angle- etc. you get the pattern, i believe in you
and for the vibe check on direction: zero is to the right of the centre point, and larger values rotate anticlockwise from there. so the numbers grow as you spin counter-clockwise. periodt. π«
here's the example, and i'm keeping it EXACTLY as it is because we do not touch the code:
/* 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));
like she literally draws a black arc from 4 to 1 o'clock and that's just... art. main character energy fr fr. π₯
quick reminder bestie: the angles are 16.16 fixed point, so use itofix() on your numbers unless you enjoy chaos π
π SEE ALSO π
go read these next, they're the whole friend group:
and that's the whole page, bestie!! π₯³ this was Allegro version 4.4.3 talking, so if your arc is acting up, check your version and check your fixed point math, and you'll be slaying in no time. ily, go draw something pretty πππ
π¦ 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