diff options
author | 2025-05-22 18:59:46 +0200 | |
---|---|---|
committer | 2025-05-22 18:59:46 +0200 | |
commit | a22c967a59a1e17663790db72f2d24edafc6199a (patch) | |
tree | 5aa0a60a4cba2b314f019bb0499a091e79f3fc13 /src/main/engine/engine.c | |
parent | cec27feccd1d3232ceae2bf284f66071d36cc96a (diff) | |
download | tris-a22c967a59a1e17663790db72f2d24edafc6199a.tar.gz tris-a22c967a59a1e17663790db72f2d24edafc6199a.zip |
Remove the rendiring process of the lines
I've moved that inside the game rendering function.
Diffstat (limited to 'src/main/engine/engine.c')
-rw-r--r-- | src/main/engine/engine.c | 54 |
1 files changed, 0 insertions, 54 deletions
diff --git a/src/main/engine/engine.c b/src/main/engine/engine.c index a555a89..495b960 100644 --- a/src/main/engine/engine.c +++ b/src/main/engine/engine.c @@ -21,12 +21,10 @@ #include <stdlib.h> #include <time.h> #include <GL/gl.h> -#include <math.h> #include <log.h> #include "engine.h" #include "ui/ui.h" #include "../util/list.h" -#include "shape/circle.h" #ifdef X11 #include <X11/Xlib.h> @@ -43,10 +41,6 @@ init_log(void) _log = log_create("Engine"); } -typedef struct Line { - float x1, y1, x2, y2; -} Line; - static Engine *engine; /* FPS */ @@ -73,7 +67,6 @@ engine_new(int w, int h) log_error(_log, "Error allocating memory for engine"); exit(EXIT_FAILURE); } - engine->lines = list_create(); engine->ui = ui_new(w, h); engine_set_rendering_background(engine, 0.0f, 0.0f, 0.2f, 1.0f); @@ -87,27 +80,6 @@ engine_set_window_title(Engine *engine, const char *title) ui_set_title(engine->ui, title); } -static Line * -engine_new_line(float x1, float y1, float x2, float y2) -{ - Line *line = malloc(sizeof(Line)); - line->x1 = x1; - line->y1 = y1; - line->x2 = x2; - line->y2 = y2; - - return line; -} - -void -engine_draw_line(float x1, float y1, float x2, float y2) -{ - if (engine->lines != NULL) { - Line *line = engine_new_line(x1, y1, x2, y2); - list_add(engine->lines, line); - } -} - static void engine_calculate_fps() { @@ -124,31 +96,6 @@ engine_calculate_fps() } static void -render_line(Line *line) -{ - glVertex2f(line->x1, line->y1); - glVertex2f(line->x2, line->y2); -} - -static void -draw_lines() -{ - if (engine->lines == NULL || engine->lines->size <= 0) return; - - glLineWidth(5.0f); - glBegin(GL_LINES); - glColor3f(1.0f, 1.0f, 0.0f); /* Yellow */ - - list_node_t *current = engine->lines->head; - do { - render_line(current->data); - current = current->next; - } while (current != NULL); - - glEnd(); -} - -static void draw_frames(void *data) { if (data == NULL) return; @@ -162,7 +109,6 @@ draw_frames(void *data) glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - draw_lines(); engine->draw_frame_listener->draw_frames(engine->draw_frame_listener->data); engine_calculate_fps(); |