View Full Version : Add Color in Win32 Console Application
06-25-2001, 02:54 PM
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 :P Thanx in advance.
06-25-2001, 04:28 PM
hehehe, is it like text based or something? what are you talking about?
06-25-2001, 04:33 PM
Its text based. Its all the standered grey color. How do I change the color of the text.
06-25-2001, 07:48 PM
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?
06-26-2001, 12:52 AM
lookup WriteConsoleOutputAttribute in
Think it may be what your after
06-26-2001, 06:14 AM
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. http://www.opengl.org/discussion_boards/ubb/smile.gif
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/ (http://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'.
textcolor(BLUE); //cprintf() now prints in blue!
cprintf("blah %f", floatvar); //Do like always
Powered by vBulletin® Version 4.2.2 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.