Lettre graphique
This commit is contained in:
@@ -106,6 +106,8 @@ string goToLine(fstream& monFlux, int numeroLigne) {//g
|
|||||||
|
|
||||||
void effectuerTour(int nbLettre)
|
void effectuerTour(int nbLettre)
|
||||||
{
|
{
|
||||||
|
fstream monFlux;
|
||||||
|
string nomFichier;
|
||||||
HANDLE hconsole = GetStdHandle(STD_OUTPUT_HANDLE);//pour la couleur
|
HANDLE hconsole = GetStdHandle(STD_OUTPUT_HANDLE);//pour la couleur
|
||||||
|
|
||||||
string motRandom = choisirMot("Mots/mot3lettres.txt", 15);
|
string motRandom = choisirMot("Mots/mot3lettres.txt", 15);
|
||||||
@@ -129,23 +131,34 @@ void effectuerTour(int nbLettre)
|
|||||||
for (int i = 0; i < nbLettre; i++) {
|
for (int i = 0; i < nbLettre; i++) {
|
||||||
|
|
||||||
if (motRandom[i] == motPlayer[i]) {
|
if (motRandom[i] == motPlayer[i]) {
|
||||||
|
string lettrePlayer;
|
||||||
SetConsoleTextAttribute(hconsole, 2);//mettre la lettre en vert
|
lettrePlayer = motPlayer[i];
|
||||||
cout << motPlayer[i];
|
lettrePlayer.insert(0, "Alphabet/Normal/");
|
||||||
SetConsoleTextAttribute(hconsole, 15);//remettre le texte en blanc
|
lettrePlayer.insert(17, ".txt");
|
||||||
|
nomFichier = lettrePlayer;
|
||||||
|
ouvrirFichier(monFlux, nomFichier);
|
||||||
|
printLettre(monFlux, 1);
|
||||||
|
fermerFichier(monFlux);
|
||||||
}
|
}
|
||||||
else if (lettreDansMot(motRandom, motPlayer, nbLettre)) {
|
else if (lettreDansMot(motRandom, motPlayer, nbLettre)) {
|
||||||
|
string lettrePlayer;
|
||||||
SetConsoleTextAttribute(hconsole, 6);//mettre la lettre en vert
|
lettrePlayer = motPlayer[i];
|
||||||
cout << motPlayer[i];
|
lettrePlayer.insert(0, "Alphabet/Normal/");
|
||||||
SetConsoleTextAttribute(hconsole, 15);//remettre le texte en blanc
|
lettrePlayer.insert(17, ".txt");
|
||||||
|
nomFichier = lettrePlayer;
|
||||||
|
ouvrirFichier(monFlux, nomFichier);
|
||||||
|
printLettre(monFlux, 2);
|
||||||
|
fermerFichier(monFlux);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
string lettrePlayer;
|
||||||
SetConsoleTextAttribute(hconsole, 8);//mettre la lettre en vert
|
lettrePlayer = motPlayer[i];
|
||||||
cout << motPlayer[i];
|
lettrePlayer.insert(0, "Alphabet/Normal/");
|
||||||
SetConsoleTextAttribute(hconsole, 15);//remettre le texte en blanc
|
lettrePlayer.insert(17, ".txt");
|
||||||
|
nomFichier = lettrePlayer;
|
||||||
|
ouvrirFichier(monFlux, nomFichier);
|
||||||
|
printLettre(monFlux, 3);
|
||||||
|
fermerFichier(monFlux);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
cout << endl;
|
cout << endl;
|
||||||
@@ -258,7 +271,7 @@ void printLettre(fstream& monFlux, int positionLettre) {
|
|||||||
}
|
}
|
||||||
else if (positionLettre == 3 /*Lettre non pr<70>sente*/)
|
else if (positionLettre == 3 /*Lettre non pr<70>sente*/)
|
||||||
{
|
{
|
||||||
couleurLettre = 00;
|
couleurLettre = 8;
|
||||||
}
|
}
|
||||||
else /*Pas une lettre*/
|
else /*Pas une lettre*/
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -36,3 +36,4 @@ void effectuerTour(int nbLettre);
|
|||||||
bool dansListe(string motPlayer);
|
bool dansListe(string motPlayer);
|
||||||
bool comparerMot(fstream& monFlux, string motPlayer, int numeroLigne);
|
bool comparerMot(fstream& monFlux, string motPlayer, int numeroLigne);
|
||||||
bool lettreDansMot(string motRandom, string motPlayer, int nbLettre);
|
bool lettreDansMot(string motRandom, string motPlayer, int nbLettre);
|
||||||
|
void printLettre(fstream& monFlux, int positionLettre);
|
||||||
Reference in New Issue
Block a user