Lettre graphique

This commit is contained in:
2025-12-05 09:52:06 -05:00
parent b38c59c22d
commit b3ca976b13
2 changed files with 29 additions and 15 deletions

View File

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

View File

@@ -36,3 +36,4 @@ void effectuerTour(int nbLettre);
bool dansListe(string motPlayer);
bool comparerMot(fstream& monFlux, string motPlayer, int numeroLigne);
bool lettreDansMot(string motRandom, string motPlayer, int nbLettre);
void printLettre(fstream& monFlux, int positionLettre);