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