diff options
Diffstat (limited to 'src/main/engine')
-rw-r--r-- | src/main/engine/engine.c | 15 | ||||
-rw-r--r-- | src/main/engine/engine.h | 2 |
2 files changed, 16 insertions, 1 deletions
diff --git a/src/main/engine/engine.c b/src/main/engine/engine.c index 5ea4c4f..97ba445 100644 --- a/src/main/engine/engine.c +++ b/src/main/engine/engine.c @@ -79,6 +79,7 @@ engine_new(int w, int h) exit(EXIT_FAILURE); } engine->circles = list_create(); + engine_set_rendering_background(engine, 0.0f, 0.0f, 0.2f, 1.0f); width = w; height = h; @@ -200,7 +201,9 @@ draw_circles() static void draw_frames() { - glClearColor(0.0f, 0.0f, 0.2f, 1.0f); + Color *bk = engine->rendering_background; + + glClearColor(bk->r, bk->g, bk->b, bk->a); glClear(GL_COLOR_BUFFER_BIT); glEnable(GL_LINE_SMOOTH); glEnable(GL_BLEND); @@ -309,3 +312,13 @@ engine_input(void (*f_input)(int engine_input)) ui_set_generic_listener(engine_dispatch_ui_events); dispatch_ui_event = f_input; } + +void +engine_set_rendering_background(Engine *engine, float r, float g, float b, float a) +{ + if (engine->rendering_background == NULL) { + engine->rendering_background = color_new(r, g, b, a); + } else { + color_set_rgba(engine->rendering_background, r, g, b, a); + } +} diff --git a/src/main/engine/engine.h b/src/main/engine/engine.h index d6fe1d1..f77fc4e 100644 --- a/src/main/engine/engine.h +++ b/src/main/engine/engine.h @@ -33,9 +33,11 @@ typedef struct { list_t *circles; void (*draw_frame)(); float ortho_left, ortho_right, ortho_top, ortho_bottom; + Color *rendering_background; } Engine;; Engine *engine_new(int width, int height); +void engine_set_rendering_background(Engine *engine, float r, float g, float b, float a); void engine_draw_circle(float cx, float cy, float r, int num_segments, int outline); void engine_draw_line(float x1, float y1, float x2, float y2); void engine_loop(void); |