diff options
author | 2025-05-19 15:57:13 +0200 | |
---|---|---|
committer | 2025-05-19 15:58:04 +0200 | |
commit | 73195399de0a6b5de27a838bba2daedc8ff2ae65 (patch) | |
tree | 4b2906c08d94af5eda8e4d778b3d973ff78e443d /src/main/engine/engine.c | |
parent | bc803cb0a6d7095a45eec4413c55dd113c0eb659 (diff) | |
download | tris-73195399de0a6b5de27a838bba2daedc8ff2ae65.tar.gz tris-73195399de0a6b5de27a838bba2daedc8ff2ae65.zip |
Add reference to UI in the Engine structure
Diffstat (limited to 'src/main/engine/engine.c')
-rw-r--r-- | src/main/engine/engine.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/main/engine/engine.c b/src/main/engine/engine.c index 46b34cb..b4d70b0 100644 --- a/src/main/engine/engine.c +++ b/src/main/engine/engine.c @@ -22,6 +22,7 @@ #include <time.h> #include <GL/gl.h> #include "engine.h" +#include "../util.h" #include "ui/ui.h" #include "../util/list.h" @@ -43,10 +44,11 @@ typedef struct Line { } Line; typedef struct Engine { + UI *ui; void (*draw_frame)(); } Engine; -static Engine engine; +static Engine *engine; /* FPS */ static time_t start; @@ -59,9 +61,15 @@ void (*on_mouse_pressed)(); void engine_init(int w, int h) { + engine = malloc(sizeof(Engine)); + if (engine == NULL) { + log_error("Error allocating memory for engine"); + exit(EXIT_FAILURE); + } + width = w; height = h; - ui_init(w, h); + engine->ui = ui_init(w, h); xstep = RANGE_GL / (float) w; ystep = RANGE_GL / (float) h; |