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.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/main/engine/engine.c b/src/main/engine/engine.c
index bea9554..92222bb 100644
--- a/src/main/engine/engine.c
+++ b/src/main/engine/engine.c
@@ -25,6 +25,7 @@
#include "../util.h"
#include "ui/ui.h"
#include "../util/list.h"
+#include "types.h"
#ifdef X11
#include <X11/Xlib.h>
@@ -45,6 +46,7 @@ typedef struct Line {
typedef struct Engine {
UI *ui;
+ list_t *circles;
void (*draw_frame)();
} Engine;
@@ -66,6 +68,7 @@ engine_init(int w, int h)
log_error("Error allocating memory for engine");
exit(EXIT_FAILURE);
}
+ engine->circles = list_create();
width = w;
height = h;
@@ -77,6 +80,26 @@ engine_init(int w, int h)
lines = list_create();
}
+static Circle *
+engine_new_circle(float cx, float cy, float r, int num_segments, int outline)
+{
+ Circle *circle = malloc(sizeof(Circle));
+ circle->cx = cx;
+ circle->cy = cy;
+ circle->r = r;
+ circle->num_segments = num_segments;
+ circle->outline = outline;
+
+ return circle;
+}
+
+void
+engine_draw_circle(float cx, float cy, float r, int num_segments, int outline)
+{
+ if (engine == NULL || engine->circles == NULL) return;
+ list_add(engine->circles, engine_new_circle(cx, cy, r, num_segments, outline));
+}
+
static Line *
engine_new_line(int x1, int y1, int x2, int y2)
{