diff options
author | 2025-05-21 23:32:50 +0200 | |
---|---|---|
committer | 2025-05-21 23:32:50 +0200 | |
commit | 7288bdd42360109f26a684431fa286ea265d07a4 (patch) | |
tree | 2dc070a742a3f61accbcf6f9afd8449d34dbd01c /src/main/game/game.c | |
parent | 56ee373d51e6d3acf3e284a59c8f852913b82e64 (diff) | |
download | tris-7288bdd42360109f26a684431fa286ea265d07a4.tar.gz tris-7288bdd42360109f26a684431fa286ea265d07a4.zip |
Remove util.* for the liblog
Diffstat (limited to 'src/main/game/game.c')
-rw-r--r-- | src/main/game/game.c | 17 |
1 files changed, 15 insertions, 2 deletions
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 <stdio.h> #include <stdlib.h> +#include <log.h> #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; |