Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void loadTextColor()
- {
- ifstream myfile;
- HANDLE hConsoleOut; //handle to the console
- hConsoleOut = GetStdHandle(STD_OUTPUT_HANDLE);
- int textColorSelection;
- int backgroundColorSelection;
- myfile.open("text.txt");
- while(myfile.is_open())
- {
- myfile >> textColorSelection;
- if(textColorSelection == 1)
- {
- SetConsoleTextAttribute(hConsoleOut, FOREGROUND_GREEN);
- myfile.close();
- break;
- }
- else if(textColorSelection == 2)
- {
- SetConsoleTextAttribute(hConsoleOut, FOREGROUND_BLUE);
- myfile.close();
- break;
- }
- else if(textColorSelection == 3)
- {
- SetConsoleTextAttribute(hConsoleOut, FOREGROUND_RED);
- myfile.close();
- break;
- }
- else
- {
- myfile.close();
- break;
- }
- }
- system("cls");
- loadBackgroundColor();
- }
- void loadBackgroundColor()
- {
- ifstream myfile;
- HANDLE hConsoleOut; //handle to the console
- hConsoleOut = GetStdHandle(STD_OUTPUT_HANDLE);
- int backgroundColorSelection;
- myfile.open("background.txt");
- while(myfile.is_open())
- {
- myfile >> backgroundColorSelection;
- if(backgroundColorSelection == 1)
- {
- SetConsoleTextAttribute(hConsoleOut, BACKGROUND_GREEN);
- myfile.close();
- break;
- }
- else if(backgroundColorSelection == 2)
- {
- SetConsoleTextAttribute(hConsoleOut, BACKGROUND_BLUE);
- myfile.close();
- break;
- }
- else if(backgroundColorSelection == 3)
- {
- SetConsoleTextAttribute(hConsoleOut, BACKGROUND_RED);
- myfile.close();
- break;
- }
- else
- {
- myfile.close();
- break;
- }
- }
- system("cls");
- mainMenu();
- }
Advertisement
Add Comment
Please, Sign In to add comment