diff --git a/TicTacToe/fonctions.cpp b/TicTacToe/fonctions.cpp index 84b55a7..b3e66a1 100644 --- a/TicTacToe/fonctions.cpp +++ b/TicTacToe/fonctions.cpp @@ -15,8 +15,8 @@ BUT : Fichier de fonctions Tic Tac Toe using namespace std; extern const int LARGTIC; -const string ICONJ1 = { "X" }; -const string ICONJ2 = { "O" }; + string ICONJ1 = { "X" }; + string ICONJ2 = { "O" }; int codeConsole = 0; fstream monFlux; @@ -93,15 +93,16 @@ void initTab(string grid[][LARGTIC]) { } } -void afficherImageTableau(std::string grid[][LARGTIC]) { +void afficherImageTableau(std::string grid[][LARGTIC], std::string style) { SetConsoleOutputCP(CP_UTF8); string emoteUp, emoteDown; + // Faire une fonction pour retenir le thème sélectionné par le joueur!!!! - ouvrirFichier(monFlux, "themes/themeGrass.txt"); + ouvrirFichier(monFlux, style); if (monFlux) { while (!monFlux.eof()) { - monFlux >> emoteUp >> emoteDown; + monFlux >> emoteUp >> emoteDown >> ICONJ1 >> ICONJ2; } monFlux.close(); cout << endl; @@ -330,22 +331,42 @@ void historiqueDesScores() { } //Changer le thème -void changerLeTheme() { +void changerLeTheme(std::string &style) { + string grid[LARGTIC][LARGTIC] = {ICONJ1, ICONJ2}; system("cls"); cout << endl << "Changer le theme du jeu Tic Tac Toe" << endl << "Options des styles: " << "\nA) Ocean" << "\nB) Fantaisie" << "\nC) Espace" - << "\nD) Animaux" << "\nChoisir une option: "; + << "\nD) Animaux" << "\nQ) Revenir en arriere" + << "\nChoisir une option: "; choix = toupper(_getche()); cout << endl; switch (choix) { - case 'A': { + case 'A': + style = "themes/themeSea.txt"; + afficherImageTableau(grid, style); break; - } - case 'B': { + case 'B': + style = "themes/themeFantasy.txt"; + afficherImageTableau(grid, style); + break; - } + case 'C': + style = "themes/themeEspace.txt"; + afficherImageTableau(grid, style); + break; + + case 'D': + style = "themes/themeAnimaux.txt"; + afficherImageTableau(grid, style); + break; + + case 'Q': + break; + + default: + cout << "\nChoisir une option valide. \n"; } } \ No newline at end of file