From 7288bdd42360109f26a684431fa286ea265d07a4 Mon Sep 17 00:00:00 2001 From: Alessandro Iezzi Date: Wed, 21 May 2025 23:32:50 +0200 Subject: Remove util.* for the liblog --- src/main/game/game.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'src/main/game/game.c') diff --git a/src/main/game/game.c b/src/main/game/game.c index e1a193a..7579c50 100644 --- a/src/main/game/game.c +++ b/src/main/game/game.c @@ -19,10 +19,10 @@ #include #include +#include #include "../engine/engine.h" #include "game.h" #include "cell.h" -#include "../util.h" #include "../engine/ui/ui.h" float xmin, xmax, ymin, ymax; @@ -43,6 +43,15 @@ int moves = 0; static void game_draw_field(TrisGame *game, float box_size, float x, float y); +static Log *log = NULL; + +static void +init_log(void) +{ + if (log != NULL) return; + log = log_create("Game"); +} + static void draw_sign(float x, float y) { @@ -100,15 +109,19 @@ game_mouse_button_pressed(float x, float y, void *data) } } } + + check_win(); } TrisGame * game_init(int width, int height) { + init_log(); + /* Init of the TrisGame */ TrisGame *game = malloc(sizeof(TrisGame)); if (game == NULL) { - log_error("Error allocating memory for the game"); + log_error(log, "Error allocating memory for the game"); exit(EXIT_FAILURE); } game->width = width; -- cgit v1.2.3