Add Color in Win32 Console Application

I was just making a little rpg. It would be a lot better if I could add color to it. Does anybody know how to at color to a Win32 Console Application. The colors I only need are Red, Green, and Blue :stuck_out_tongue: Thanx in advance.

hehehe, is it like text based or something? what are you talking about?

Its text based. Its all the standered grey color. How do I change the color of the text.

There aren’t any opengl commands that change the color of console text. I don’t know what commands do either. sorry.

hehe… text mode is the most OpenGL-offtopic question i could imagine (;

u have to load the ANSI.SYS in the CONFIG.SYS… DEVICE= C:[PATH]\ANSI.SYS
should be in the windows\command directory, but i’m not 100% sure
this enables some control commands, which can manipulate color, cursor-pos …
but cant remember them anymore…

btw: aren’t text mode games a bit outdated, are they?

Hi there,

lookup WriteConsoleOutputAttribute in
MSDN

Think it may be what your after

Heheh, ANSI text. Brings back memories of connecting to local BBSes at 2400 bps before I had access to the Internet. Text based games aren’t SO outdated. There are still a lot of text-based MUDS around. Some of them can even be addicting.

try a search at planetsourcecode.com also:

look at dos.h

Here’s a novel idea: forget the Windows App and write a DOS program. If that is what you mean, then all the better. Here’s how to have colored text, blinking text, different cursors, etc. Use the functions in conio.h . But don’t use Microsoft’s conio.h, because it doesn’t have the functions I am talking about. Download another good compiler, DJGPP (uses gcc and gpp) and a IDE with it called Rhide. Get it at www.delorie.com/djgpp/ .

Look at the help files for conio.h in Rhide to get the specifics. For example, you call a text attribute modifying function, such as textcolor(int COLOR), and then use the set of functions which are like printf() and scanf(), but start with a ‘c’.

Ex:

textcolor(BLUE); //cprintf() now prints in blue!

cprintf(“blah %f”, floatvar); //Do like always