summaryrefslogtreecommitdiff
path: root/src/main/engine/engine.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/engine/engine.c')
-rw-r--r--src/main/engine/engine.c12
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;