Esempio n. 1
0
void main()
{
	int driver=DETECT,mode;
	int X1=250,Y1=244,R1=50,
	    X2=260,Y2=233,R2=70,
	    X3=270,Y3=210,R3=100;

	registerbgidriver(EGAVGA_driver);
	initgraph(&driver,&mode,"");
	setcolor(DARKGRAY);
	circle(X3,Y3,R3);
	setfillstyle(1,DARKGRAY);
	floodfill(X3,Y3,DARKGRAY);
	delay(30);
	setcolor(LIGHTGRAY);
	circle(X2,Y2,R2);
	setfillstyle(1,LIGHTGRAY);
	floodfill(X2,Y2,LIGHTGRAY);
	delay(30);
	setcolor(WHITE);
	circle(X1,Y1,R1);
	setfillstyle(1,WHITE);
	floodfill(X1,Y1,WHITE);
	delay(30);
	getch();
	setcolor(11);
	outtextxy(10,450,"*-*-*-*-*-*-*-*-*-*-*-*-*"
				  " ISN'T IT A BEAUTIFUL BALL?"
				  " *-*-*-*-*-*-*-*-*-*-*-*-*-*");
	getch();
	closegraph();
}
Esempio n. 2
0
void main()
{
    int gdriver = DETECT, gmode;
    registerbgidriver(EGAVGA_driver);
    initgraph(&gdriver, &gmode, "");
    /**
    BLACK, BLUE, RED, WHITE, CYAN, GREEN, BROWN, LIGHTGRAY, YELLOW, DARKGREY, LIGHTBLUE,
    */
    setbkcolor(BLUE); // 设置背景颜色
    setcolor(WHITE); // 设置文本等图形的颜色
    outtextxy(10, 10, "Welcome!");
    
    rectangle(50, 50, 130, 130);// 输出矩形
    
    int key = bioskey(0);
    printf("%x\n", key);
    if(key == KEY_UP) {
    	printf("up");
    }
    
    getch();
    closegraph();//
    
    /**
    bgiobj egavga
    把生成的egavga.obj复制到tlib同级目录中
    tlib lib\graphics.lib+egavga
    */
    
}
Esempio n. 3
0
int main(int argc, char *argv[])
   {
   int   i;
   int   gdriver = DETECT, gmode;
   char  *name = "H--C";

#ifdef   BGI_DIRECTORY
   initgraph(&gdriver, &gmode, BGI_DIRECTORY);
#else
   // use of linked driver allows demo to run without knowing BGI location
   if (registerbgidriver(EGAVGA_driver)<0)
      return fprintf(stderr, "registerbgidriver failed\n")!=0;
   initgraph(&gdriver, &gmode, "");
#endif
   if (graphresult()!=grOk)
      return fprintf(stderr, "%s: initgraph failed\n", argv[0])!=0;
   setfillstyle(SOLID_FILL, BLACK);
   if (argc>1)
      strncpy(name, argv[1], 4);
   for (i=12; i>5; i--)
      {
      sprintf(&name[3], "%1X", i);
      showFont(name);
      }
   closegraph();
   return 0;
   }
Esempio n. 4
0
void Initgr()                  /* 初始化图形模式 */
{ 
  int gdriver=DETECT,gmode;
  registerbgidriver(EGAVGA_driver);
  initgraph(&gdriver,&gmode,"");
  X_max=getmaxx();
  Y_max=getmaxy();         /* 鼠标活动范围最大值 */
}
Esempio n. 5
0
     void init(int color)
     {
      int drive,mode;
      drive=DETECT;
      registerbgidriver(EGAVGA_driver);
      initgraph(&drive,&mode,"");
      setbkcolor(color);


    }
