From 2729753e213ffaea653358d02a9f5c34ad3b6233 Mon Sep 17 00:00:00 2001 From: Lea Date: Fri, 28 Nov 2025 08:54:52 -0500 Subject: [PATCH] =?UTF-8?q?validation=20pour=20le=20choix=20du=20th=C3=A8m?= =?UTF-8?q?e=20et=20ajout=20d'un=20th=C3=A8me=20par=20d=C3=A9faut?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- TicTacToe/fonctions.cpp | 73 +++++++++++++++++++++++++++++++++++++++-- TicTacToe/fonctions.h | 1 - 2 files changed, 70 insertions(+), 4 deletions(-) diff --git a/TicTacToe/fonctions.cpp b/TicTacToe/fonctions.cpp index 00743fa..dc68f96 100644 --- a/TicTacToe/fonctions.cpp +++ b/TicTacToe/fonctions.cpp @@ -17,7 +17,7 @@ using namespace std; extern const int LARGTIC; string iconJ1 = "X"; string iconJ2 = "O"; -string style = "themes/themeSea.txt"; +string style = "themes/themeDefaut.txt"; int codeConsole = 0; fstream monFlux; @@ -362,9 +362,10 @@ void changerLeTheme(bool& theme) { system("cls"); do { cout << endl << "Changer le theme du jeu Tic Tac Toe" << endl - << "Options des styles: " << "\nA) Ocean" + << "Options des styles: " << "\n-------------------------------------" + << "\nA) Ocean" << "\nB) Fantaisie" << "\nC) Espace" - << "\nD) Animaux" << "\nQ) Revenir en arriere" + << "\nD) Animaux" << "\nE) Defaut" << "\nQ) Revenir en arriere" << "\nChoisir une option: "; choix = toupper(_getche()); cout << endl; @@ -376,21 +377,87 @@ void changerLeTheme(bool& theme) { case 'A': style = "themes/themeSea.txt"; afficherImageTableau(grid, style); + + cout << "\n\nVoulez vous utiliser ce theme? "; + choix = toupper(_getche()); + + if (choix == 'O') { + style = "themes/themeSea.txt"; + } + + else { + style = "themes/themeDefaut.txt"; + cout << "Le theme par defaut sera choisi."; + } + break; case 'B': style = "themes/themeFantasy.txt"; afficherImageTableau(grid, style); + + cout << "\n\nVoulez vous utiliser ce theme? "; + choix = toupper(_getche()); + + if (choix == 'O') { + style = "themes/themeFantasy.txt"; + } + + else { + style = "themes/themeDefaut.txt"; + cout << "Le theme par defaut sera choisi."; + } break; case 'C': style = "themes/themeEspace.txt"; afficherImageTableau(grid, style); + + cout << "\n\nVoulez vous utiliser ce theme? "; + choix = toupper(_getche()); + + if (choix == 'O') { + style = "themes/themeEspace.txt"; + } + + else { + style = "themes/themeDefaut.txt"; + cout << "Le theme par defaut sera choisi."; + } break; case 'D': style = "themes/themeAnimaux.txt"; afficherImageTableau(grid, style); + + cout << "\n\nVoulez vous utiliser ce theme? "; + choix = toupper(_getche()); + + if (choix == 'O') { + style = "themes/themeAnimaux.txt"; + } + + else { + style = "themes/themeDefaut.txt"; + cout << "Le theme par defaut sera choisi."; + } + break; + + case 'E': + style = "themes/themeDefaut.txt"; + afficherImageTableau(grid, style); + + cout << "\n\nVoulez vous utiliser ce theme? "; + choix = toupper(_getche()); + + if (choix == 'O') { + style = "themes/themeDefaut.txt"; + } + + else { + style = "themes/themeDefaut.txt"; + cout << "Le theme par defaut sera quand meme choisi."; + } break; case 'Q': diff --git a/TicTacToe/fonctions.h b/TicTacToe/fonctions.h index 3519995..7405153 100644 --- a/TicTacToe/fonctions.h +++ b/TicTacToe/fonctions.h @@ -22,7 +22,6 @@ void afficherImageMenu(std::fstream& monFlux); //Général void afficherImageTableau(std::string grid[][LARGTIC], std::string style); -void changerLeTheme(); void tourJoueur(std::string grid[][LARGTIC], int joueur); //pour savoir quel icon utiliser bool verifFinMatch(std::string grid[][LARGTIC]); void afficherFinMatch(std::string grid[][LARGTIC], int gagnant, int nbJoueurs);