From 618402caa489751d61643e6839607fd1546ad635 Mon Sep 17 00:00:00 2001 From: Alessandro Iezzi Date: Tue, 20 May 2025 20:01:01 +0200 Subject: Move all logic inside the game --- src/main/game/game.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'src/main/game/game.c') diff --git a/src/main/game/game.c b/src/main/game/game.c index 117cf45..0aa4888 100644 --- a/src/main/game/game.c +++ b/src/main/game/game.c @@ -17,7 +17,33 @@ * along with Tris Game. If not, see . */ +#include #include "../engine/engine.h" +#include "game.h" +#include "../util.h" +#include "../engine/ui/ui.h" + +TrisGame * +game_init(int width, int height) +{ + TrisGame *game = malloc(sizeof(TrisGame)); + if (game == NULL) { + log_error("Error allocating memory for the game"); + exit(EXIT_FAILURE); + } + engine_init(width, height); + ui_set_title("Tris Game"); + + game_draw_field(0.5, 0, 0); + + return game; +} + +void +game_start() +{ + engine_loop(); +} void game_draw_field(float box_size, float x, float y) -- cgit v1.2.3