From 38c5caa165cbb780e25c336d551cbbe4bb24b309 Mon Sep 17 00:00:00 2001 From: Josue KONAN Date: Sun, 24 Nov 2024 19:07:04 +0100 Subject: [PATCH] =?UTF-8?q?T=C3=A9l=C3=A9verser=20les=20fichiers=20vers=20?= =?UTF-8?q?"/"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main.c | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 main.c diff --git a/main.c b/main.c new file mode 100644 index 0000000..c08ba24 --- /dev/null +++ b/main.c @@ -0,0 +1,44 @@ +#include +#include // Bibliothèque graphique +#include "graphics_utils.h" +#include "blocus.h" +#include + +void play_single_player(Game* game); +void play_two_players(Game* game); + +int main() { + int grid_size = 0; + int mode = 0; // 1 : Un joueur, 2 : Deux joueurs + + while (1) { + InitialiserGraphique(); + CreerFenetre(100, 100, 800, 600); + + // Écran 1 : Choix de la taille de la grille et du mode + grid_size = choose_grid_size(&mode); + + // Écran 2 : Lancement de la partie + Game game; + initialize_game(&game, grid_size); + + if (mode == 1) { + play_single_player(&game); + } else { + play_two_players(&game); + } + + // Écran 3 : Résultat + display_winner(game.winner); + + FermerGraphique(); + + // Recommencer ? + printf("Recommencer ? (1: Oui, 0: Non)\n"); + int replay; + scanf("%d", &replay); + if (!replay) break; + } + + return EXIT_SUCCESS; +}