Thread: How to increase Colors(More Colors)?

  1. #1
    Registered User
    Join Date
    Nov 2012
    Posts
    54

    How to increase Colors(More Colors)?

    Hello,

    In C, using graphics.h, I can only deal with limited number of colors
    like
    setcolor(int)

    is there another way to extend or another source or header file which provide more colors?

  2. #2
    Registered User
    Join Date
    Nov 2012
    Posts
    1,393
    This header is from Borland's BGI graphics library, which is old and probably unsupported. I found this thread on this same forum with more info:

    http://cboard.cprogramming.com/brief...r-turbo-c.html

    Anyway, to accomplish your goal (more colors), I would use a different library. Unless you're programming a DOS game to be played on classic computers.

    Cross-platform GUI Library examples:
    Qt
    GTK

    Cross-platform game Library examples:
    SDL
    Allegro

    Search those keywords for more information.

  3. #3
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,660
    > In C, using graphics.h, I can only deal with limited number of colors
    If you persist in programming using a DOS compiler, then you're always going to be stuck with the 16/256 colours that DOS could ever deal with.

    Use a modern compiler, for your modern OS, which can make the best use of your modern graphics card.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  4. #4
    Registered User
    Join Date
    Nov 2012
    Posts
    54
    im using c++ 3.0 compiler with XP.
    Is this not enough?
    I need resources like objects, codes or header files to improve colors. Is it possible?How?

  5. #5
    SAMARAS std10093's Avatar
    Join Date
    Jan 2011
    Location
    Nice, France
    Posts
    2,694
    If you want really do something good, upgrade to C++ and use Direct X or openGl
    Code - functions and small libraries I use


    It’s 2014 and I still use printf() for debugging.


    "Programs must be written for people to read, and only incidentally for machines to execute. " —Harold Abelson

  6. #6
    Registered User
    Join Date
    May 2010
    Posts
    4,633
    im using c++ 3.0 compiler with XP.
    Is this not enough?
    No, that compiler is very old and only produces DOS programs. You need to find a more recent compiler if you want more colors.

    Jim

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Relation between material colors and light colors.
    By indigo0086 in forum Game Programming
    Replies: 3
    Last Post: 04-18-2007, 03:20 PM
  2. colors in forefox and colors in IE
    By MisterSako in forum Tech Board
    Replies: 3
    Last Post: 05-15-2006, 01:59 PM
  3. colors
    By volk in forum C++ Programming
    Replies: 7
    Last Post: 03-16-2003, 08:11 PM
  4. colors (yes again)
    By Klinerr1 in forum C++ Programming
    Replies: 10
    Last Post: 07-18-2002, 08:01 PM
  5. colors (again)
    By Klinerr1 in forum C++ Programming
    Replies: 6
    Last Post: 07-14-2002, 09:37 AM