Esempio n. 6
0
void setup_environment(Char *argv[], boolean *canbeplotted)
{
  boolean firsttree;
  char* treestr;

  /* Set up all kinds of fun stuff */
#ifdef MAC
  OSErr retcode;
  FInfo  fndrinfo;
  macsetup("Drawgram","Preview");
#endif
#ifdef TURBOC
  if ((registerbgidriver(EGAVGA_driver) <0) ||
      (registerbgidriver(Herc_driver) <0)   ||
      (registerbgidriver(CGA_driver) <0)){
    printf("Graphics error: %s ",grapherrormsg(graphresult()));
    exit(-1);}
#endif

  

 
  printf("DRAWGRAM from PHYLIP version %s\n",VERSION);
  printf("Reading tree ... \n");
  firsttree = true;
  treestr = ajStrGetuniquePtr(&phylotrees[0]->Tree); 
  allocate_nodep(&nodep, treestr, &spp);
  treeread (&treestr, &root, treenode, &goteof, &firsttree,
            nodep, &nextnode, &haslengths,
            &grbg, initdrawgramnode,true,-1);
  root->oldlen = 0.0;
  printf("Tree has been read.\n");
  printf("Loading the font .... \n");
  loadfont(font,argv[0]);
  printf("Font loaded.\n");
  previewing = false;
  ansi = ANSICRT;
  ibmpc = IBMCRT;
  firstscreens = true;
  initialparms();
  (*canbeplotted) = false;
}  /* setup_environment */
Esempio n. 7
0
void main()
{
	int driver=DETECT,mode;
	int NUM1,NUM2;

	registerbgidriver(EGAVGA_driver);
	initgraph(&driver,&mode,"");
	DRAWPICTURE();
	FADEOUT();
	getch();
	closegraph();
}
Esempio n. 8
0
nclude <graphics.h>
#include <math.h>
#include <conio.h>

#define PI 3.1415926535

