diff options
-rw-r--r-- | src/main/engine/engine.c | 2 | ||||
-rw-r--r-- | src/main/engine/ui/ui.h | 2 | ||||
-rw-r--r-- | src/main/engine/ui/x11/ui.c | 15 |
3 files changed, 11 insertions, 8 deletions
diff --git a/src/main/engine/engine.c b/src/main/engine/engine.c index 3b77b40..c10cfca 100644 --- a/src/main/engine/engine.c +++ b/src/main/engine/engine.c @@ -75,7 +75,7 @@ engine_new(int w, int h) } engine->circles = list_create(); engine->lines = list_create(); - engine->ui = ui_init(w, h); + engine->ui = ui_new(w, h); engine_set_rendering_background(engine, 0.0f, 0.0f, 0.2f, 1.0f); diff --git a/src/main/engine/ui/ui.h b/src/main/engine/ui/ui.h index c01591c..9aee1b8 100644 --- a/src/main/engine/ui/ui.h +++ b/src/main/engine/ui/ui.h @@ -22,7 +22,7 @@ #include "types.h" -UI *ui_init(int w, int h); +UI *ui_new(int w, int h); void ui_loop(UI *ui); void ui_set_title(const char *title); void ui_set_expose_listener(void (*expose_event)()); diff --git a/src/main/engine/ui/x11/ui.c b/src/main/engine/ui/x11/ui.c index 2501f5c..3c302b1 100644 --- a/src/main/engine/ui/x11/ui.c +++ b/src/main/engine/ui/x11/ui.c @@ -114,16 +114,22 @@ ui_set_title(const char *title) XStoreName(display, window, title); } +/* + * This is the function used to init a UI. + */ UI * -ui_init(int width, int height) +ui_new(int width, int height) { init_log(); + /* Inizilize the UI */ UI *ui = malloc(sizeof(UI)); if (ui == NULL) { - log_error(log, "Error allocating UI"); - exit(1); + log_error(log, "Error allocating the UI"); + exit(EXIT_FAILURE); } + ui->width = width; + ui->height = height; display = ui_open_display(); @@ -140,9 +146,6 @@ ui_init(int width, int height) exit(1); } - ui->width = width; - ui->height = height; - return ui; } |