diff options
Diffstat (limited to 'src/main/engine/engine.c')
-rw-r--r-- | src/main/engine/engine.c | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/src/main/engine/engine.c b/src/main/engine/engine.c index ab595ac..d66c242 100644 --- a/src/main/engine/engine.c +++ b/src/main/engine/engine.c @@ -41,7 +41,7 @@ static int height; static list_t *lines = NULL; typedef struct Line { - int x1, y1, x2, y2; + float x1, y1, x2, y2; } Line; typedef struct Engine { @@ -74,9 +74,6 @@ engine_init(int w, int h) height = h; engine->ui = ui_init(w, h); - xstep = RANGE_GL / (float) w; - ystep = RANGE_GL / (float) h; - lines = list_create(); } @@ -101,7 +98,7 @@ engine_draw_circle(float cx, float cy, float r, int num_segments, int outline) } static Line * -engine_new_line(int x1, int y1, int x2, int y2) +engine_new_line(float x1, float y1, float x2, float y2) { Line *line = malloc(sizeof(Line)); line->x1 = x1; @@ -113,7 +110,7 @@ engine_new_line(int x1, int y1, int x2, int y2) } void -engine_draw_line(int x1, int y1, int x2, int y2) +engine_draw_line(float x1, float y1, float x2, float y2) { if (lines != NULL) { Line *line = engine_new_line(x1, y1, x2, y2); @@ -137,11 +134,8 @@ engine_calculate_fps() static void render_line(Line *line) { - float _x1 = line->x1 * xstep - 1; float _y1 = (height - line->y1) * ystep - 1; - float _x2 = line->x2 * xstep - 1; float _y2 = (height - line->y2) * ystep - 1; - - glVertex2f(_x1, _y1); - glVertex2f(_x2, _y2); + glVertex2f(line->x1, line->y1); + glVertex2f(line->x2, line->y2); } static void |