/* 图形驱动函数 */
void initgr(void)
{
    int gd = DETECT, gm = 0;
    registerbgidriver(EGAVGA_driver);
    initgraph(&gd, &gm, "");
}
Esempio n. 9
0
void main()
{
	int driver=DETECT,mode;

	registerbgidriver(EGAVGA_driver);
	initgraph(&driver,&mode,"");
	DRAWPICTURE();
	getch();
	CLR_X();
	setcolor(YELLOW);
	outtextxy(250,200,"Press any key to EXIT!");
	getch();
	closegraph();
}
Esempio n. 10
0
void main()
{
	int NUM,I,VALUE[50];
	int driver=DETECT,mode;

	registerbgidriver(EGAVGA_driver);
	initgraph(&driver,&mode,"");

	NUM=READ_NUM();
	for(I=1;I<=NUM;I++)
		VALUE[I]=READ_HIGHT(I);
	setcolor(WHITE);
	line(0,400,639,400);
	setcolor(YELLOW);
	setfillstyle(1,BLUE);
	for(I=1;I<=NUM;I++)
		bar3d(I*10,400-VALUE[I],(I+1)*10,400,10,1);
	getch();
	closegraph();
}
Esempio n. 11
0
int setup(void)
{
  int gdriver = DETECT, gmode, errorcode;
  errorcode = registerbgidriver(EGAVGA_driver);
  if (errorcode < 0)
    return 1;
  initgraph(&gdriver, &gmode, "");
  errorcode = graphresult();
  if (errorcode != grOk)
    return 2;
  errorcode = registerbgifont(triplex_font);
  if (errorcode < 0)
    return 3;
  errorcode = registerbgifont(sansserif_font);
  if (errorcode < 0)
    return 5;
   clearviewport();
  settextjustify(LEFT_TEXT,TOP_TEXT);
  setcolor(WHITE);
  setfillstyle(SOLID_FILL, BLACK);
  return 0;
}
Esempio n. 12
0
/*-----------------------------------------------------------------*/
int open_display ()
{
       int  rc,
            gdriver,
            gmode,
            errorcode;

       gdriver=DETECT;
       errorcode=registerbgidriver (EGAVGA_driver);

       if (errorcode < 0)
          {
          printf ("Erro: Display grafico nao encontrado\n");
          exit   (1);
          }
       else
          {
          rc=0;
          initgraph (&gdriver, &gmode, "");
          if (gdriver < 9)
             {
             _MAX_X=640.0;    /* 640.0 */
             _MAX_Y=350.0;    /* 480.0 */
             //printf ("Erro: Deve ser pelo menos um VGA\n");
             //exit   (1);
             }

          }

       /* limpa a tela */
       setfillstyle (1, 15);
       bar          (x_n2d(0.0), y_n2d(0.0), x_n2d(_QLT_X), y_n2d(_QLT_Y));
       setcolor     (0);

       return( rc );
}
Esempio n. 13
0
void Initgraph()
{
	int gdriver = DETECT, gmode;
	registerbgidriver(EGAVGA_driver);
	initgraph(&gdriver, &gmode, "");
}
Esempio n. 14
0
//------------------------- MAIN ----------------------------------
void main()
{

       int av2=-8,av3=-8,diff=0,gflag = 0;
	char ans='1';

	/*textmode(64);
	textbackground(15);
	textcolor(0);
	gotoxy(37,2);
	cout<<"STAGE 1\n";*/

	settextstyle(3,0,2);
	outtextxy(250,100,"Quick Gun Murugan");
	settextstyle(3,0,1);
	outtextxy(100,120,"1.Play the Game");
	outtextxy(100,140,"2.HighScores");
	outtextxy(100,160,"3.Instructions");
	outtextxy(120,180,"3a.Select the cursor to play the Game");
	outtextxy(120,200,"3b.Hit the Head(Circular part) of Person");
	outtextxy(120,220,"3c.For every Hit your Score will be increased by 1");
	outtextxy(120,240,"3d.For every Miss your Score will be decreased by 3");

	outtextxy(400,360,"Made by:");
	outtextxy(430,380,"Mohit Gvalani(076039)");
	outtextxy(430,400,"Tarun Hasija(076041)");
	outtextxy(430,420,"Dhiraj Jagiasi(076046)");
	getch();
	setgraphmode(2);
	registerbgidriver(EGAVGA_driver);
	registerfarbgifont(sansserif_font_far);
	registerfarbgifont(gothic_font_far);
	registerfarbgifont(triplex_font_far);
	cout<<endl<<registerfarbgifont(bold_font_far);
	cout<<endl<<registerfarbgifont(tscr_font_far);
	//cout<<endl<<registerbgifont(bold_font);
	//cout<<endl<<registerbgifont(tscr_font);
	//getch();

	int gdriver = VGA;
	int gmode = 2;
	initgraph(&gdriver, &gmode, "C:\\TC\\BGI");           // initialize graph


	gotoxy(20,20);
	setfillstyle(11,LIGHTGRAY);
	bar(0,0,getmaxx(),getmaxy());
	settextstyle(4,0,8);
	setcolor(WHITE);
	outtextxy(175,100,"STAGE 1");
	settextstyle(3,0,6);
	setcolor(GREEN);
	outtextxy(120,200,"Catch the Zombie");

	char mess[] = "\nMr.Murugan, you have to catch a Zombie before he runs away.\nYou'll be given a Maths Question with 4 possible answers.\nPress the appropriate number to give your answer(1,2,3 or 4).\nIf your answer is correct, the Zombie will be caught. Else he'll escape.\nGood Luck!\n";
	int som = sizeof(mess)/sizeof(char);
	for(int i=0; i<som; i++)
	{
		cout<<mess[i];
		delay(60);
	}
	//gotoxy(20,30);
	textcolor(RED+BLINK);
	cout<<"Press any key to start";

	getch();

	//setgraphmode(1);
	setgraphmode(2);

	setfillstyle(0,BLACK);
	bar(0,0,getmaxx(),getmaxy());
	setcolor(150);
	setfillstyle(1,150);
	setlinestyle(0,1,3);
	bar3d(-50,350,getmaxx()-50,getmaxy(),120,10);
	line(getmaxx()-50,getmaxy(),getmaxx()+100,getmaxy()-100);
	setcolor(0);
	line(70,348,70,263);
	setlinestyle(0,0,1);
	setcolor(15);
	settextstyle(1,0,0);
	settextstyle(10,0,2);
	setcolor(90);
	outtextxy(150,400,"Quick Gun Murugan");
	settextstyle(3,0,4);
	int deltime=20;


	line(lh[0][0],lh[0][1],lh[1][0],lh[1][1]);
	line(rh[0][0],rh[0][1],rh[1][0],rh[1][1]);
	line(mo[0][0],mo[0][1],mo[1][0],mo[1][1]);
	line(yo[0][0],yo[0][1],yo[1][0],yo[1][1]);
	line(t[0][0],t[0][1],t[1][0],t[1][1]);
	circle(h[0][0],h[0][1],20);



	randomize();
	int n1 = random(100);
	int n2 = random(100);
	int n3 = 0;
	n3 = n1*n2;
	/*gotoxy(0,0);
	moverel(x,y);
	delline();delline();delline();delline();delline();delline();*/
	cout<<"\nQ: "<<n1<<" x "<<n2<<" = ?\n";

	cout<<"1."<<random(5000)<<"   2."<<n3<<"   3."<<random(2000)<<"   4."<<random(8000);

	do
	{
 //-------------------------STEP1-------RED------------------------
		do
		{
			setcolor(0);
			circle(h[0][0],h[0][1],20);
			line(lh[0][0],lh[0][1],lh[1][0],lh[1][1]);
			line(rh[0][0],rh[0][1],rh[1][0],rh[1][1]);
			line(yo[0][0],yo[0][1],yo[1][0],yo[1][1]);
			line(mo[0][0],mo[0][1],mo[1][0],mo[1][1]);
			line(t[0][0],t[0][1],t[1][0],t[1][1]);

			setcolor(15);
			rotate(rh,-av2/4,yo[1][0],yo[1][1]);
			rotate(lh,-av2/4,yo[1][0],yo[1][1]);
			rotate(yo,-av2/4,yo[1][0],yo[1][1]);
			rotate(mo,-av2/4,yo[1][0],yo[1][1]);
			rotate(t,-av2/4,yo[1][0],yo[1][1]);
			rotate(h,-av2/4,yo[1][0],yo[1][1]);

			line(lh[0][0],lh[0][1],lh[1][0],lh[1][1]);
			line(rh[0][0],rh[0][1],rh[1][0],rh[1][1]);
			line(mo[0][0],mo[0][1],mo[1][0],mo[1][1]);
			line(yo[0][0],yo[0][1],yo[1][0],yo[1][1]);
			line(t[0][0],t[0][1],t[1][0],t[1][1]);
			circle(h[0][0],h[0][1],20);

			delay(deltime);
			if(kbhit())
			{
				flag=1;
				break;
			}
		}
		while(yo[0][0]<=yo[1][0]);

		if(flag==1)
			break;

   //-------------------------STEP2------------GREEN-------------------
		 diff = yo[1][0]-mo[1][0];
		 //cout<<diff<<endl<<mo[1][0]-yo[1][0];
		 do
		 {
			setcolor(0);
			line(mo[0][0],mo[0][1],mo[1][0],mo[1][1]);

			setcolor(15);
			rotate(mo,av3/2,mo[0][0],mo[0][1]);
			line(mo[0][0],mo[0][1],mo[1][0],mo[1][1]);
			delay(deltime);

			if(kbhit())
			{
				flag=1;
				break;
			}
		 }
		 while(mo[1][0]-yo[1][0]<=diff);

		 if(flag==1)
			break;

 //-------------------------STEP3----------BLUE---------------------

		while(mo[1][1] < 301)
		{
			setcolor(0);
			circle(h[0][0],h[0][1],20);
			line(lh[0][0],lh[0][1],lh[1][0],lh[1][1]);
			line(rh[0][0],rh[0][1],rh[1][0],rh[1][1]);
			line(yo[0][0],yo[0][1],yo[1][0],yo[1][1]);
			line(mo[0][0],mo[0][1],mo[1][0],mo[1][1]);
			line(t[0][0],t[0][1],t[1][0],t[1][1]);

			setcolor(15);
			rotate(rh,-av2/4,yo[1][0],yo[1][1]);
			rotate(lh,-av2/4,yo[1][0],yo[1][1]);
			rotate(yo,-av2/4,yo[1][0],yo[1][1]);
			rotate(mo,-av2/4,yo[1][0],yo[1][1]);
			rotate(t,-av2/4,yo[1][0],yo[1][1]);
			rotate(h,-av2/4,yo[1][0],yo[1][1]);

			line(lh[0][0],lh[0][1],lh[1][0],lh[1][1]);
			line(rh[0][0],rh[0][1],rh[1][0],rh[1][1]);
			line(mo[0][0],mo[0][1],mo[1][0],mo[1][1]);
			line(yo[0][0],yo[0][1],yo[1][0],yo[1][1]);
			line(t[0][0],t[0][1],t[1][0],t[1][1]);
			circle(h[0][0],h[0][1],20);

			delay(deltime);

			if(kbhit())
			{
				flag=1;
				break;
			}
		}

		if(flag==1)
			break;

  //-------------------------STEP4--------YELLOW-----------------------

		do
		{
			setcolor(0);
			circle(h[0][0],h[0][1],20);
			line(lh[0][0],lh[0][1],lh[1][0],lh[1][1]);
			line(rh[0][0],rh[0][1],rh[1][0],rh[1][1]);
			line(t[0][0],t[0][1],t[1][0],t[1][1]);

			setcolor(15);
			rotate(rh,av2/4,t[1][0],t[1][1]);
			rotate(lh,av2/4,t[1][0],t[1][1]);
			rotate(t,av2/4,t[1][0],t[1][1]);
			rotate(h,av2/4,t[1][0],t[1][1]);

			line(lh[0][0],lh[0][1],lh[1][0],lh[1][1]);
			line(rh[0][0],rh[0][1],rh[1][0],rh[1][1]);
			line(t[0][0],t[0][1],t[1][0],t[1][1]);
			circle(h[0][0],h[0][1],20);

			delay(deltime);
		}
		while(t[0][0]>=t[1][0]);

		if(kbhit())
		{
			flag=1;
			break;
		}
		if(flag==1)
			break;


 // -------------------------------STEP5----------------------------

		swap();
		setcolor(0);
		circle(h[0][0],h[0][1],20);
		h[0][0] = t[0][0];
		h[0][1] = t[0][1] - 20;
		setcolor(15);
		circle(h[0][0],h[0][1],20);

 //------------------------------------------------------------------

		if(lh[1][0]>getmaxx())
			break;

	}
	while(1);
	if(flag==1)
		ans = getch();

	for(int j=0; j<=getmaxy(); j++)
		for(int k=0; k<=getmaxx(); k++)
			putpixel(k,j,0);

	gotoxy(35,15);
	if((ans=='2'))
	{
		cout<<"STAGE CLEARED";
		cout<<"\n\n\n\n\n\n              Press any key to continue.";
	}
	else
 {
	cout<<"WRONG ANSWER!\nThe Zombie escaped.\nYou're a waste!";
	cout<<"\n\n\n\n\n\n              Press any key to continue.";
	gflag = 1;
 }
	getch();


 if(gflag==0)
 {
	gotoxy(20,15);
	setfillstyle(11,LIGHTGRAY);
	bar(0,0,getmaxx(),getmaxy());
	settextstyle(4,0,8);
	setcolor(WHITE);
	outtextxy(150,50,"STAGE 2");
	settextstyle(3,0,6);
	setcolor(GREEN);
	outtextxy(140,150,"HIT the Zombie");

	char mess2[] = "\nMr.Murugan, the Zombie is now captured and straped.\nYour job is to shoot at his head and score as many points as you can.\nIf your score is the highest, you'll earn the title of 'QUCIKGUN'.\nA HIT is 1 point, a MISS is -3 points.\nIf you hit at dead centre of his head, you get +20 points.\nYou only get 3 MISSes, after which this stage terminates.\nPress appropriate number to choose gunpoint.\n1.Point(default) \n2.Gun\n3.Arrow \n4.Hour Glass \nPress any key to abort in between.\nGood Luck!\n";
	som = sizeof(mess2)/sizeof(char);
	for(i=0; i<som; i++)
	{
		cout<<mess2[i];
		delay(60);
	}

	//gotoxy(20,30);
	textcolor(RED+BLINK);
	cout<<"Press any key to start";

	//setgraphmode(1);
	//setgraphmode(2);
	char mouseopt;
	mouseopt = getch();
	char counter[15];

	setfillstyle(0,BLACK);
	bar(0,0,getmaxx(),getmaxy());






	 revert();
	//int gdriver = DETECT,gmode,errorcode;

	//cout<<"Driver : "<<getdrivername()<<"\nMode : "<<getgraphmode();
	int color = WHITE;
	//line(0,y+100,getmaxx(),y+100);            // draw ground
	int av = -2;			   	  // in degrees
	//rotate(lh,50,200,220);//lh[0][0],lh[0][1]);
	//rotate(rh,-50,200,220);//x,y+20);
	//setactivepage(0);
	initmouse();                      
	if(mouseopt=='2')
		mouseCursor(cursorgun);
	else if(mouseopt=='3')
	{}
	else if(mouseopt=='4')
		mouseCursor(cursor2);
	else
		mouseCursor(cursor);

	showmptr();
	getcood(&butt, &xi, &yi);
	//cout<<butt<<" "<<xi<<" "<<yi;
	setcolor(150);
	setfillstyle(1,150);
	setlinestyle(0,1,3);
	bar3d(-50,350,getmaxx()-50,getmaxy(),120,10);
	//bar(70,0,getmaxx(),260);
	line(getmaxx()-50,getmaxy(),getmaxx()+100,getmaxy()-100);
	setcolor(0);
	line(70,348,70,263);
	setlinestyle(0,0,1);
	setcolor(15);
	settextstyle(4,0,4);
	//settextstyle(10,0,2);
	setcolor(0);
	outtextxy(150,400,"Quick Gun Murugan");
	settextstyle(3,0,4);
	setcolor(90);
	outtextxy(10,10,"HIT : 0");
	setcolor(20);
	outtextxy(10,60,"MISS : 0");
	flag=0;
	do
	{
		hidemptr();
		setcolor(0);
		circle(x,y,20);
		line(lh[0][0],lh[0][1],lh[1][0],lh[1][1]);
		line(rh[0][0],rh[0][1],rh[1][0],rh[1][1]);
		line(ll[0][0],ll[0][1],ll[1][0],ll[1][1]);
		line(rl[0][0],rl[0][1],rl[1][0],rl[1][1]);
		line(t[0][0],t[0][1],t[1][0],t[1][1]);
		showmptr();
		//clrman();
		x+=2;
		setcolor(color);

		circle(x,y,20);
		translate(lh,2,0);
		translate(rh,2,0);
		translate(ll,2,0);
		translate(rl,2,0);
		translate(t,2,0);
		if(rotc>40)
		{
			av *= -1;
			rotc = 0;
		}

		//rotate(lh,av,/*200,220);*/lh[0][0],lh[0][1]);
		//rotate(rh,-av,/*200,220);*/x,y+20);
		//rotate(ll,av,/*200,220);*/x,y+60);
		//rotate(rl,-av,/*200,220);*/x,y+60);*/
		rotc++;
		line(lh[0][0],lh[0][1],lh[1][0],lh[1][1]);
		line(rh[0][0],rh[0][1],rh[1][0],rh[1][1]);
		line(ll[0][0],ll[0][1],ll[1][0],ll[1][1]);
		line(rl[0][0],rl[0][1],rl[1][0],rl[1][1]);
		line(t[0][0],t[0][1],t[1][0],t[1][1]);
		//cout<<lh[0][0]<<" "<<lh[0][1]<<" "<<lh[1][0]<<" "<<lh[1][1]<<"\n";
	int count = speed;
	do
	{
		//cout<<count<<" ";
		count--;
		getcood(&butt, &xi, &yi);
		delay(0); // FOR SLOWER SPEED, MAKE DELAY 1 or 2.
		if((butt & 1)==1)
		{
			line(xi-2,yi-4,xi-10,yi-8);
			line(xi-2,yi-2,xi-6,yi-4);
			line(xi-2,yi,xi-4,yi);
			line(xi-2,yi+2,xi-6,yi+4);
			line(xi-2,yi+4,xi-10,yi+8);
			sound(10);

			delay(100);

			nosound();
			hidemptr();
			setcolor(0);
			line(xi-2,yi-4,xi-10,yi-8);
			line(xi-2,yi-2,xi-6,yi-4);
			line(xi-2,yi,xi-4,yi);
			line(xi-2,yi+2,xi-6,yi+4);
			line(xi-2,yi+4,xi-10,yi+8);
			showmptr();


			getcood(&butt, &xi, &yi);

			if((butt & 1)==0)
			{
			    if((xi>x-20)&&(xi<x+20)&&(yi>y-20)&&(yi<y+20))
			    {
				//cout<<" HIT";
				hit++;
				if((xi==x)&&(yi==y))
					hit+=19;
				setfillstyle(1,0);
				setcolor(10);
				bar(300,50,400,100);
				bar(10,10,150,60);
				outtextxy(300,50,"HIT");
				sprintf(counter,"HIT :  %d",hit);
				outtextxy(10,10,counter);
				speed/=2;
				continue;
			    }
			    else
			    {
				//cout<<" MISS";
				miss++;
				setfillstyle(1,0);
				setcolor(20);
				bar(300,50,350,100);
				bar(50,60,150,110);
				outtextxy(300,50,"MISS");
				sprintf(counter,"MISS :  %d",miss);
				outtextxy(10,60,counter);

				if(miss==3)
				{
					flag=1;
					break;
				}
			   }
			}

		}
	}while(count>0);
		if(x>getmaxx()+30)
		{
			x=10;
			lh[0][0]=x;
			rh[0][0]=x;
			ll[0][0]=x;
			rl[0][0]=x;
			t[0][0]=x;
			lh[1][0]=x-30;
			ll[1][0]=x-30;
			rh[1][0]=x+30;
			rl[1][0]=x+30;
			t[1][0]=x;
		}
		if(flag==1)
		{	break;
			//getch();
			//getch();
		}
		//delay(speed);
	}
	while(!kbhit());
	if(flag==0)
		getch();
	//delay(1000);
	//clrscr();
	//setactivepage(1);
	for(j=0; j<=getmaxy(); j++)
		for(k=0; k<=getmaxx(); k++)
			putpixel(k,j,0);
 }
	//delay(500);
	hidemptr();
	setfillstyle(6,200);
	bar(0,0,getmaxx(),getmaxy());
	setcolor(87);
	settextstyle(4,0,8);
	outtextxy(50,100," GAME OVER");
	settextstyle(0,0,2);
	setcolor(76);
	char score[20];
	sprintf(score,"Your Score:  %d",(hit-3*miss));
	outtextxy(190,220,score);
	settextstyle(3,0,8);
	setcolor(10);
	outtextxy(180,300,"MIND IT!");
	settextstyle(1,0,1);
	setcolor(WHITE);
	outtextxy(170,450,"Press any key to contiue.");
	//setvisualpage(1);
	getch();
}
Esempio n. 15
0
int main(int argc, char *argv[])
{
  int size, rpoints, gpoints, input, end_game, shareware_flag;
  char buffer[129];
  char *index;
  int nquotes;

  randomize();

  getquotes(nquotes);

  if (registerbgidriver(EGAVGA_driver) < 0) exit(1);
  if (registerbgifont(triplex_font) < 0) exit(1);
  int gdriver, gmode, errorcode;
  gdriver = VGA;
  gmode = VGAHI;
  initgraph(&gdriver, &gmode, "");
  errorcode = graphresult();
  if (errorcode != grOk)
     exit(1);

  shareware_flag = 2;

  if (argc > 1)
    {
     index = argv[1];
     while (*index)
       {
	*index = toupper(*index) + 1;
	index++;
       };
     if ( strcmp(argv[1], "BMFHSJB") == 0)
	shareware_flag = 1;
     if ( strcmp(argv[1], "CPTDP") == 0)
	shareware_flag = 0;
    };

  if (shareware_flag)
     title();

  if (shareware_flag == 2)
     shareware();

  if (shareware_flag == 0)
    {
     on(C);
     on(H);
     on(E);
     on(S1);
     on(S2);
     on(PLUS);
     getch();
    };

  cleardevice();
  gotoxy(0,0);
  puts("Chess Plus V 1.2, (C) 1992 Nick Mathewson\n");

  while(kbhit())
     getch();

  do
    {
     printf("Enter board size (5-12) :");
     gets(buffer);
     size = atoi(buffer);
    }
  while ( (size < 5) || (size > 12) );

  do
    {
     printf("Enter Red's starting points (10-200, %d recommended) :",
	     size * 6);
     gets(buffer);
     rpoints = atoi(buffer);
    }
  while ( (rpoints < 10) || (rpoints > 200) );

  do
    {
     printf("Enter Green's starting points (10-200, %d recommended) :",
	     size * 6);
     gets(buffer);
     gpoints = atoi(buffer);
    }
  while ( (gpoints < 10) || (gpoints > 200) );

  do
    {
     printf("(M)ouse or (K)eyboard?\n");
     *buffer = getch();
    }
  while ( (*buffer != 'M') && (*buffer != 'm')
       && (*buffer != 'K') && (*buffer != 'k') );

  if ((*buffer == 'm') || (*buffer == 'M'))
     input = 1;
  else
     input = 0;

  if ((input == 1) && (initmouse() == 0))
    {
     input = 0;
     printf("Mouse driver not found.  Changing to keyboard input.\n");
     getch();
    };

  board game(size, rpoints, gpoints, input);

  do
    end_game = game.move();
  while (! end_game );

  saywinner(end_game);

  getch();
  closegraph();

  puts("\n\n\n");
  puts(quotes[random(nquotes)]);

  return 0;
}