Fix d'un bug suite au changement de la couleurs du background, lorsqu'on retourne dans le menu principal.
This commit is contained in:
4
main.cpp
4
main.cpp
@@ -28,6 +28,7 @@ int main() {
|
||||
|
||||
while (quitter == false) {
|
||||
curseur(false);
|
||||
backgroundDefault();
|
||||
afficherMenu("AfficheMenu/Taxon.txt");
|
||||
|
||||
int choixMenu = _getch();
|
||||
@@ -37,6 +38,8 @@ int main() {
|
||||
afficherMenu("AfficheMenu/TaxonOption1.txt");
|
||||
delai();
|
||||
curseur(true);
|
||||
system("cls");
|
||||
background(temp);
|
||||
choisirMot("Mots/mot3lettres.txt", nbMot3lettre);
|
||||
break;
|
||||
|
||||
@@ -44,6 +47,7 @@ int main() {
|
||||
afficherMenu("AfficheMenu/TaxonOption2.txt");
|
||||
delai();
|
||||
curseur(true);
|
||||
system("cls");
|
||||
temp = demanderBackground();
|
||||
background(temp);
|
||||
break;
|
||||
|
||||
@@ -88,7 +88,6 @@ void curseur(bool interrupteur) {
|
||||
====================================*/
|
||||
//fonction pour choisir le mot de facon random
|
||||
void choisirMot(string nomFichier, int maximum) {
|
||||
|
||||
int numeroLigne = rand() % (maximum)+1;
|
||||
|
||||
fstream monFlux;
|
||||
@@ -110,6 +109,7 @@ string goToLine(fstream& monFlux, int numeroLigne) {
|
||||
====================================*/
|
||||
void background(int couleur) {
|
||||
HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
|
||||
|
||||
switch (couleur) {
|
||||
case '1':
|
||||
SetConsoleTextAttribute(hConsole, BACKGROUND_RED | BACKGROUND_INTENSITY);
|
||||
@@ -141,8 +141,12 @@ void background(int couleur) {
|
||||
}
|
||||
|
||||
int demanderBackground() {
|
||||
system("cls");
|
||||
cout << "Choix";
|
||||
int choix = _getche();
|
||||
return choix;
|
||||
}
|
||||
|
||||
void backgroundDefault() {
|
||||
HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
|
||||
SetConsoleTextAttribute(hConsole, 0x0F);
|
||||
}
|
||||
@@ -26,6 +26,7 @@ void delai();
|
||||
void curseur(bool interrupteur);
|
||||
void background(int couleur);
|
||||
int demanderBackground();
|
||||
void backgroundDefault();
|
||||
|
||||
// Mot
|
||||
void choisirMot(string nomFichier, int maximum);
|
||||
|
||||
Reference in New Issue
Block a user