diff options
author | 2025-05-22 18:04:51 +0200 | |
---|---|---|
committer | 2025-05-22 18:04:51 +0200 | |
commit | cec27feccd1d3232ceae2bf284f66071d36cc96a (patch) | |
tree | 26556a4b6a4b6123bdf4bb06edb5c9e815528b9e /src/main/engine/shape/circle.c | |
parent | 9f4a0889287186907332c0186b15802297d807f3 (diff) | |
download | tris-cec27feccd1d3232ceae2bf284f66071d36cc96a.tar.gz tris-cec27feccd1d3232ceae2bf284f66071d36cc96a.zip |
Remove the rendering of circles from the Engine
Diffstat (limited to 'src/main/engine/shape/circle.c')
-rw-r--r-- | src/main/engine/shape/circle.c | 17 |
1 files changed, 17 insertions, 0 deletions
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 <stdlib.h> +#include <GL/gl.h> +#include <math.h> #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(); +} |