From cec27feccd1d3232ceae2bf284f66071d36cc96a Mon Sep 17 00:00:00 2001 From: Alessandro Iezzi Date: Thu, 22 May 2025 18:04:51 +0200 Subject: Remove the rendering of circles from the Engine --- src/main/engine/shape/circle.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'src/main/engine/shape/circle.c') diff --git a/src/main/engine/shape/circle.c b/src/main/engine/shape/circle.c index 9cc79c6..f60e917 100644 --- a/src/main/engine/shape/circle.c +++ b/src/main/engine/shape/circle.c @@ -18,6 +18,8 @@ */ #include +#include +#include #include "circle.h" Circle * @@ -32,3 +34,18 @@ engine_circle_new(float cx, float cy, float r, int num_segments, int outline) return circle; } + +void +engine_render_circle(Circle *circle) +{ + glBegin(GL_LINE_LOOP); + + for (int i = 0; i < circle->num_segments; i++) { + float theta = 2.0f * M_PI * i / circle->num_segments; + float x = circle->r * cosf(theta); + float y = circle->r * sinf(theta); + glVertex2f(circle->cx + x, circle->cy + y); + } + + glEnd(); +} -- cgit v1.2.3