Colored Text

This is a discussion on Colored Text within the Game Programming forums, part of the General Programming Boards category; Can someone tell me (perferably someone who was DJGPP) step-by-step how to color text? Thanks Why are greenboards white?...

  1. #1
    I am he who is the man! Stan100's Avatar
    Join Date
    Sep 2002
    Posts
    361

    Question Colored Text

    Can someone tell me (perferably someone who was DJGPP) step-by-step how to color text? Thanks
    Why are greenboards white?

  2. #2
    Registered User JoshG's Avatar
    Join Date
    Mar 2002
    Posts
    326
    I think it is in the FAQ.
    Last edited by JoshG; 09-29-2002 at 06:14 AM.

  3. #3
    Registered User harryP's Avatar
    Join Date
    Sep 2002
    Posts
    124
    The only way I know of is the windows.h function, SetConsoleTextAttribute.

    ------------------------------------------------------------------------------------

    Function:
    BOOL SetConsoleTextAttribute(HANDLE hConsoleOutput, WORD wAttributes)

    Header File: windows.h

    Parameters:
    HANDLE hConsoleOutput - A handle to the window's screen buffer.
    WORD wAttributes - The foreground/background color/intensity.

    Example use:
    Code:
    // The handle to the screen buffer
    HANDLE stdOut = GetStdHandle(STD_OUTPUT_HANDLE);
    // This will make green text on a blue background
    SetConsoleTextAttribute(stdOut, FOREGROUND_GREEN | FOREGROUND_INTENSITY |BACKGROUND_BLUE | BACKGROUND_INTENSITY);
    ------------------------------------------------------------------------------------

    Hope that helps!

    Brendan
    Draco dormiens nunquam titallandus.
    Console Graphics Library: http://www.geocities.com/steve_alberto/cgl.html

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. How to use FTP?
    By maxorator in forum C++ Programming
    Replies: 8
    Last Post: 11-04-2005, 02:17 PM
  2. Colored Text in C
    By colorC in forum C Programming
    Replies: 4
    Last Post: 02-23-2004, 03:58 AM
  3. how to cout colored text?
    By Guanhui in forum C++ Programming
    Replies: 1
    Last Post: 07-05-2002, 08:14 AM
  4. Ok, Structs, I need help I am not familiar with them
    By incognito in forum C++ Programming
    Replies: 7
    Last Post: 06-29-2002, 09:45 PM
  5. Colored Text
    By Yoshi in forum A Brief History of Cprogramming.com
    Replies: 4
    Last Post: 11-28-2001, 08:46 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21