VB icon

^!Using DOS Palettes!^

Email
Submitted on: 1/4/2015 7:40:00 AM
By: Josh Nixon (from psc cd)  
Level: Beginner
User Rating: By 5 Users
Compatibility: C++ (general)
Views: 2246
 
     This is a example to show a person how to use more then 16 colors in dos but not all at once.
 

INCLUDE files:

Can't Copy and Paste this?
Click here for a copy-and-paste friendly version of this code!
//**************************************
//INCLUDE files for :^!Using DOS Palettes!^
//**************************************
#include<graphics.h>
#include<dos.h>
code:
Can't Copy and Paste this?
Click here for a copy-and-paste friendly version of this code!
				
//**************************************
// Name: ^!Using DOS Palettes!^
// Description:This is a example to show a person how to use more then 16 colors in dos but not all at once.
// By: Josh Nixon (from psc cd)
//
// Assumes:This is a example to show a person how to use more then 16 colors in dos but not all at once.
//**************************************

#include<graphics.h>
#include<dos.h>
class Colors
{
 private:
 int graphdriver, graphmode;
 //Palettetype Contains palette information for the current graphics driver
 palettetype pal;//Contains palette information for the current graphics driver
 public:
 void Init_Graphics()
{
initgraph(&graphdriver,&graphmode,"..\\BGI\\");
}
 void Intro();
 Colors::Colors()
 {
graphdriver = DETECT;
Init_Graphics();
//getpalette gets information about the current palette
getpalette(&pal);//GetPalette demands that a pointer be passed
 }
};
int main()
{
 Colors Colors;
 Colors.Intro();
 return 0;
}
void Colors::Intro()
{
 for(int I = 0; I < 63; I++)
 {
setbkcolor(1);
//Defines colors for IBM-8514 graphics card
setrgbpalette(pal.colors[1],I,I,I);
delay(100);
 }
 for(I = 63; I > 0; I--)
 {
settextstyle(DEFAULT_FONT,HORIZ_DIR,6);
setrgbpalette(pal.colors[2],I,I,I);
setcolor(2);
 outtextxy(getmaxx()/2-250,getmaxy()/2-20,"Color CRAZY");
 delay(100);
 }//end for
}


Other 17 submission(s) by this author

 


Report Bad Submission
Use this form to tell us if this entry should be deleted (i.e contains no code, is a virus, etc.).
This submission should be removed because:

Your Vote

What do you think of this code (in the Beginner category)?
(The code with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor (See voting log ...)
 

Other User Comments


 There are no comments on this submission.
 

Add Your Feedback
Your feedback will be posted below and an email sent to the author. Please remember that the author was kind enough to share this with you, so any criticisms must be stated politely, or they will be deleted. (For feedback not related to this particular code, please click here instead.)
 

To post feedback, first please login.