do_circle(3)

πŸ“¦ version 4.4.3.1, in fedora 43, fedora 44

πŸ’– do_circle(3) πŸ’–

okay bestie, welcome to the Allegro manual, and today's main character is do_circle β€” she calculates all the points in a circle, and she does it for the Allegro game programming library. no cap. πŸ¦‹


✨ SYNOPSIS ✨

#include <allegro.h>

void do_circle(BITMAP *bmp, int x, int y, int radius, int d, void
(*proc)(BITMAP *bmp, int x, int y, int d));

🌸 DESCRIPTION 🌸

so the way this works is iconic: do_circle calculates all the points in a circle around the point (x, y) with radius r, and then it calls the function you handed it for each and every one of those points. like, every single one. she's thorough. πŸ’…

That supplied function gets passed a copy of the bmp parameter, the x and y position, and a copy of the d parameter β€” which means it's perfectly set up to be used with putpixel(). obsessed, honestly. πŸŽ€

Example, since I know you want one:

void draw_explosion_ring(BITMAP *bmp, int x, int y, int d)
{
   ...
}
do_circle(screen, SCREEN_W/2, SCREEN_H/2,
          SCREEN_H/16, flame_color,
          draw_explosion_ring);

like?? that's it. that's the whole vibe. πŸ’₯


πŸ‘‘ SEE ALSO πŸ‘‘


and that's a wrap, bestie 🫢 this was Allegro version 4.4.3, and yeah, it's giving do_circle(3) energy from start to finish. go draw a circle. slay. βœ¨πŸ’œ

πŸ“¦ where this page comes from