Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 9 of 9

Thread: Add Color in Win32 Console Application

  1. #1
    Junior Member Newbie
    Join Date
    Jun 2001
    Location
    america
    Posts
    9

    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 :P Thanx in advance.

  2. #2
    Junior Member Regular Contributor
    Join Date
    Sep 2000
    Posts
    205

    Re: Add Color in Win32 Console Application

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

  3. #3
    Junior Member Newbie
    Join Date
    Jun 2001
    Location
    america
    Posts
    9

    Re: Add Color in Win32 Console Application

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

  4. #4
    Junior Member Regular Contributor
    Join Date
    Sep 2000
    Posts
    205

    Re: Add Color in Win32 Console Application

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

  5. #5
    Intern Contributor
    Join Date
    Jun 2001
    Posts
    69

    Re: Add Color in Win32 Console Application

    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?

  6. #6
    Intern Contributor
    Join Date
    May 2001
    Location
    Cheltenham,Gloucestershire,England
    Posts
    86

    Re: Add Color in Win32 Console Application

    Hi there,

    lookup WriteConsoleOutputAttribute in
    MSDN

    Think it may be what your after

  7. #7
    Senior Member OpenGL Pro
    Join Date
    Oct 2000
    Location
    Fargo, ND
    Posts
    1,797

    Re: Add Color in Win32 Console Application

    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.
    Deiussum
    Software Engineer and OpenGL enthusiast

  8. #8
    Guest

    Re: Add Color in Win32 Console Application

    try a search at planetsourcecode.com also:

    look at dos.h

  9. #9
    Junior Member Newbie
    Join Date
    Sep 2003
    Posts
    6

    Re: Add Color in Win32 Console Application

    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •