Advanced Color Text in console

Pages: 12
well then 0x0C, 0x0F, 0x0A. It's the same code as you, just in hexadecimal. It is more comfortable when you have two colors that way.
I found an easier way to do it, i tried the array method and it didn't work so i created a work around and an ingenious one at that, rather then try to change the color of the string, i just used if and else if to choose each of the 3 states based on the bool value that was true.

All this is for, is for the quest log its just a void display feature that then launches the manager if desired to read quest info / cancel quest. there is also an updater function that updates the status for the log, and manager view.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
if (IsQuest2Inactive)
	{
		cout << "[]Quest #2: Quest 2 Goes Here                       [Sample]        [";
		{
		SetConsoleTextAttribute(hConsole, 12); // Colored Text Red
		}		
		cout << ""<< IsQuest2VerifyState <<"";
        {
		SetConsoleTextAttribute(hConsole, 15); // Colored Text White
		}	
		cout << "]\n";
	}
	else if (IsQuest2Active)
	{
		cout << "[]Quest #2: Quest 2 Goes Here                       [Sample]        [";
		cout << ""<< IsQuest2VerifyState <<"";
		cout << "]\n";
	}
	else if (IsQuest2Completed)
	{
		cout << "[]Quest #2: Quest 2 Goes Here                       [Sample]        [";
		{
		SetConsoleTextAttribute(hConsole, 10); // Colored Text Green
		}
		cout << ""<< IsQuest2VerifyState <<"";
		{
		SetConsoleTextAttribute(hConsole, 15); // Colored Text White
		}	
		cout << "]\n";
	}
Last edited on
Topic archived. No new replies allowed.
Pages: 12