From e2b369bf31cb52d1d0a3e400ce0530064cef96ad Mon Sep 17 00:00:00 2001 From: Alessandro Iezzi Date: Thu, 22 May 2025 19:20:01 +0200 Subject: Change colors --- src/main/engine/shape/circle.c | 11 +++++++++++ 1 file changed, 11 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 f60e917..996ae19 100644 --- a/src/main/engine/shape/circle.c +++ b/src/main/engine/shape/circle.c @@ -40,6 +40,10 @@ engine_render_circle(Circle *circle) { glBegin(GL_LINE_LOOP); + if (circle->color != NULL) { + glColor3f(circle->color->r, circle->color->g, circle->color->b); + } + 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); @@ -49,3 +53,10 @@ engine_render_circle(Circle *circle) glEnd(); } + +void +engine_circle_set_color(Circle *circle, Color *color) +{ + if (circle == NULL) return; + circle->color = color; +} -- cgit v1.2.3