Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


How to use more colours?

Hi there,
I have made some games in C & C ++ I just want to know that how we can use more than 16 colours in c without using asm keyword (cos i dont know 8086).


  • guiltyguilty Member Posts: 44
    : Hi there,
    : I have made some games in C & C ++ I just want to know that how we can use more than 16 colours in c without using asm keyword (cos i dont know 8086).
    : -Rohit

    I don't know ,but many people have done it ,with a little bit of system programming .
    However ,i suggest that you can take a look at my file in this site ,
    which gives some of the code ,by which you can use 256 colors in Turbo
    C++ ....Other People have also written such stuff .Check it out !
    Karthik Kumar V

  • DariusDarius Member Posts: 1,666
    Use a graphics library. You can use OpenGL or if you don't mind being tied to Microsoft Windows you can use DirectX. There are armies of other graphics libraries for varying uses, OSes, processors, and compilers/languages. If you go to a search engine and type in C (or C++) graphics library plus some other information like DOS and/or SVGA you should be able to find something. Actually the hard part will be going through the choices.

    My personal recommendation (if you're not going to make your own or even if you do) is OpenGL. It's easier to learn than DirectX and it's the defacto standard for almost all graphics applications. OpenGL v. DirectX, for any other use than games, OpenGL is without a doubt the API to use, then for games it's up to you, but I still say there are plenty of good reasons to use OpenGL over DirectX. My argument for these over just some random ones off the internet is a) these are better maintained and better designed than most you'll find on the internet, b) learning OpenGL (and DirectX though in a narrower context) will be something to put on your resume for any job involving graphics programming as opposed to John's SVGAlib found at (made-up).

    The only half-decent reason against learning these is that you want to stay in DOS. Since both of those libraries are 32-bit they would need to be accessed in a 32-bit operating system. I don't think there are ways to access them through DPMI though there may... Of course, you can get code on the internet that will do all the setup for you, but you'd still (in Windows) have to deal with a message based paradigm for you application.

    If you are hard set on staying with DOS, then I may recommend Allegro with the DJGPP compiler. The compiler compiles to DOS DPMI (Dos Protected Mode Interface) so you have 32-bit code, but it's still DOS. I haven't used Allegro personally, but it seems like it's an ok graphics lib. You can find it in a second with a search engine.

    "We can't do nothing and think someone else will make it right."
    -Kyoto Now, Bad Religion

  • Chris BrownChris Brown USAMember Posts: 4,624 ✭✭

    _ \ \ free ebooks and video tutorials about ( C++ Delphi MATLAB PHP Objective-C Python Visual Basic .NET Scratch C Swift Visual Basic Go Ruby JavaScript PL/SQL C# R Perl Java Assembly Scheme Lua FoxPro Alice Julia Crystal Prolog Erlang Rust Apex Logo LabVIEW Ada Kotlin Awk ML Lisp Bash Transact-SQL COBOL Clojure F# Hack Scala Fortran D Dart SAS VBScript ABAP ) ________

Sign In or Register to comment.