do_ellipse(3)

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

✨ do_ellipse β€” NAME ✨

ok so do_ellipse is the girl who calculates all the points in an ellipse πŸ’… and she lives in the Allegro game programming library. bestie she is so good at her job.


🌸 SYNOPSIS 🌸

#include <allegro.h>

void do_ellipse(BITMAP *bmp, int x, int y, int rx, ry, int d, void
(*proc)(BITMAP *bmp, int x, int y, int d));

yes the ry has no int in front of it, that's canon, do not perceive it, we don't fix the source material around here πŸ’€


πŸ¦‹ DESCRIPTION πŸ¦‹

Okay so here's the tea πŸ«– β€” do_ellipse walks every single point on an ellipse that's hanging out around the point (x, y), with radius rx and radius ry (yes, two different radii, it's giving oval, she's not a circle, she's got range πŸ‘‘). And for each one of those points, she calls the function you handed her.

That function gets passed:

  • a copy of the bmp parameter πŸŽ€
  • the x and y position of the point
  • a copy of the d parameter

which means it's literally perfect for use with putpixel(). iykyk ✨

Example time, watch her cook:

void draw_explosion_ring(BITMAP *bmp, int x, int y, int d)
{
   ...
}

do_ellipse(screen, SCREEN_W/2, SCREEN_H/2,
           SCREEN_H/16, SCREEN_H/32, flame_color,
           draw_explosion_ring);
ok note that d is whatever you want it to be β€” a colour, a thickness, a vibe β€” do_ellipse does not care, she just passes it straight through to your callback. she's a courier, not a critic πŸ’–

πŸ’œ SEE ALSO πŸ’œ

the whole friend group fr fr 🫢 go say hi.


mwah πŸ’‹ this has been your girl from the Allegro manual, version 4.4.3 β€” stan do_ellipse(3), she ate and left no crumbs πŸ“βœ¨πŸ’…

πŸ“¦ where this page comes from