summaryrefslogtreecommitdiff
path: root/src/main/game/game.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/game/game.c')
-rw-r--r--src/main/game/game.c17
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;