Well actually I meant that I want to use some colors like brown, but it doesn't appear in the options that I can use, so I want to know the function RGB so I could create my own colors
I think it would look more or less like this. I don't have a windows compiler atm either, so this is possibly pure gibberish that I cobbled together from a couple of examples. Hopefully it steers you in the right direction?
1 2 3 4 5 6 7 8 9 10 11 12
#include <windows.h> // this is for visual studio...
int main()
{
HANDLE hConsole; //a pox on whoever invented the handle concept.
hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
SetConsoleTextAttribute(hConsole, 100); //100 is the color, you can mess with the value or look up how the function works..
//write to console in the above color here
return 0;
}
It's not possible to display RGB colors on the console. The console uses a (IIRC) 4-bit palette. No, ORing foreground constants won't do anything, but you can display different colors as foreground and background.
What exactly didnt work? Didnt compile because Jonnin can't type, or compiled and didn't change the colors, or blew up because handles are terrible, or something else?
This could be how it was done in 1997 too for all I know. It may not be the right way in 2015.
Well, actually it printed different letters xd and numbers and that was all
Sorry, I didn't expect many replies and my teacher told me that is possible to change the default colors of the console,well i think i have to say that i'm programming frogger in visual, so I want to use more colors, because it doesn't look well with just default colors.
Trying to do even simple graphics and game updating in a Windows console is going to be a major PITA. Easier (relatively speaking) would be to use Windows GDI.