Ajout de toutes les commandes de Changer le thème et correction du code
This commit is contained in:
@@ -15,8 +15,9 @@ BUT : Fichier de fonctions Tic Tac Toe
|
||||
using namespace std;
|
||||
|
||||
extern const int LARGTIC;
|
||||
string ICONJ1 = { "X" };
|
||||
string ICONJ2 = { "O" };
|
||||
string ICONJ1 = "X";
|
||||
string ICONJ2 = "O";
|
||||
string style;
|
||||
int codeConsole = 0;
|
||||
|
||||
fstream monFlux;
|
||||
@@ -96,13 +97,15 @@ void initTab(string grid[][LARGTIC]) {
|
||||
void afficherImageTableau(std::string grid[][LARGTIC], std::string style) {
|
||||
SetConsoleOutputCP(CP_UTF8);
|
||||
string emoteUp,
|
||||
emoteDown;
|
||||
emoteDown,
|
||||
iconJ1,
|
||||
iconJ2;
|
||||
|
||||
// Faire une fonction pour retenir le th<74>me s<>lectionn<6E> par le joueur!!!!
|
||||
ouvrirFichier(monFlux, style);
|
||||
if (monFlux) {
|
||||
while (!monFlux.eof()) {
|
||||
monFlux >> emoteUp >> emoteDown >> ICONJ1 >> ICONJ2;
|
||||
monFlux >> emoteUp >> emoteDown >> iconJ1 >> iconJ2;
|
||||
}
|
||||
monFlux.close();
|
||||
cout << endl;
|
||||
@@ -167,7 +170,7 @@ void tourJoueur(string grid[][LARGTIC], int joueur) {
|
||||
horizontale;
|
||||
|
||||
cout << "\n\nTour du joueur " << joueur << endl;
|
||||
afficherImageTableau(grid);
|
||||
afficherImageTableau(grid, style);
|
||||
|
||||
cout << "\n\nEntrez une coordonnee verticale : ";
|
||||
cin >> verticale;
|
||||
@@ -254,7 +257,7 @@ bool verifFinMatch(std::string grid[][LARGTIC]) {
|
||||
}
|
||||
|
||||
void afficherFinMatch(string grid[][LARGTIC], int gagnant, int nbJoueurs) {
|
||||
afficherImageTableau(grid);
|
||||
afficherImageTableau(grid, style);
|
||||
|
||||
if (nbJoueurs == 1) {
|
||||
if (gagnant == 1) {
|
||||
@@ -302,7 +305,7 @@ void tourOrdi(string grid[][LARGTIC]) {
|
||||
horizontal = rand() % (3);
|
||||
} while (grid[vertical][horizontal] != " ");
|
||||
grid[vertical][horizontal] = ICONJ2;
|
||||
afficherImageTableau(grid);
|
||||
afficherImageTableau(grid, style);
|
||||
}
|
||||
|
||||
//2 joueurs
|
||||
@@ -331,7 +334,7 @@ void historiqueDesScores() {
|
||||
}
|
||||
|
||||
//Changer le th<74>me
|
||||
void changerLeTheme(std::string &style) {
|
||||
void changerLeTheme() {
|
||||
string grid[LARGTIC][LARGTIC] = {ICONJ1, ICONJ2};
|
||||
system("cls");
|
||||
cout << endl << "Changer le theme du jeu Tic Tac Toe" << endl
|
||||
@@ -342,10 +345,12 @@ void changerLeTheme(std::string &style) {
|
||||
choix = toupper(_getche());
|
||||
cout << endl;
|
||||
|
||||
switch (choix) {
|
||||
do {
|
||||
switch (choix) {
|
||||
case 'A':
|
||||
style = "themes/themeSea.txt";
|
||||
afficherImageTableau(grid, style);
|
||||
system("PAUSE");
|
||||
break;
|
||||
|
||||
case 'B':
|
||||
@@ -368,5 +373,6 @@ void changerLeTheme(std::string &style) {
|
||||
|
||||
default:
|
||||
cout << "\nChoisir une option valide. \n";
|
||||
}
|
||||
}
|
||||
} while (choix != 'Q');
|
||||
}
|
||||
Reference in New Issue
Block a user