Ajout des thèmes

This commit is contained in:
Lea
2025-11-26 10:19:29 -05:00
parent 988880817d
commit 10e9c22778

View File

@@ -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<74>me s<>lectionn<6E> 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<74>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";
}
}