diff options
author | 2025-05-20 20:01:01 +0200 | |
---|---|---|
committer | 2025-05-20 20:01:01 +0200 | |
commit | 618402caa489751d61643e6839607fd1546ad635 (patch) | |
tree | 3fa3e8d6dc1cd5a2c94987f9be13d1b76ba29bce /src/main/game/game.c | |
parent | 7f2339edd8449d79de2dc22fdfaa40658c5a201f (diff) | |
download | tris-618402caa489751d61643e6839607fd1546ad635.tar.gz tris-618402caa489751d61643e6839607fd1546ad635.zip |
Move all logic inside the game
Diffstat (limited to 'src/main/game/game.c')
-rw-r--r-- | src/main/game/game.c | 26 |
1 files changed, 26 insertions, 0 deletions
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 <http://www.gnu.org/licenses/>. */ +#include <stdlib.h> #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) |