Original Post
[redacted anon]
[redacted anon]
#include <iostream>#include <windows.h>using namespace std;int main(){ SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_RED); cout<<"Moo\n"; SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_BLUE); cout<<"Moo\n"; SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_GREEN); cout<<"Moo\n"; SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_GREEN | FOREGROUND_BLUE); cout<<"Moo\n"; SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_GREEN | FOREGROUND_RED); cout<<"Moo\n"; SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_RED | FOREGROUND_BLUE); cout<<"Moo\n"; cin.get(); return 0;}#include <iostream>#include <windows.h>using namespace std;enum ConsoleTextColor{ GREY, WHITE, RED, GREEN, BLUE, PURPLE, CYAN, BRIGHT_RED, BRIGHT_GREEN, BRIGHT_BLUE, LAVANDER, AQUA, YELLOW, GOLD};void SetConsoleTextColor(ConsoleTextColor cl){ WORD newColor; HANDLE ScreenBuffer = GetStdHandle(STD_OUTPUT_HANDLE); switch(cl) { case GREY: newColor = FOREGROUND_RED | FOREGROUND_BLUE | FOREGROUND_GREEN; break; case WHITE: newColor = FOREGROUND_RED | FOREGROUND_BLUE | FOREGROUND_GREEN | FOREGROUND_INTENSITY; break; case RED: newColor = FOREGROUND_RED; break; case GREEN: newColor = FOREGROUND_GREEN; break; case BLUE: newColor = FOREGROUND_BLUE; break; case PURPLE: newColor = FOREGROUND_RED | FOREGROUND_BLUE; break; case CYAN: newColor = FOREGROUND_GREEN | FOREGROUND_BLUE; break; case BRIGHT_RED: newColor = FOREGROUND_RED | FOREGROUND_INTENSITY; break; case BRIGHT_GREEN: newColor = FOREGROUND_GREEN | FOREGROUND_INTENSITY; break; case BRIGHT_BLUE: newColor = FOREGROUND_BLUE | FOREGROUND_INTENSITY; break; case LAVANDER: newColor = FOREGROUND_RED | FOREGROUND_BLUE | FOREGROUND_INTENSITY; break; case AQUA: newColor = FOREGROUND_GREEN | FOREGROUND_BLUE | FOREGROUND_INTENSITY; break; case YELLOW: newColor = FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_INTENSITY; break; case GOLD: newColor = FOREGROUND_RED | FOREGROUND_GREEN; break; } SetConsoleTextAttribute(ScreenBuffer, newColor);}int main(){ ConsoleTextColor textColor; for(int i = 0; i<=GOLD; i++) { textColor = (ConsoleTextColor)i; SetConsoleTextColor(textColor); cout << "Moo." << endl; } return 0;}This topic has been locked by a moderator. New replies are not allowed.
With your permission, GameDev.net uses analytics cookies to understand how people use the platform. You can accept analytics or continue with necessary cookies only. Learn more