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