Advertisement
7_2009-2012 Graphics/ Sound #228714

^!Using DOS Palettes!^

This is a example to show a person how to use more then 16 colors in dos but not all at once.

AI

สรุปโดย AI: This codebase represents a historical implementation of the logic described in the metadata. Our preservation engine analyzes the structure to provide context for modern developers.

ซอร์สโค้ด
original-source
#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
}
Upload
ความคิดเห็นดั้งเดิม (3)
กู้คืนจาก Wayback Machine