Example #1
0
void plprint(const char* s)
{
#if DOS
	extern int newstyle;
	extern unsigned text_style, text_size, text_orient;
#endif
	char buf[128];

	if (text && s[strlen(s) - 1] == '\n') {
		IGNORE(strcpy(buf, s));
		s = buf;
		buf[strlen(s)-1] = '\0';
	}

	if (console && text) {
#if	DOS
		if (egagrph == 2) {
			if (newstyle) {
				settextstyle(text_style,text_orient,text_size);
				newstyle = 0;
			}
			outtext(s);
		}else{
			IGNORE(fprintf(cdev, "%s", s));
		}
#else
#if SUNCORE
		hoc_pl_sunplot(s);
#else
#if NRNOC_X11
		x11_put_text(s);
#else
#if NeXTstep
		if (graphdev == NX) 
			NeXT_put_text(s);
#else

		IGNORE(fprintf(cdev, "%s", s));
		IGNORE(fflush(cdev));
#endif
#endif
#endif
#endif

	} else if (!text) {
#if GRX
		if (egagrph) {
			hoc_outtext(s);
		}else
#endif
		{
			IGNORE(fprintf(stdout, "%s", s));
		}
	}
	if (hardplot && hpdev && text && strlen(s)) {
		hard_text_preamble();
		IGNORE(fprintf(hpdev, "%s", s));
		IGNORE(fflush(hpdev));
	}
	if (text && s == buf) {
		plt(1, xlast, ylast-20);
		plt(-2, 0.,0.);
	}
}
Example #2
0
/* shows the summary of typing */
void show_summary(int min, int sec,int acc, int err, int speed)
{
	/* min= required minute, sec= required seconds, acc= percentage of accuracy,
	   err= percentage of pressing b.space, speed= typing speed */

		char ch[5];
		int j1,m,n,i,x=180,y;
		char result[][50]= {"Time Elapsed:-    min    sec","Accuracy  :    %","Backspace :    %","Speed[cpm]:"};

	    //	draw_brief_window(200,90,380,250,1,6,0); // agerta
		draw_brief_window(170,90,410,250,1,6,0);

		settextstyle(0,0,1);
		color_text(182,94,"Result",15);
		settextstyle(2,0,5);//2,0,5    3
		setcolor(6);

		for(i=0,y=120;i<4;i++,y+=18){
			outtextxy(x,y,result[i]);
			outtextxy(x+1,y,result[i]);
		}

	      //	outtextxy(215,210,"Adjacent speed:");  */

		show_number(min,300,120,4,2,5); // min
		show_number(min,301,120,4,2,5);
		show_number(sec,355,120,4,2,5); //sec
		show_number(sec,356,120,4,2,5);
		show_number(acc,268,138,4,2,5); // accuracy
		show_number(acc,269,138,4,2,5); // accuracy
		show_number(err,268,156,4,2,5); // error
		show_number(err,269,156,4,2,5); // error
		show_number(speed,268,174,4,2,5); // speed
		show_number(speed,269,174,4,2,5); // speed

		if(!minute && !second){
			setfillstyle(1,0);
			bar(175,120,405,135);
			color_text(250,115,"TIME IS UP",6);
			color_text(251,115,"TIME IS UP",6);
		}

		setcolor(4);

		if(min ||sec)
		{
			if(acc || err || speed){
				if(acc<=35)
					outtextxy(315,138,"Beginner");

				else if(acc>35 && acc<= 60)
					outtextxy(315,138,"Intermediate");

				else if(acc>60 && acc<= 95 )
					outtextxy(315,138,"Advanced");

				else
					outtextxy(315,138,"Expert");

				if(err <=5)
					outtextxy(315,156,"Expert");

				else if(err>5 && err<=10)
					outtextxy(315,156,"Advanced");

				else if(err>10 && err<=20)
					outtextxy(315,156,"Intermediate");

				else
					outtextxy(315,156,"Beginner");

				if(speed<=100)
					outtextxy(315,174,"Beginner");

				else if( speed>100 && speed<=160)
					outtextxy(315,174,"Intermediate");

				else if( speed>160 && speed<=220)
					outtextxy(315,174,"Advanced");

				else
					outtextxy(315,174,"Expert");

			}

		}
}
Example #3
0
void lesson_practice(int lesson_no,int num,int MINUTE,int angleINCREASE)
{
/* INCREASE= will control time, MINUTE= given time limit of typing */

	int j1,ch1,x1,y1,time_up;
	int char_x, char_y,i,choice,dummy_choice,line,z;
	int rndm,store; /* 'store' is used to store chars serially in
				store array */
	prev= -1;
	time_interval=0, min=0, sec=0, eff=0, err=0, speed=0;
	pressed=0, correct= 0, wrong= 0, cpm=0, correction=0;
	minute=MINUTE, INCREASE= angleINCREASE, second=0;

	char_x = 173;
	char_y = 72;

	tutorial_window();
	run_info_window();
	hideMouse();

	if(!num)
		LETTER= 4;

	else if(!lesson_no)
		LETTER=20;

	line = 1;
	for(i=1,store=0; line<MAX ;i++,store++)
	{
		rndm = random(LETTER); // randomly seeks chars
		if(!num){
			store_chars[store]= lesson[lesson_no-1][rndm];
			print_lesson(char_x, char_y, lesson[lesson_no-1][rndm],1);
		}

		else if(!lesson_no){
			store_chars[store]= numeric[num-1][rndm];
			print_lesson(char_x, char_y, numeric[num-1][rndm],1);
		}
		char_x +=8; //for next character

		if(i%4==0)       // GIVING SPACE AFTER EVERY 4 CHARS
		{
			char_x +=8;
			store++;
			store_chars[store]=' ';
		}

		if(char_x >405)    // NEXT LINE
		{
			char_x = 173;
			char_y+= 36;
			line++;
		}
	}
	setcolor(4);
	outtextxy(542,50,"0");
	outtextxy(562,50,":");
	outtextxy(574,50,"00");
	show_number(minute,550,50,4,0,1);
	run_info(pressed,correct,wrong,correction);
	user_response(250,130,1,3);
	time(&start_time);

	settextstyle(2,0,5);
	color_text(535,76,"ESC to",3);
	color_text(536,76,"ESC to",3);
	color_text(524,92,"quit/pause",3);
	color_text(525,92,"quit/pause",3);
	char_x= 173; 	char_y= 90;  line =1;  i=0;

	dummy_choice= 'A'; //just to initialize the drawing of a key
	increase=0, angle=89;
	while(1)
	{
	      gettime (&new_time);
	      time_up= time_control();
	      if(time_up)
			return;


	      if(line<7){
			color_text(char_x,char_y+1,"_",4);
			color_text(char_x,char_y-23,"^",4);
	      }

	      if(kbhit())
	      {
			check_kb_up_down(dummy_choice,0);

			choice= getch();  // ASSIGN USER INPUT TO 'CHOICE'
			dummy_choice= choice;
			pressed++;

			check_kb_up_down(choice,1);

			if(line>6)
			{
				summary_content();
				end_lesson(min,sec,eff,err,speed);
				return;
			}
			if(choice==27 )  // ESC
			{
				pressed--;
				make_sound(2000,100);
				if(i>0)
					summary_content();

				z = continue_close(min,sec,eff,err,speed);
				if(z)
					return;
				else
					continue;
			}
			else if(choice==0) // error checking for function keys
			{
				ch1=getch();
				if(ch1==80||ch1==72||ch1==75||ch1==77)   //error checking  to avoide right,left,up
					continue;
			}

			else if(choice==9)
				continue;    //error checking for tab

			else if(choice==8)  	// BACKSPACE
			{
				if(i>0)
				{
					correction++;
					if(char_x<=173){
						setfillstyle(1,15);
						bar(char_x+233,char_y-36,char_x+243,char_y-29);
						color_text(char_x,char_y+1,"_",15);
						color_text(char_x,char_y-23,"^",15);
						char_y-=36;
						char_x+=240;

						color_text(char_x-8,char_y+1,"_",4);
						color_text(char_x-8,char_y-23,"^",4);

					}

					else{
						setfillstyle(1,15);
						bar(char_x-8, char_y, char_x,char_y+7);
						color_text(char_x,char_y+1,"_",15);
						color_text(char_x-8,char_y+1,"_",4);
						color_text(char_x,char_y-23,"^",15);
						color_text(char_x-8,char_y-23,"^",4);
					}
					--i;
					char_x-=8;
					sound(1000);
					delay(100);
					nosound();
				}
			}

			else{

				if(choice==store_chars[i]){  			//letter is ok!
					print_lesson(char_x,char_y,choice,4);
					correct++;
				}

				else if(store_chars[i] !=choice && choice==' ')
				{
					char choice1 = '-';	//when space is pressed instead of any key, print dash
					print_lesson(char_x,char_y,choice1,9);
					make_sound(500,100);
					wrong++;
				}
				else
				{
					print_lesson(char_x, char_y,choice,9);
					make_sound(500,100);
					wrong++;
				}

				color_text(char_x+8,char_y-23,"^",4);
				color_text(char_x,char_y-23,"^",15);
				color_text(char_x+8,char_y+1,"_",4);
				color_text(char_x,char_y+1,"_",15);
				char_x +=8;
				if(char_x > 405)
				{
					color_text(char_x,char_y+1,"_",15);
					color_text(char_x,char_y-23,"^",15);
					char_x = 173;
					char_y +=36;
					line++;
				}
				i++;

			}  // end of else or default typing

			run_info(pressed,correct,wrong,correction);
	      } // end of the initial 'if'
	}  // end of while
}
Example #4
0
/*displays the select mode menu */
int intro2(int n,int p)
{
 int cur,i;
 char ch;
 if(n==3)
	return 3;
 else if(n==2)
	{clrscr();
	cleardevice();
	setcolor(YELLOW);
	settextstyle(1,0,6);
	outtextxy(180,60,"CONNECT 4");
	setcolor(YELLOW);
	settextstyle(1,0,3);
	outtextxy(190,120,"SELECT A MODE");
	settextstyle(1,0,3);
	outtextxy(30,180,"  SINGLE PLAYER");
	setcolor(RED);
	setfillstyle(1,RED);
	fillellipse(20,200,20,20);
	cur=0;
	setcolor(YELLOW);
	outtextxy(30,240,"  MULTIPLE PLAYER");
	outtextxy(30,300,"  Back to main menu");
	outtextxy(10,450,"Navigate using arrow keys.");
	ch=getch();
	while (ch!=13)
		{if (ch==80) //Down Arrow
			{setcolor(BLACK);
			setfillstyle(1,BLACK);
			fillellipse(20,200+(cur*60),20,20);
			++cur;
			if (cur>2)
			   cur = 2;
			setcolor(RED);
			setfillstyle(1,RED);
			fillellipse(20,200+(cur*60),20,20);}
		else if(ch==72) //UP Arrow
			{setcolor(BLACK);
			setfillstyle(1,BLACK);
			fillellipse(20,200+(cur*60),20,20);
			--cur;
			if (cur<0)
			   cur=0;
			setcolor(RED);
			setfillstyle(1,RED);
			fillellipse(20,200+(cur*60),20,20);}
		ch=getch();
	}
	if((cur==0)||(cur==1))
		{if(p==0);
		 else
			{for (i=0;i<23;i++)
				cout<<endl;
			}
		 }

	if (cur==2)
		return(5);
	else
		return(cur+1);
	}
 else if(n==1)
	return(4);
}
Example #5
0
/*Checks for winning formations, declares the winner and ends the game */
void multiPlayer ()
{
 Player p1,p2;
 int r[6][7],c[6][7],ld[6][7],rd[6][7],i,j,res=0,n,win=0,ch,t,cp,flag=0;
 char n1[20],n2[20];
 for(i=0;i<6;i++)
	{for(j=0;j<7;j++)
	r[i][j]=c[i][j]=ld[i][j]=rd[i][j]=0;}

 setcolor(YELLOW);
 settextstyle(1,0,2);
 cout<<"Player one: ";
//outtextxy(10,340,"Player one name: ");
 gets	(p1.name);
 strcpy(n1,p1.name);
 strcat(n1," wins!");
 getch();
//outtextxy(10,370,"Player two name: ");
//cout<<"\nPlayer two name: ";
 cout<<"\nPlayer two: ";
 gets	(p2.name);
 strcpy(n2,p2.name);
 strcat(n2," wins!");

 setcolor(BLUE);
 settextstyle(1,0,4);
 while(res==0)
	{puts(p1.name);
	 n = dispBoard(r,1);
	cp=coinPos(n,r);
	if(insRow(n,1,cp,r)==1)
		{drawround(n-1,-1,ray,WHITE);
		drawround(n-1,cp,ray,RED);
		delay(DEL);
		winDisp();
		outtextxy(xc,yc,n1);
		++res;
		UpdatePStats(p1,'w');
		UpdatePStats(p2,'l');
		break;}
	if(insCol(n,1,cp,c)==1)
		{drawround(n-1,-1,ray,WHITE);
		drawround(n-1,cp,ray,RED);
		delay(DEL);
		winDisp();
		outtextxy(xc,yc,n1);
		++res;
		UpdatePStats(p1,'w');
		UpdatePStats(p2,'l');
		break;}
	if(insLDia(n,1,cp,ld)==1)
		{drawround(n-1,-1,ray,WHITE);
		drawround(n-1,cp,ray,RED);
		delay(DEL);
		winDisp();
		outtextxy(xc,yc,n1);
		++res;
		UpdatePStats(p1,'w');
		UpdatePStats(p2,'l');
		break;}
	if(insRDia(n,1,cp,rd)==1)
		{drawround(n-1,-1,ray,WHITE);
		drawround(n-1,cp,ray,RED);
		delay(DEL);
		winDisp();
		outtextxy(xc,yc,n1);
		++res;
		UpdatePStats(p1,'w');
		UpdatePStats(p2,'l');
		break;}
	clrscr();
	puts(p2.name);
	n=dispBoard(r,2);
	cp=coinPos(n,r);
	if (cp<0)
		{cout<<"\n\n\Please put coin in proper position";
		++res;
		break;}
	if(insRow(n,-1,cp,r)==-1)
		{drawround(n-1,-1,ray,WHITE);
		drawround(n-1,cp,ray,GREEN);
		delay(DEL);
		winDisp();
		outtextxy(xc,yc,n2);
		++res;
		UpdatePStats(p2,'w');
		UpdatePStats(p1,'l');
		break;}
	if(insCol(n,-1,cp,c)==-1)
		{
		drawround(n-1,-1,ray,WHITE);
		drawround(n-1,cp,ray,GREEN);
		delay(DEL);
		winDisp();
		outtextxy(xc,yc,n2);
		++res;
		UpdatePStats(p2,'w');
		UpdatePStats(p1,'l');
		break;}
	if(insLDia(n,-1,cp,ld) ==-1)
		{
		drawround(n-1,-1,ray,WHITE);
		drawround(n-1,cp,ray,GREEN);
		delay(DEL);
		winDisp();
		outtextxy(xc,yc,n2);
		++res;
		UpdatePStats(p2,'w');
		UpdatePStats(p1,'l');
		break;}
	if(insRDia(n,-1,cp,rd)==-1)
		{drawround(n-1,-1,ray,WHITE);
		drawround(n-1,cp,ray,GREEN);
		delay(DEL);
		winDisp();
		outtextxy(xc,yc,n2);
		++res;
		UpdatePStats(p2,'w');
		UpdatePStats(p1,'l');
		break;}
	clrscr();
	}
 getch();
 winDisp();
 outtextxy(xc,yc-10,"Thanks for ");
 outtextxy(xc,yc+10,"playing!");
}
Example #6
0
int scoring(int &score,int pos[200][8])
{ char pop[5],count=0,p;
     ascii(score,pop,score);
     settextstyle(TRIPLEX_FONT,HORIZ_DIR,4);
  if(score<0)
  {score=0;
  }

    setfillstyle(1,4);
    bar(420,260,540,385);
    outtextxy(435,285,"SCORE" );

if(score==0)
{outtextxy(475,330,"0");
}
else if(score>0&&score<10)
{ outtextxy(475,330,pop );
}
else if(score>=10&&score<100)
{ outtextxy(465,330,pop );
}
else if(score>99&&score<1000)
{ outtextxy(450,330,pop);
}
else if(score>999)
{ outtextxy(440,330,pop);
}



  for(p=0;p<100;p++)
  {
      if(pos[p][0]==300&&pos[p][1]==150)
      {count++;
      }
      if(count>0)
      {	 cleardevice();
	 setbkcolor(14);
	 setcolor(1);
	 settextstyle(TRIPLEX_FONT,HORIZ_DIR,4);

	 outtextxy(220,110,"GAME OVER !!");
	 setfillstyle(1,4);
	 bar(210,170,430,250);
	 setcolor(15);
	 outtextxy(230,200,"SCORE : " );
	 ascii(score,pop,score);

	 if(score==0)
	   {outtextxy(475,200,"0");
	    }
	 else if(score>0&&score<10)
	   { outtextxy(370,200,pop );
	   }
	 else if(score>=10&&score<100)
	   { outtextxy(365,200,pop );
	   }
	 else if(score>99&&score<1000)
	   { outtextxy(350,200,pop);
	    }
	 else if(score>999)
	   { outtextxy(345,200,pop);
	   }

	 setcolor(2);
	 settextstyle(TRIPLEX_FONT,HORIZ_DIR,3);
	 outtextxy(120,250,"We hope that you enjoyed our game" );
	 outtextxy(120,290,"to the fullest. Please give your " );
	 outtextxy(120,330,"prescious feedback on our website " );
	 setcolor(12);
	 outtextxy(200,370,"www.catexpo_games.com " );
	 getch();
	 closegraph();
	 exit(0);
	}
  }
   settextstyle(TRIPLEX_FONT,HORIZ_DIR,1);
return 0;
}
Example #7
0
int main(void)
{

   int gdriver = DETECT, gmode, errorcode;


   initgraph(&gdriver, &gmode, "");


   errorcode = graphresult();


   if (errorcode != grOk)
   {
      printf("Graphics error: %s\n", grapherrormsg(errorcode));
      printf("Press any key to halt:");
      getch();

      exit(1);
   }

   int choice;



   while(!kbhit())
   {
   setcolor(WHITE);
   setbkcolor(2);


   setcolor(YELLOW);
   circle(300,100,30);
   setfillstyle(SOLID_FILL,YELLOW);
   floodfill(300,100,YELLOW);

   setcolor(BLACK);
   setfillstyle(SOLID_FILL,BLACK);
   fillellipse(292,88,2,6);
   fillellipse(308,88,2,6);

   ellipse(300,103,185,355,20,8);
   ellipse(300,103,185,355,20,9);
   ellipse(300,103,185,355,20,10);

   setcolor(WHITE);
   settextstyle(0, HORIZ_DIR,6);
   outtextxy(180,200,"HIT IT");
   settextstyle(DEFAULT_FONT, HORIZ_DIR,2);
   outtextxy(130,400,"(Press any key to start)");
   settextstyle(DEFAULT_FONT, HORIZ_DIR, 1);
   rectangle(0,0,639,479);
   }
   sound(500);
   delay(100);
   nosound();
   clearviewport();
   setcolor(WHITE);

   getch();

   do
   {
   settextstyle(DEFAULT_FONT, HORIZ_DIR, 5);
   outtextxy(200,50,"HIT IT");
   settextstyle(DEFAULT_FONT, HORIZ_DIR, 2);
   outtextxy(200,150,"1.NEW GAME");
   outtextxy(200,200,"2.INSTRUCTIONS");
   outtextxy(200,250,"3.CREDITS");
   outtextxy(200,300,"4.EXIT");
   rectangle(0,0,639,479);
   settextstyle(DEFAULT_FONT, HORIZ_DIR, 1);
   outtextxy(175,372,"PLEASE ENTER YOUR CHOICE(1-4):");
   gotoxy(53,24);


   choice = _bios_keybrd(_KEYBRD_READ);

   switch(choice)
   {
   case 561:sound(500);
	   delay(100);
	   nosound();
	   clearviewport();

	   for(int i=1,r=10;;i++,r+5)
	   {
	   game(i);

	   if(score>=r)
	   {
	   setcolor(RED);
	   setfillstyle(SOLID_FILL,BROWN);
	   bar(130,200,390,300);
	   rectangle(130,200,390,300);
	   settextstyle(DEFAULT_FONT, HORIZ_DIR, 2);
	   setcolor(WHITE);
	   outtextxy(145,240,"CONGRATULATIONS");
	   delay(2000);
	   clearviewport();
	   setcolor(RED);
	   setfillstyle(SOLID_FILL,BROWN);
	   bar(100,200,500,300);
	   rectangle(100,200,500,300);
	   settextstyle(DEFAULT_FONT, HORIZ_DIR, 2);
	   setcolor(WHITE);
	   outtextxy(110,240,"GET READY FOR NEXT LEVEL");
	   delay(2000);
	   clearviewport();
	   score=0;
	   }


	   else
	   {
	   setcolor(RED);
	   setfillstyle(SOLID_FILL,BROWN);
	   bar(130,200,390,300);
	   rectangle(130,200,390,300);
	   settextstyle(DEFAULT_FONT, HORIZ_DIR, 2);
	   setcolor(WHITE);
	   outtextxy(190,240,"TRY AGAIN");
	   delay(2000);
	   score=0;
	   clearviewport();
	   break;
	   }
	   }
	   break;


   case 818: sound(500);
	     delay(100);
	     nosound();
	     clearviewport();
	     settextstyle(DEFAULT_FONT, HORIZ_DIR, 4);
	     outtextxy(119,50,"INSTRUCTIONS");
	     settextstyle(DEFAULT_FONT, HORIZ_DIR, 2);
	     outtextxy(200,200,"HIT THE BUTTON");
	     outtextxy(200,250,"CORRESPONDING");
	     outtextxy(200,300,"TO THE BOX");
	     outtextxy(200,350,"NUMBERED FROM");
	     outtextxy(200,400,"1 TO 9.");
	     rectangle(0,0,639,479);
	     getch();
	     clearviewport();
	     break;

   case 1075:sound(500);
	    delay(100);
	    nosound();
	    clearviewport();
	    for(int j=0;j<4;j++)
	    {
	    clearviewport();
	    rectangle(0,0,639,479);
	    settextstyle(DEFAULT_FONT, HORIZ_DIR, 1+j);
	    outtextxy(260-50*j,480-150*j,"Pawneet Singh");
	    outtextxy(260-50*j,580-150*j," Ajay Dahiya");
	    outtextxy(260-50*j,680-150*j,"Rahul Bansal");
	    outtextxy(260-50*j,780-150*j," Keshav Goel");
	    delay(1000);
	    }
	    delay(2000);;
	    clearviewport();
	    break;

   case 1332:sound(500);
	     delay(100);
	     nosound();
	     exit(0);

   default: clearviewport();
	    break;

   }
   }while(choice!=4);

   getch();
   closegraph();
   return 0;
}
Example #8
0
void main()
{
 int gdriver = DETECT, gmode;
 initgraph(&gdriver, &gmode, "\\tc\\bgi");
 cleardevice();
// char str[1]; str[1]='\0';
 file.open("Info.TXT",ios::in|ios::binary);
 if(!file)
  cout<<"File couldnt be opened";
 x=20; y=getmaxy()-70;
 settextstyle(2,0,5);
 setvalues();
 board();
 coins();
 getch();
 typeon();
 getch();
 cleardevice();
 x=20; y=200;
 pic("ch pic");
 typeon();
 y+=20;
 typeon();
 getch();
 cleardevice();
 pic("ch pic2");
 x=20; y=200;
 typeon();
 getch();
 cleardevice();
 king(getmaxx()/2-30,30,1);
 x=20; y=100;
 typeon();
 getch();
 cleardevice();
 rook(getmaxx()/2-30,30,1);
 x=20; y=100;
 typeon();
 getch();
 cleardevice();
 bishop(getmaxx()/2-30,30,1);
 x=20; y=100;
 typeon();
 getch();
 cleardevice();
 queen(getmaxx()/2-30,30,1);
 x=20; y=100;
 typeon();
 getch();
 cleardevice();
 knight(getmaxx()/2-30,30,1);
 x=20; y=100;
 typeon();
 getch();
 cleardevice();
 pawn(getmaxx()/2-30,30,1);
 x=20; y=100;
 typeon();
 getch();
 cleardevice();
 pic("ch pic3");
 x=20; y=50;
 typeon();
 getch();
 file.close();
 closegraph();
}
Example #9
0
	//function which centrally controls the execution of game
	void gameHandler(){
		settextstyle(0,0,6);
		outtextxy(180,200,"DX-Ball");
		getch();
		clearviewport();
		brickLen=25,brickBred=15;
		for(int i=0;i<20;i++)
			for(int j=0;j<8;j++)
				isBrick[i][j]=1;
		drawBricks();
		b.cx=20;
		b.cy=240;
		b.xIncre=1;
		b.yIncre=1;
		b.radius=5;
		br.size=80;
		br.movement=10;
		score=0;
		livesRemain[0]=' ';
		livesRemain[1]=' ';
		strcat(livesRemain,"live(s) remaining.");
		b.lives=3;
		line(500,0,500,480);
		settextstyle(0,0,2);
		outtextxy(535,200,"Score:");
		settextstyle(0,0,2);
		setScoreString();
		outtextxy(535,230,scoreString);
		outtextxy(535,320,"Lives:");
		setLivesString();
		outtextxy(565,350,livesString);
		b.ulimit=0;
		b.llimit=0;
		b.rlimit=500;
		br.llimit=0;
		br.rlimit=500;
		br.rePositionBar(0);
		br.drawBar();
		int ch='a';
		while(1){
			while(!kbhit()){
			delay(4);
			b.removePreviousBall();
			changeScore();
			initializeVariables();
			whetherBallTouchesBrick();
			b.drawBall();
			br.removePreviousBar();
			br.drawBar();
			line(500,0,500,480);
			}
			ch=getch();
			if(ch=='a'){
				br.removePreviousBar();
				br.rePositionBar('a');
				br.drawBar();
			}
			if(ch=='s'){
				br.removePreviousBar();
				br.rePositionBar('s');
				br.drawBar();
			}
			if(ch=='p')
				ch=getch();
			if(ch=='q'){
				displayAbout();
				getch();
				exit(0);
			}
		}
	}
Example #10
0
main()
{
int gd=DETECT,gm,maxx,maxy,x,y,xp,yp,button,ch=0,i=1,flag=0;
initgraph(&gd,&gm,"");
maxx=getmaxx();
maxy=getmaxy();
setbkcolor(BLACK);
setlinestyle(SOLID_LINE,1,3);
rectangle(0,56,maxx,maxy);
setviewport(1,1,maxx-1,maxy-1,1);
/*gotoxy(10,1);
printf("1=CIRCLE");
gotoxy(20,1);
printf("2=LINE");*/
setcolor(LIGHTCYAN);
settextstyle(5,0,3);
outtextxy(200,0,"CATCH ME IF YOU CAN");

if(initmouse()==0)
{
 closegraph();
 restorecrtmode();
 printf("mouse driver not loaded");
 getch();
 exit(1);
}
restrictmouseptr(1,57,maxx-1,maxy-1);
getmousepos(&button,&x,&y);
xp=x;
yp=y;
showmouseptr();
while(!kbhit())
{
setcolor(i);
setlinestyle(SOLID_LINE,0,2);
xp=x;
yp=y;
getmousepos(&button,&x,&y);
while((button & 1)==1)
{
setcolor(RED);
circle(xp,yp,x-xp);
delay(20);
setcolor(BLACK);
circle(xp,yp,x-xp);
getmousepos(&button,&x,&y);
flag=1;
}
if(flag==1)
{
setcolor(RED);
circle(xp,yp,x-xp);
flag=0;
}
if(xp!=x && yp!=y)
{
setcolor(i);
settextstyle(5,0,1);
outtextxy(380,440,"designed by:Soumen Mukherjee");
i++;
if(i==15)
i=1;
}
}
ch=getch();
if(ch==13)
{
closegraph();
restorecrtmode();
exit(1);
}
if(ch==1)
cleardevice();
main();
}
Example #11
0
//***********************
 void barra_titulo(int x1,int y1, int x2,char N []){
 setfillstyle(1,1);bar(x1,y1,x2,y1+18);
 setcolor(15);settextstyle(0,0,0);outtextxy(x1+26,y1+5,N);
 }
Example #12
0
void ScreenSaver(void)
{
  randomize();
  int gDriver=DETECT, gMode,errorcode;
  initgraph(&gDriver,&gMode,"");
  errorcode=graphresult();
  if(errorcode!=grOk)
  {
    printf("ERROR: %s\nPress any key to EXIT\n",grapherrormsg(errorcode));
    getch();
    exit(1);
  }
//******START***********
  int x=1,y=1,i=0,j=0,intsymbol,bkColor=0,Color=2;
  char *symbol;
  setbkcolor(bkColor);
  setcolor(Color);
  unsigned int A_Size=imagesize(553,390,625,467);
  void *bigTemp=malloc(A_Size);

  memset(bigTemp,0,sizeof(bigTemp));

  getimage(25,10,85,90,bigTemp);
  setcolor(15);
  Rect(1,1,100);
  T(50,15,14);
  setcolor(15);
  Line(50,101,266,"v");
  Rect(1,370,100);
  E(50,390,14);
  setcolor(15);
  Line(100,420,430,"h");
  Rect(530,370,100);
  A(580,390,2);
  setcolor(15);
  Line2(101,50,580,369);
  Rect(530,1,100);
  M(580,30,14);
  setcolor(15);
  Paraleli(100,100,100,370,"h");
  Paraleli(100,100,530,100,"v");
  settextstyle(0,0,2);
  unsigned int T_Size=imagesize(25,10,85,90);
  unsigned int E_Size=imagesize(25,390,85,465);
  unsigned int M_Size=imagesize(545,10,625,90);
  unsigned int temp_Size=imagesize(220,250,281,252);
  void *T_Array=malloc(T_Size);
  void *E_Array=malloc(E_Size);
  void *A_Array=malloc(A_Size);
  void *M_Array=malloc(M_Size);
  void *temp_Array=malloc(temp_Size);
  void *temp_A=malloc(A_Size);

  memset(T_Array,0,sizeof(T_Array));
  memset(E_Array,0,sizeof(E_Array));
  memset(A_Array,0,sizeof(A_Array));
  memset(M_Array,0,sizeof(M_Array));
  memset(temp_Array,0,sizeof(temp_Array));
  memset(temp_A,0,sizeof(temp_A));

  getimage(25,10,85,90,T_Array);
  getimage(25,390,85,465,E_Array);
  getimage(553,390,625,467,A_Array);
  getimage(545,10,625,90,M_Array);
  getimage(220,250,281,252,temp_Array);
  ///*****WORK WITH BITMAPS************
  int i_E,j_E,i_A,j_A,i_M,j_M;
  putimage(380,120,M_Array,COPY_PUT);
  putimage(380,260,A_Array,COPY_PUT);
  for(i=150,j=110,i_E=110,j_E=290,i_A=380,j_A=260,i_M=400,j_M=120;(j<220)&&(i_A>280)&&(i_E<220);j++,i_E++,i_A--)
  {
    putimage(i,j,T_Array,COPY_PUT);
    putimage(i_E,j_E,E_Array,COPY_PUT);
    delay(LETTERSPEED);
      while((j_E>253)&&(i_M>330))
      {
	putimage(i_E,j_E,E_Array,COPY_PUT);
	j_E--;
	putimage(i_M,j_M,M_Array,COPY_PUT);
	i_M--;
      }
    putimage(i_A,j_A,A_Array,COPY_PUT);
  }
  while(j_M<240)
  {
    putimage(i_M,j_M,M_Array,COPY_PUT);
    j_M++;
    if((j_M>200)&&(j_M<220))
    i_M--;
  }
  for(;j_E>120;j_A--,j_E--,j_M--)
  {

    putimage(i_E,j_E,E_Array,COPY_PUT);
    putimage(i_A+random(2),j_A,A_Array,COPY_PUT);
    putimage(i_M,j_M,M_Array,COPY_PUT);
  }
  setcolor(14);
  for(;j_E<215;j_E++,j_M++)
  {
    putimage(i_E,j_E-1,temp_Array,COPY_PUT);
    putimage(i_E,j_E,E_Array,COPY_PUT);
    putimage(i_M+5,j_M,M_Array,COPY_PUT);
    delay(random(LETTERSPEED*2));
  }
  for(;j_A<270;j_A++)
  {
    putimage(i_A,j_A+70,temp_Array,COPY_PUT);
    putimage(i_A,j_A,A_Array,COPY_PUT);
    putimage(i_A,j_A-1,temp_Array,COPY_PUT);
  }
  for(i=0;i<15;i++)
  {
    putimage(i_A,j_A+=5,temp_Array,COPY_PUT);
  }
  getimage(280,270,350,350,temp_A);
  putimage(280,270,bigTemp,COPY_PUT);
  putimage(280,250,bigTemp,COPY_PUT);
  putimage(290,245,bigTemp,COPY_PUT);
  putimage(280,210,temp_A,COPY_PUT);
  x=(getmaxx()/2)-70,y=getmaxy()-50;
  //***************************
  outtextxy(x,y,"Made by");
  outtextxy(x-70,y+20,"Serhiy Radkivskiy");
  setcolor(14);
//*****CLOSE************
 getch();
// free(symbol);
  memset(T_Array,0,sizeof(T_Array));
  memset(E_Array,0,sizeof(E_Array));
  memset(A_Array,0,sizeof(A_Array));
  memset(M_Array,0,sizeof(M_Array));
  memset(temp_Array,0,sizeof(temp_Array));
  memset(temp_A,0,sizeof(temp_A));

 free(T_Array);
 free(E_Array);
 free(A_Array);
 free(M_Array);
 free(temp_Array);
 free(bigTemp);
 free(temp_A);
 cleardevice();
 closegraph();
}
Example #13
0
void main(){
int monitor=VGA, modo=VGAHI;
int num[6], secuencia[3],correcto=-1;
int c1,c2,c3,b,x,y,fig=-1,n_res=0,n_ok=0,nv_imagen=-1,n_cuadro=-1,op_menu=0,op_menu1=0,op_menu3=0;
char *animal[9]={"imagen\\bear.bmp","imagen\\fish.bmp","imagen\\frog.bmp","imagen\\lamb.bmp","imagen\\tiger.bmp","imagen\\chipmunk.bmp","imagen\\donkey.bmp","imagen\\mouse.bmp","imagen\\rabbit.bmp"};
unsigned x_pos,y_pos,num_boton;
char r='n',s='n';

initgraph(&monitor,&modo,"\BGI");
cleardevice();
iniciarRaton();
menuprincipal();
mostrarRaton();
 do{
	x_pos=posicionHorizontal();
	y_pos=posicionVertical();
	num_boton=botonPresionado();

	if(num_boton==1){ //Revisa en el area de que boton, se hizo click
				if(x_pos>500 && x_pos<550 && y_pos>170       && y_pos<190      ) op_menu=1;
	 else if(x_pos>500 && x_pos<550 && y_pos>(170+40)  && y_pos<(190+40) ) op_menu=2;
	 else if(x_pos>500 && x_pos<550 && y_pos>(170+80)  && y_pos<(190+80) ) op_menu=3;
	 else if(x_pos>500 && x_pos<550 && y_pos>(170+120) && y_pos<(190+120)) op_menu=4;
	 else if(x_pos>500 && x_pos<550 && y_pos>(170+160) && y_pos<(190+160)) op_menu=5;
	}
	switch(op_menu){

		case 1:{
		do{
		 s='n';
		 cleardevice();
		 ocultarRaton();
		 busqueda_animales();
		 mostrarRaton();

		 //Llenado de num[] con numeros sin repetir de las imagenes a utilizar
		 randomize();
		 for(c1=0;c1<6;c1++){
			num[c1]=rand()%9;
			c2=0;
			while(c2<c1){ //revisa desde num[0] hasta la posicion que se acaba de escoger
			 if (num[c1]==num[c2])
				 c2=c1--;
			 c2++;
			}
		 }

		 //despliegue de las 6 imagenes seleccionadas
		 ocultarRaton();
		 c3=0;
		 for(c1=17;c1<=249;c1+=116)
			for(c2=122;c2<=240;c2+=118)
			 imagen(c1,c2,animal[num[c3++]]);
			 mostrarRaton();

		 do{
			x_pos=posicionHorizontal();
			y_pos=posicionVertical();
			num_boton=botonPresionado();

			if(num_boton==1){ //Revisa en el area de que dibujo, se hizo click
						if(x_pos> 17 && x_pos<133 && y_pos>122 && y_pos<238) op_menu1=1;
			 else if(x_pos> 17 && x_pos<133 && y_pos>240 && y_pos<356) op_menu1=2;
			 else if(x_pos>133 && x_pos<249 && y_pos>122 && y_pos<238) op_menu1=3;
			 else if(x_pos>133 && x_pos<249 && y_pos>240 && y_pos<356) op_menu1=4;
			 else if(x_pos>249 && x_pos<365 && y_pos>122 && y_pos<238) op_menu1=5;
			 else if(x_pos>249 && x_pos<365 && y_pos>240 && y_pos<356) op_menu1=6;
			}

			//impresion de imagen clickada
			if(1<=op_menu1 && op_menu1<=6){
			 ocultarRaton();
			 setfillstyle(1,DARKGRAY);
			 bar(getmaxx()*9/16+20,getmaxy()/4,getmaxx()-30,getmaxy()*3/4);
			 rectangle(378,getmaxy()/4-1,610,getmaxy()*3/4+1);
			 imagen(436,180,animal[num[op_menu1-1]]);
			 rectangle(436,180,550,295);    n_res=1;  n_cuadro=op_menu1; fig=num[op_menu1-1];
			 settextstyle(TRIPLEX_FONT,HORIZ_DIR,3);
			 setcolor(WHITE);
			 outtextxy(383,120,"ยจCual es el nombre");
			 outtextxy(405,140,"de este animal?");
			 outtextxy(270,440,"opciones");
			 n_ok=0;
			 mostrarRaton();
			}

			// Revision de area textual clickada e impresion de nombre clickado + OK
			if(num_boton==1){
			 if(n_ok==1){
				setfillstyle(SOLID_FILL,RED);  bar(392,320,518,345);
				rectangle(392,320,518,345);  	setcolor(WHITE);
			 }

			 if(x_pos>61 && x_pos<164 && y_pos>382 && y_pos<408){
				outtextxy(430,315,"Bear");   	nv_imagen=1;
				n_ok=1;
			 }
			 else if(x_pos>164 && x_pos<267 && y_pos>382 && y_pos<408){
				outtextxy(430,315,"Fish");   	nv_imagen=2;
				n_ok=1;
			 }
			 else if(x_pos>267 && x_pos<373 && y_pos>382 && y_pos<408){
				outtextxy(430,315,"Frog");   	nv_imagen=3;
				n_ok=1;
			 }
			 else if(x_pos>373 && x_pos<479 && y_pos>382 && y_pos<408){
				outtextxy(425,315,"Lamb");    nv_imagen=4;
				n_ok=1;
			 }
			 else if(x_pos>479 && x_pos<579 && y_pos>382 && y_pos<408){
				outtextxy(430,315,"Tiger");   nv_imagen=5;
				n_ok=1;
			 }
			 else if(x_pos>61  && x_pos<190 && y_pos>410 && y_pos<438){
				outtextxy(397,315,"Chipmunk");  nv_imagen=6;
				n_ok=1;
			 }
			 else if(x_pos>190 && x_pos<319 && y_pos>410 && y_pos<438){
				outtextxy(420,315,"Donkey");	 nv_imagen=7;
				n_ok=1;
			 }
			 else if(x_pos>319 && x_pos<448 && y_pos>410 && y_pos<438){
				outtextxy(422,315,"Mouse");    nv_imagen=8;
				n_ok=1;
			 }
			 else if(x_pos>448 && x_pos<578 && y_pos>410 && y_pos<438){
				outtextxy(422,315,"Rabbit");   nv_imagen=9;
				n_ok=1;
			 }
			 if(n_ok==1){
				setcolor(BLUE);
				setfillstyle(SOLID_FILL,WHITE);
				bar(545,320,590,345);
				rectangle(545,320,590,345);
				outtextxy(550,315,"Ok");
			 }

			 //salida con Ok
			 if(n_ok==1 && n_cuadro>0 && x_pos>545 && x_pos<590 && y_pos>320 && y_pos<345)
				s='s';
			}

			mostrarRaton();
			op_menu1=0;//para que no vuelva a imprimir la imagen seleccionada
			n_res=0;
		 }while(s!='s');

		 //mensaje
		 ocultarRaton();
		 cleardevice();
		 setbkcolor(BLACK);
		 if((nv_imagen-1)==fig)
			imagen(0,0,"imagen\\bien.bmp");
		 else //if((nv_imagen-1)!=fig)
			imagen(0,0,"imagen\\suerte.bmp");

								 //desea continuar?
		 outtextxy(100,280,"ยจ Deseas continuar ?");

		 settextstyle(TRIPLEX_FONT,HORIZ_DIR,1); setfillstyle(SOLID_FILL,WHITE);

		 bar(getmaxx()/4,getmaxy()*3/4-30,getmaxx()/4+40,getmaxy()*3/4-10);
		 rectangle(getmaxx()/4,getmaxy()*3/4-30,getmaxx()/4+40,getmaxy()*3/4-10);
		 outtextxy(getmaxx()/4+10,getmaxy()*3/4-33,"Si");

		 bar(getmaxx()/4+60,getmaxy()*3/4-30,getmaxx()/4+100,getmaxy()*3/4-10);
		 rectangle(getmaxx()/4+60,getmaxy()*3/4-30,getmaxx()/4+100,getmaxy()*3/4-10);
		 outtextxy(getmaxx()/4+70,getmaxy()*3/4-33,"No");

		 // Ver si presiono SI o NO  para continuar
		 do{
			 x_pos=posicionHorizontal();
			 y_pos=posicionVertical();
			 num_boton=botonPresionado();
			 mostrarRaton();

			 if(num_boton==1){
						 if(getmaxx()/4    < x_pos && x_pos < getmaxx()/4+ 40 && getmaxy()*3/4-30 < y_pos && y_pos < getmaxy()*3/4-10)
							n_res=1;
				else if(getmaxx()/4+60 < x_pos && x_pos < getmaxx()/4+100 && getmaxy()*3/4-30 < y_pos && y_pos < getmaxy()*3/4-10)
							n_res=2;
			 }
			}while(n_res!=1 && n_res!=2);

		}while(n_res==1);

		 n_cuadro=-1;
		 nv_imagen=-1;
		 n_res=0;
		 ocultarRaton();
		 cleardevice();
		 menuprincipal();
		}break;

		case 2:{
		 do{
			op_menu=0;
			n_res=0;
			ocultarRaton();
			cleardevice();
			secuencias_logicas();
			figuras(secuencia); //tira una secuencia
			delay(1000);
			cleardevice();
			ocultarRaton();
			secuencias_logicas();
			setfillstyle(1,YELLOW);
			setcolor(RED);
					 bar(30  ,getmaxy()/4-6,getmaxx()/2+20,getmaxy()*3/4+19);
			rectangle(30-1,getmaxy()/4-7,getmaxx()/2+20,getmaxy()*3/4+20);

			correcto=opciones(secuencia); //tira opciones y retorna la fila de la secuencia correcta

			//Seleccion de opciones
			do{
			 x_pos=posicionHorizontal();
			 y_pos=posicionVertical();
			 num_boton=botonPresionado();

			 mostrarRaton();

			 if(num_boton==1){ //Revisa en el area de que opcion, se hizo click
						 if(x_pos> 95 && x_pos<315 && y_pos>     113 && y_pos<     195) op_menu=1;
				else if(x_pos> 95 && x_pos<315 && y_pos>  90+113 && y_pos<  90+195) op_menu=2;
				else if(x_pos> 95 && x_pos<315 && y_pos>2*90+113 && y_pos<2*90+195) op_menu=3;
			 }
			}while(op_menu<1);


			//mensaje
			ocultarRaton();
			cleardevice();
			setbkcolor(BLACK);
			if(op_menu-1==correcto)
				imagen(0,0,"imagen\\bien.bmp");
			else
				imagen(0,0,"imagen\\suerte.bmp");

			//desea continuar?
			outtextxy(100,280,"ยจ Deseas continuar ?");

			settextstyle(TRIPLEX_FONT,HORIZ_DIR,1); setfillstyle(SOLID_FILL,WHITE);

			bar(getmaxx()/4,getmaxy()*3/4-30,getmaxx()/4+40,getmaxy()*3/4-10);
			rectangle(getmaxx()/4,getmaxy()*3/4-30,getmaxx()/4+40,getmaxy()*3/4-10);
			outtextxy(getmaxx()/4+10,getmaxy()*3/4-33,"Si");

			bar(getmaxx()/4+60,getmaxy()*3/4-30,getmaxx()/4+100,getmaxy()*3/4-10);
			rectangle(getmaxx()/4+60,getmaxy()*3/4-30,getmaxx()/4+100,getmaxy()*3/4-10);
			outtextxy(getmaxx()/4+70,getmaxy()*3/4-33,"No");


			// Ver si presiono SI o NO  para continuar
			do{
			 x_pos=posicionHorizontal();
			 y_pos=posicionVertical();
			 num_boton=botonPresionado();
			 mostrarRaton();

			 if(num_boton==1){
						 if(getmaxx()/4    < x_pos && x_pos < getmaxx()/4+ 40 && getmaxy()*3/4-30 < y_pos && y_pos < getmaxy()*3/4-10)
							n_res=1;
				else if(getmaxx()/4+60 < x_pos && x_pos < getmaxx()/4+100 && getmaxy()*3/4-30 < y_pos && y_pos < getmaxy()*3/4-10)
							n_res=2;
			 }
			}while(n_res!=1 && n_res!=2);

			op_menu=-1;

		 }while(n_res==1);

		 n_res=0;
		 ocultarRaton();
		 cleardevice();
		 menuprincipal();
		}break;

		case 3:{


		cleardevice();
		 ocultarRaton();
		 ordenar_cosas();
		 mostrarRaton();


			do{
				x_pos=posicionHorizontal();
				y_pos=posicionVertical();
				num_boton=botonPresionado();

					if(num_boton==1 && x_pos>(getmaxx()/16+3)      && x_pos<(getmaxx()*7/16-3)     && y_pos>(getmaxy()*3/8+3)     && y_pos<(getmaxy()/2-3)) op_menu3=1;
					if(num_boton==1 && x_pos>(getmaxx()*9/16+3-20) && x_pos<(getmaxx()*15/16-3-20) && y_pos>(getmaxy()*3/8+3)     && y_pos<(getmaxy()/2-3)) op_menu3=2;
					if(num_boton==1 && x_pos>(getmaxx()/16+3)      && x_pos<(getmaxx()*7/16-3)     && y_pos>(getmaxy()*3/8+80+3)  && y_pos<(getmaxy()/2+80-3)) op_menu3=3;
					if(num_boton==1 && x_pos>(getmaxx()*9/16+3-20) && x_pos<(getmaxx()*15/16-3-20) && y_pos>(getmaxy()*3/8+80+3)  && y_pos<(getmaxy()/2+80-3)) op_menu3=4;
					if(num_boton==1 && x_pos>(getmaxx()/16+3)      &&	x_pos<(getmaxx()*7/16-3)     && y_pos>(getmaxy()*3/8+160+3) && y_pos<(getmaxy()/2+160-3)) op_menu3=5;
					if(num_boton==1 && x_pos>(getmaxx()*9/16+3-20) && x_pos<(getmaxx()*15/16-3-20) && y_pos>(getmaxy()*3/8+160+3) && y_pos<(getmaxy()/2+160-3)) op_menu3=6;

					 switch(op_menu3){
						case 1:{
						}break;

						case 2:{
						}break;

						case 3:{
						}break;

						case 4:{
						}break;

						case 5:{
						}break;

						case 6:{
						 s='s';
						}break;

					 }

				 mostrarRaton();
				 op_menu3=0;

				 }while(s!='s');

		 ocultarRaton();
		 cleardevice();
		 menuprincipal();
		}break;

		case 4:{}break;

		case 5:{r='s';
		}break;

	}
	//Esto solo es para imicializar nuevamente todo
	s='g';


	mostrarRaton();
	op_menu=0;//Esto debe ir siempre, sino se me lupea en la misma opcion

 }while(r!='s');

 closegraph();
}
Example #14
0
void main()
{
 int gdriver = DETECT, gmode;
 initgraph(&gdriver, &gmode, "\\tc\\bgi");
 cleardevice();
 char name[30]={"ch1"};
 king(name);
 hand3(375,215,92,30);
 int Mstatus = initmouse();
 int button,m,n,slot;
 int z=0;

 settextstyle(2,0,4);
 outtextxy(230,130,"LOADING");
/* outtextxy(220,165,"Slot 1");
// rectangle(215,164,300,177);
// rectangle(215,179,300,192);
// rectangle(215,194,300,207);
 rectangle(215,209,300,222);
 rectangle(215,224,300,237);
 rectangle(215,239,300,252);
 rectangle(215,254,300,267);
 rectangle(215,269,300,282);
 rectangle(215,284,300,297);
 outtextxy(220,180,"Slot 2");
 outtextxy(220,195,"Slot 3");
 outtextxy(220,210,"Slot 4");
 outtextxy(220,225,"Slot 5");
 outtextxy(220,240,"Slot 6");
 outtextxy(220,255,"Slot 7");
 outtextxy(220,270,"Slot 8");
 outtextxy(220,285,"Slot 9");
 outtextxy(220,300,"Slot 10");
  */
 if(Mstatus == 0 )
  outtextxy(50,50, "Mouse Support Not Available");
// changecursor(cursor);
 while(!kbhit())
{ showmouseptr();
  getmousepos(&button,&m,&n);
  if(m>245 && m<325 && n>320 && n<332)
  { setcolor(RED);
    outtextxy(250,320,"BACK"); }
  else
  { setcolor(WHITE);
    outtextxy(250,320,"BACK");
  if(m>215 && m<300 && n>164 && n<177)
  { setcolor(RED);
    outtextxy(220,165,"Slot 1"); }
  else
  { setcolor(WHITE);
    outtextxy(220,165,"Slot 1");
  if(m>215 && m<300 && n>179 && n<192)
  { setcolor(RED);
    outtextxy(220,180,"Slot 2"); }
  else
  { setcolor(WHITE);
    outtextxy(220,180,"Slot 2");
  if(m>215 && m<300 && n>194 && n<207)
  { setcolor(RED);
    outtextxy(220,195,"Slot 3"); }
  else
  { setcolor(WHITE);
    outtextxy(220,195,"Slot 3");
  if(m>215 && m<300 && n>209 && n<222)
  { setcolor(RED);
    outtextxy(220,210,"Slot 4"); }
  else
  { setcolor(WHITE);
    outtextxy(220,210,"Slot 4");

  if(m>215 && m<300 && n>224 && n<237)
  { setcolor(RED);
    outtextxy(220,225,"Slot 5"); }
  else
  { setcolor(WHITE);
    outtextxy(220,225,"Slot 5");

  if(m>215 && m<300 && n>239 && n<252)
  { setcolor(RED);
    outtextxy(220,240,"Slot 6"); }
  else
  { setcolor(WHITE);
    outtextxy(220,240,"Slot 6");

  if(m>215 && m<300 && n>254 && n<267)
  { setcolor(RED);
    outtextxy(220,255,"Slot 7"); }
  else
  { setcolor(WHITE);
    outtextxy(220,255,"Slot 7");

  if(m>215 && m<300 && n>269 && n<282)
  { setcolor(RED);
    outtextxy(220,270,"Slot 8"); }
  else
  { setcolor(WHITE);
    outtextxy(220,270,"Slot 8");

  if(m>215 && m<300 && n>284 && n<297)
  { setcolor(RED);
    outtextxy(220,285,"Slot 9"); }
  else
  { setcolor(WHITE);
    outtextxy(220,285,"Slot 9");

  if(m>215 && m<300 && n>299 && n<312)
  { setcolor(RED);
    outtextxy(220,300,"Slot 10"); }
  else
  { setcolor(WHITE);
    outtextxy(220,300,"Slot 10");
  }}}}}}}}}}}
  if(button == 1)
  { if(m>245 && m<325 && n>320 && n<332)
    { hidemouseptr();
      video(450,150,0);
      spawnl(P_WAIT,"h:\\exe\\menu1.exe", NULL);
      exit(0);	}
    if(m>215 && m<300 && n>164 && n<177)
    { hidemouseptr();
      video(450,150,0);
      slot=1;
      save(slot);
      spawnl(P_WAIT,"h:\\exe\\menu1.exe", NULL);
      exit(0);  }
  if(m>215 && m<300 && n>179 && n<192)
  { hidemouseptr();
      video(450,150,0);
      slot=2;
      save(slot);
      spawnl(P_WAIT,"h:\\exe\\menu1.exe", NULL);
      exit(0);  }
  if(m>215 && m<300 && n>194 && n<207)
  { hidemouseptr();
      video(450,150,0);
      slot=3;
      save(slot);
      spawnl(P_WAIT,"h:\\exe\\menu1.exe", NULL);
      exit(0);  }
  if(m>215 && m<300 && n>209 && n<222)
  { hidemouseptr();
      video(450,150,0);
      slot=4;
      save(slot);
      spawnl(P_WAIT,"h:\\exe\\menu1.exe", NULL);
      exit(0);  }
  if(m>215 && m<300 && n>224 && n<237)
  { hidemouseptr();
      video(450,150,0);
      slot=5;
      save(slot);
      spawnl(P_WAIT,"h:\\exe\\menu1.exe", NULL);
      exit(0);  }
  if(m>215 && m<300 && n>239 && n<252)
  {hidemouseptr();
      video(450,150,0);
      slot=6;
      save(slot);
      spawnl(P_WAIT,"h:\\exe\\menu1.exe", NULL);
      exit(0);  }
  if(m>215 && m<300 && n>254 && n<267)
  {hidemouseptr();
      video(450,150,0);
      slot=7;
      save(slot);
      spawnl(P_WAIT,"h:\\exe\\menu1.exe", NULL);
      exit(0);  }
  if(m>215 && m<300 && n>269 && n<282)
  {hidemouseptr();
      video(450,150,0);
      slot=8;
      save(slot);
      spawnl(P_WAIT,"h:\\exe\\menu1.exe", NULL);
      exit(0);  }
  if(m>215 && m<300 && n>284 && n<297)
  {hidemouseptr();
      video(450,150,0);
      slot=9;
      save(slot);
      spawnl(P_WAIT,"h:\\exe\\menu1.exe", NULL);
      exit(0);  }
  if(m>215 && m<300 && n>299 && n<312)
  {hidemouseptr();
      video(450,150,0);
      slot=10;
      save(slot);
      spawnl(P_WAIT,"h:\\exe\\menu1.exe", NULL);
      exit(0);   }}}
}
Example #15
0
void main()
{
 int gdriver = DETECT, gmode;
 initgraph(&gdriver, &gmode, "\\tc\\bgi");
 cleardevice();
 king("ch1");
 int Mstatus = initmouse();
 int button,m,n,slot;
 settextstyle(2,0,4);
 outtextxy(230,130,"SAVING");
 if(Mstatus == 0 )
  outtextxy(50,50, "Mouse Support Not Available");
 while(!kbhit())
{ showmouseptr();
  getmousepos(&button,&m,&n);
  if(m>245 && m<325 && n>320 && n<332)
  { setcolor(RED);
    outtextxy(250,320,"BACK"); }
  else
  { setcolor(WHITE);
    outtextxy(250,320,"BACK");
  if(m>215 && m<300 && n>164 && n<177)
  { setcolor(RED);
    outtextxy(220,165,"Slot 1"); }
  else
  { setcolor(WHITE);
    outtextxy(220,165,"Slot 1");
  if(m>215 && m<300 && n>179 && n<192)
  { setcolor(RED);
    outtextxy(220,180,"Slot 2"); }
  else
  { setcolor(WHITE);
    outtextxy(220,180,"Slot 2");
  if(m>215 && m<300 && n>194 && n<207)
  { setcolor(RED);
    outtextxy(220,195,"Slot 3"); }
  else
  { setcolor(WHITE);
    outtextxy(220,195,"Slot 3");
  if(m>215 && m<300 && n>209 && n<222)
  { setcolor(RED);
    outtextxy(220,210,"Slot 4"); }
  else
  { setcolor(WHITE);
    outtextxy(220,210,"Slot 4");

  if(m>215 && m<300 && n>224 && n<237)
  { setcolor(RED);
    outtextxy(220,225,"Slot 5"); }
  else
  { setcolor(WHITE);
    outtextxy(220,225,"Slot 5");

  if(m>215 && m<300 && n>239 && n<252)
  { setcolor(RED);
    outtextxy(220,240,"Slot 6"); }
  else
  { setcolor(WHITE);
    outtextxy(220,240,"Slot 6");

  if(m>215 && m<300 && n>254 && n<267)
  { setcolor(RED);
    outtextxy(220,255,"Slot 7"); }
  else
  { setcolor(WHITE);
    outtextxy(220,255,"Slot 7");

  if(m>215 && m<300 && n>269 && n<282)
  { setcolor(RED);
    outtextxy(220,270,"Slot 8"); }
  else
  { setcolor(WHITE);
    outtextxy(220,270,"Slot 8");

  if(m>215 && m<300 && n>284 && n<297)
  { setcolor(RED);
    outtextxy(220,285,"Slot 9"); }
  else
  { setcolor(WHITE);
    outtextxy(220,285,"Slot 9");

  if(m>215 && m<300 && n>299 && n<312)
  { setcolor(RED);
    outtextxy(220,300,"Slot 10"); }
  else
  { setcolor(WHITE);
    outtextxy(220,300,"Slot 10");
  }}}}}}}}}}}
  if(button == 1)
  { if(m>245 && m<325 && n>320 && n<332)
    { hidemouseptr();
      video(450,150);
//      spawnl(P_WAIT,"g:\\exe\\menu1.exe", NULL);  // back to main menu
      break;  }
    if(m>215 && m<300 && n>164 && n<177)
    { hidemouseptr();
      video(450,150);
      slot=1;
      save(slot);  }
  if(m>215 && m<300 && n>179 && n<192)
  { hidemouseptr();
      video(450,150);
      slot=2;
      save(slot);  }
  if(m>215 && m<300 && n>194 && n<207)
  { hidemouseptr();
      video(450,150);
      slot=3;
      save(slot);  }
  if(m>215 && m<300 && n>209 && n<222)
  { hidemouseptr();
      video(450,150);
      slot=4;
      save(slot); }
  if(m>215 && m<300 && n>224 && n<237)
  { hidemouseptr();
      video(450,150);
      slot=5;
      save(slot);}
  if(m>215 && m<300 && n>239 && n<252)
  {hidemouseptr();
      video(450,150);
      slot=6;
      save(slot);}
  if(m>215 && m<300 && n>254 && n<267)
  {hidemouseptr();
      video(450,150);
      slot=7;
      save(slot);}
  if(m>215 && m<300 && n>269 && n<282)
  {hidemouseptr();
      video(450,150);
      slot=8;
      save(slot);}
  if(m>215 && m<300 && n>284 && n<297)
  {hidemouseptr();
      video(450,150);
      slot=9;
      save(slot);}
  if(m>215 && m<300 && n>299 && n<312)
  {hidemouseptr();
      video(450,150);
      slot=10;
      save(slot);}}}}
Example #16
0
void highdikhao()
	{
		long z=k1.ank;
		char Arr[20];
		int num=0;
		long x=k1.ank;
		z=x;
		if(k1.ank==0)
			{
				strcpy(Arr,"000");
				return;
			}
		while(z!=0)
			{
				z=z/10;
				num++;
			}
		int i=0;
		if(x<100 && x>0)
			{
				i=-1;
				Arr[0]='0';
			}
		Arr[num-i]='\0';
		z=x;
		while(z!=0)
			{
				i++;
				switch(z%10)
					{
						case 0: Arr[num-i]=char(48);break;
						case 1: Arr[num-i]=char(49);break;
						case 2: Arr[num-i]=char(50);break;
						case 3: Arr[num-i]=char(51);break;
						case 4: Arr[num-i]=char(52);break;
						case 5: Arr[num-i]=char(53);break;
						case 6: Arr[num-i]=char(54);break;
						case 7: Arr[num-i]=char(55);break;
						case 8: Arr[num-i]=char(56);break;
						case 9: Arr[num-i]=char(57);break;
					}
				z=z/10;
			}
			setcolor(WHITE);
			settextstyle(1,HORIZ_DIR,4);
			outtextxy(200,25,"SARVADHIK-ANK");
			setcolor(BLACK);
			settextstyle(1,HORIZ_DIR,4);
			outtextxy(140,150,"CHALIYE KHELEN");
			outtextxy(140,200,"SARVADHIK");
			outtextxy(140,250,"AA AB LAUT CHALEN");
			settextstyle(1,HORIZ_DIR,2);
			outtextxy(110,205,">>");
			setcolor(WHITE);
			settextstyle(1,HORIZ_DIR,4);
			outtextxy(180,120,k1.naam);
			outtextxy(200,150,Arr);
			settextstyle(1,HORIZ_DIR,4);
			settextstyle(1,HORIZ_DIR,2);
			outtextxy(150,250,"KRIPYA TANIK PRATIKSHA KAREN!!!");
			delay(5000);
			setcolor(BLACK);
			settextstyle(1,HORIZ_DIR,4);
			outtextxy(180,120,k1.naam);
			outtextxy(200,150,Arr);
			settextstyle(1,HORIZ_DIR,2);

			outtextxy(150,250,"KRIPYA TANIK PRATIKSHA KAREN!!!");
			outtextxy(110,155,">>");
			settextstyle(1,HORIZ_DIR,4);
			outtextxy(200,25,"SARVADHIK-ANK");

			setcolor(WHITE);
			settextstyle(1,HORIZ_DIR,4);
			outtextxy(140,150,"CHALIYE KHELEN");
			outtextxy(140,200,"SARVADHIK");
			outtextxy(140,250,"AA AB LAUT CHALEN");
			settextstyle(1,HORIZ_DIR,2);
			outtextxy(110,205,">>");



	}
Example #17
0
int main()
{int i=300,jj=0,p=0,q=0,a,v,h,b,res,w=0,e=0,r=0,j=100,x=0,kk[6][6],y=0,ch=0,gd=DETECT,gm,k,l;
 int str[18][5]={222,420,140,35,100,
		 13,260,150,70,60,
		 435,120,35,456,354,
		 35,54,32,432,98,
		 334,30,545,24,12,
		 10,90,49,46,234,
		 112,32,121,600,225,
		 729,16,98,564,875,
		 76,86,86,974,36,
		 780,660,732,96,208,
		 31,75,568,930,836,
		 32,22,765,312,54,
		 65,54,86,50,90,
		 570,352,46,27,35,
		 786,540,314,876,289,
		 230,372,948,938,732,
		 328,244,144,134,385,
		 456,382,395,85,384
		 };
 char pop[5],arr[2][25]={" ","RULES AND REGULATION :"};
 int score=0;
 initgraph(&gd,&gm,"C:\\TC\\BGI");

int pos[200][8];
setbkcolor(5);

for(a=0;a<=200;a++)
{ for(b=0;b<=8;b++)
  {pos[a][b]=0;
  }
}
for(a=0;a<=6;a++)
{for(b=0;b<=6;b++)
 {kk[a][b]=0;
 }
}
b=0;

for(a=2;a<30;a++)
{line(1,a,1000,a);
a++;
}

 setfillstyle(1,14);
 settextstyle(TRIPLEX_FONT,HORIZ_DIR,9);
 b=0;
 setfillstyle(1,8);
 bar(550,60+b,620,160+b);
 b=b+100;
 setfillstyle(1,58);
 bar(550,60+b,620,160+b);
 b=b+100;

 setfillstyle(1,14);
 bar(550,60+b,620,160+b);

 b+=100;
 setfillstyle(1,1);
 bar(550,60+b,620,160+b);

  setcolor(15);
  outtextxy(560,50,"T");
  setcolor(0);
  outtextxy(560,150,"E");
  setcolor(2);
  outtextxy(560,250,"C");
  setcolor(14);
  outtextxy(555,350,"H");
  setcolor(9);
  settextstyle(TRIPLEX_FONT,HORIZ_DIR,4);
  setcolor(15);
  outtextxy(160,50,"MATHEMATICAL DYAD");
  setfillstyle(6,15);
  bar(140,90,500,95);
settextstyle(TRIPLEX_FONT,HORIZ_DIR,1);
setcolor(15);
outtextxy(30,120,arr[1]);
bar(20,145,270,150);
outtextxy(30,160,"Rule 1: Points are awarded when numbers are paired");
outtextxy(90,180," as multiples (vertically) and the lower number");
outtextxy(90,200," is greater. ");
outtextxy(30,230,"Rule 2: Points are deducted when numbers are paired");
outtextxy(90,250," as multiples (vertically) and the lower number");
outtextxy(90,270," is smaller. ");
outtextxy(30,300,"Rule 3: The HCF of the two adjacent numbers");
outtextxy(90,320," (horizontally) is divided from both the numbers");
outtextxy(90,340," and points are awarded accordingly.");
outtextxy(30,370,"Rule 4: 1 being a special number, no points are ");
outtextxy(90,390," awarded or deducted when numbers are paired");
outtextxy(90,410," with 1. ");
outtextxy(90,430,"            Press spacebar to continue");

  settextstyle(TRIPLEX_FONT,HORIZ_DIR,1);
  ch=getch();
for(a=0;;a++)
{if(ch==32)
  {break;
  }
  else
 {ch=getch();
 }
}
  cleardevice();
  setbkcolor(9);
  for(a=2;a<30;a++)
{line(1,a,1000,a);
a++;
}
setfillstyle(1,14);
settextstyle(TRIPLEX_FONT,HORIZ_DIR,9);
   b=0;
   setfillstyle(1,8);
   bar(550,60+b,620,160+b);
   b=b+100;
   setfillstyle(1,58);
   bar(550,60+b,620,160+b);
   b=b+100;

setfillstyle(1,14);
bar(550,60+b,620,160+b);
b+=100;
setfillstyle(1,1);

bar(550,60+b,620,160+b);

setcolor(15);
  outtextxy(560,50,"T");
  setcolor(0);
  outtextxy(560,150,"E");
  setcolor(2);
  outtextxy(560,250,"C");
  setcolor(14);
  outtextxy(555,350,"H");
  setcolor(9);
settextstyle(TRIPLEX_FONT,HORIZ_DIR,4);
setcolor(15);
outtextxy(160,50,"MATHEMATICAL DYAD");
setfillstyle(8,15);
bar(140,90,510,95);

  settextstyle(TRIPLEX_FONT,HORIZ_DIR,1);
  setfillstyle(5,15);
  b=0;

  for(a=0;a<=6;a++)
  {
   bar(185, 125+b,415,130+b);
   b+=45;
   }
   b=0;
   for(a=0;a<=5;a++)
    { bar(185+b,125,190+b,395);
      b+=45;
    }
	setcolor(15);
	settextstyle(TRIPLEX_FONT,HORIZ_DIR,1);
	setfillstyle(1,1);
	bar3d(55,130,155,170,5,5);
	bar3d(55,180,155,220,5,5);
	bar3d(55,230,155,270,5,5);
	bar3d(55,280,155,320,5,5);
	bar3d(55,330,155,370,5,5);
	     outtextxy(65,140,"LEFT");
	     outtextxy(65,190,"DOWN");
	     outtextxy(65,240,"RIGHT");
	     outtextxy(65,290,"ESC");
	     outtextxy(65,340,"'H' HALT");

 for(p=0;p<=18;p++)
 {
  for(q=0;q<5;q++)
   { setcolor(15);
    i=300;
    j=150;
    x=0;
    y=0;
    ascii(str[p][q],pop,score);
    res=check(kk,pos,i,j,x,y,jj,score);
    if(res==1)
    {scoring(score,pos);
    }

   while(ch!=1)
   {
    settextstyle(TRIPLEX_FONT,HORIZ_DIR,1);

    /*"DEFAULT font","TRIPLEX fontSMALL font","SMALL font",
      "SANS SERIF font","GOTHIC font" */

   a=result(kk,pos,jj,score);
   a=side(kk,jj,pos,score);
   a=result(kk,pos,jj,score);
   setfillstyle(1,1);
   bar(i-20,j-20,i+20,j+20);
   if(str[p][q]>=100)
   {outtextxy(i-15,j-7,pop);
   }
   else if(str[p][q]<100)
   {outtextxy(i-7,j-7,pop);
   }

   delay(500);

   if(kbhit())
    {  a=side(kk,jj,pos,score);
       ch=getch();

      if(ch==75)
	{x=-45;
	 y=0;

       }
      if(ch==77)
      {x=45;
       y=0;
      }

      if(ch==72||ch==104)
     {  settextstyle(TRIPLEX_FONT,HORIZ_DIR,4);
	ch=0;

	for(a=2;;a++)
       {setfillstyle(1,60);
	bar(420,130,540,180);
	setcolor(15);
	settextstyle(TRIPLEX_FONT,HORIZ_DIR,4);
	outtextxy(445,140,"HALT");

	setfillstyle(1,1);
	bar(420,190,540,250);
	setfillstyle(1,15);
	bar(460,200,475,240);
	bar(485,200,500,240);
	delay(1000);

	setfillstyle(1,1);
	bar(420,190,540,250);

	delay(1000);

	setcolor(15);
	settextstyle(TRIPLEX_FONT,HORIZ_DIR,1);
	outtextxy(90,420,"       Press 'R' to resume the game !!");

	if(kbhit())
	 {ch=getch();
	  if(ch==82||ch==114)
	   {ch=0;
	   setfillstyle(1,9);
	   bar(420,130,540,180);
	   bar(420,190,540,250);
	   bar(80,410,500,450);

	   goto lable2;
	   }
       }

     }
     }
     lable2:
     settextstyle(TRIPLEX_FONT,HORIZ_DIR,1);
     setcolor(15);

      if(ch==97||ch==65)
      { goto lable;
      }
      if(ch==80)
      {x=0;
       y=45;
      }
      if(ch==27)
      {  delay(2000);
	 cleardevice();
	 setbkcolor(14);
	 setcolor(1);
	 settextstyle(TRIPLEX_FONT,HORIZ_DIR,4);

	 outtextxy(220,110,"GAME OVER !!");
	 setfillstyle(1,4);
	 bar(210,170,430,250);
	 setcolor(15);
	 outtextxy(230,200,"SCORE : " );
	 ascii(score,pop,score);
	 if(score==0)
	   {outtextxy(475,200,"0");
	    }
	 else if(score>0&&score<10)
	   { outtextxy(370,200,pop );
	   }
	 else if(score>=10&&score<100)
	   { outtextxy(365,200,pop );
	   }
	 else if(score>99&&score<1000)
	   { outtextxy(350,200,pop);
	    }
	 else if(score>999)
	   { outtextxy(345,200,pop);
	   }



	 setcolor(2);
	 settextstyle(TRIPLEX_FONT,HORIZ_DIR,3);

	 outtextxy(120,250,"We hope that you enjoyed our game" );
	 outtextxy(120,290,"to the fullest. Please give your " );
	 outtextxy(120,330,"prescious feedback on our website " );
	 setcolor(12);
	 outtextxy(200,370,"www.catexpo_games.com " );
	 getch();
	 closegraph();
	 exit(0);
	      }

      if((i+x)>390)
      {x=0;
      }
      if((i+x)<210)
      {x=0;
      }
     if((y+j)>375)
     { y=0;
       ch=1;
     }
      setfillstyle(3,9);
      res=check(kk,pos,i,j,x,y,jj,score);
      if(res==0)
       {
      delay(100);
      bar(i-20,j-20,i+20,j+20);
      i=i+x;
      j=j+y;

      setfillstyle(1,1);
      bar(i-20,j-20,i+20,j+20);
       if(str[p][q]>=100)
	  {outtextxy(i-15,j-7,pop);
	  }
       else if(str[p][q]<100)
	 {outtextxy(i-7,j-7,pop);
	 }

      x=0;
      y=0;

      a=result(kk,pos,jj,score);
      a=side(kk,jj,pos,score);
      scoring(score,pos);
      a=result(kk,pos,jj,score);
      scoring(score,pos);
       }

      }

  else
  {
   if((j+45)>375)
   {
    y=0;

    ch=1;
    a=result(kk,pos,jj,score);
    scoring(score,pos);
    a=side(kk,jj,pos,score);
    scoring(score,pos);
    a=result(kk,pos,jj,score);
    scoring(score,pos);
   }
   else
   {y=45;
    x=0;
    res=check(kk,pos,i,j,x,y,jj,score);
    if(res==0)
       {
	setfillstyle(1,9);
	bar(i-20,j-20,i+20,j+20);
	j=j+45;
	i=i+x;
       }
      else
      {
      ch=1;
      }

    }
    a=result(kk,pos,jj,score);
    scoring(score,pos);
    a=side(kk,jj,pos,score);
    scoring(score,pos);
    a=result(kk,pos,jj,score);
    scoring(score,pos);
 }
 }
 pos[jj][0]=i;
 pos[jj][1]=j;

 w=0;
 e=0;
 r=0;

 for(a=210;a<=390;)
 {
  if(i==a)
   { e=r;
   }
   r++ ;
   a=a+45;
 }
 r=5;

 for(b=375;b>=100;)
 {if(j==b)
   { w=r;
   }
   r-- ;
   b=b-45;
 }

kk[w][e]=str[p][q];

ch=0;
r=0;
i=300;
j=150;
e=0;
w=0;
x=0;
jj++;
y=0;

}

    a=result(kk,pos,jj,score);
    scoring(score,pos);
    a=side(kk,jj,pos,score);
    scoring(score,pos);
    a=result(kk,pos,jj,score);
    scoring(score,pos);
}
lable:
cleardevice();
closegraph();
getch();
return 0;
}
Example #18
0
  void open()
  {
   int gd=DETECT,gm;
   initgraph(&gd,&gm,"c:\\tc\\BGI");
   int y=155,flag=0;
  rectangle(100,100,500,350);
 setcolor(WHITE);
 settextstyle(1,HORIZ_DIR,4);
 outtextxy(140,150,"CHALIYE KHELEN");
 outtextxy(140,200,"SARVADHIK");
 outtextxy(140,250,"AA AB LAUT CHALEN");
 settextstyle(1,HORIZ_DIR,2);
 outtextxy(110,155,">>");

 delay(1000);
// outtextxy(110,205,">>");
// outtextxy(110,255,">>");
 while(flag==0)
	{
		while(kbhit())
			{
				label:
				setcolor(BLACK);
				outtextxy(110,155,">>");
				outtextxy(110,205,">>");
				outtextxy(110,255,">>");

				setcolor(WHITE);
				outtextxy(110,y,">>");
				char ch=getch();

				 // setcolor(BLACK);
				// outtextxy(110,205,">>");
					// outtextxy(110,255,">>");
				if(ch==13)
					  {
						   if(y==155) flag=1;
						   /*
							{
								cleardevice();
								k.ank-=10;
								main();
								  //	goto wahinse;
							} //resume;   */
						   if(y==205)
						   {
								fstream fp;
								fp.open("player.txt",ios::in);
								fp.read((char*)&k1,sizeof(k1));
								highdikhao();
							   //	settextstyle(1,HORIZ_DIR,4);
							   //	gotoxy(20,15);
							   //	cout<<k1.naam<<"\n"<<k1.ank;
								fp.close();

						   }

								//Draw();//shooroo();
						   if(y==255)exit(0);//GameOver();//maardo();
					  }
					  setcolor(0);
		  //						settextstyle(1,HORIZ_DIR,4);
		  //	outtextxy(200,300,Arr);

				if(ch==0)
					  {
						   ch=getch();
					  }
						  //	if(ch==72)CycleUp();
				if(ch==72)
						 {
							if(y==155) {y=255;goto label;}
							if(y==255) {y=205;goto label;}
							if(y==205) {y=155;goto label;}
						 }
						   //	if(ch==80)CycleDown();
				if(ch==80)
					{
						if(y==155) {y=205;goto label;}
						if(y==205) {y=255;goto label;}
						if(y==255) {y=155;goto label;}
						}
			}
  }

// wahinse:
closegraph();

 }
Example #19
0
 void game(int level)
 {
    label:

    int left=62, top=95, area, a[9], b[9],i ,j;
    int  key;
    void *p;


    rectangle(10,10,500,60);
    rectangle(11,11,501,61);
    settextstyle(DEFAULT_FONT, HORIZ_DIR, 2);
    outtextxy(215,25,"HIT IT");


    settextstyle(DEFAULT_FONT, HORIZ_DIR, 2);
    outtextxy(535,25,"MENU");
    settextstyle(DEFAULT_FONT, HORIZ_DIR, 1);
    outtextxy(530,76,"HIGH SCORE");
    outtextxy(520,131,"CURRENT SCORE");
    outtextxy(545,181,"LEVEL");
    outtextxy(530,231,"TIME LEFT");
    outtextxy(520,305,"INSTRUCTIONS");
    line(505,290,630,290);
    line(506,291,631,291);
    outtextxy(510,330,"HIT THE BUTTON");
    outtextxy(510,345,"CORRESPONDING");
    outtextxy(510,360,"TO THE BOX");
    outtextxy(510,375,"NUMBERED FROM");
    outtextxy(510,390,"1 TO 9.");
    outtextxy(510,420,"PRESS ESC KEY");
    outtextxy(510,435,"TO EXIT");

    rectangle(10,62,500,470);
    rectangle(11,63,501,471);
    line(170,62,170,470);
    line(171,63,171,471);
    line(340,62,340,470);
    line(341,63,341,471);
    line(10,198,500,198);
    line(11,199,501,199);
    line(10,334,500,334);
    line(11,335,501,335);
    rectangle(505,10,630,470);
    rectangle(506,11,631,471);
    outtextxy(160,188,"7");
    outtextxy(330,188,"8");
    outtextxy(490,188,"9");
    outtextxy(160,324,"4");
    outtextxy(330,324,"5");
    outtextxy(490,324,"6");
    outtextxy(160,460,"1");
    outtextxy(330,460,"2");
    outtextxy(490,460,"3");

    setcolor(YELLOW);
    circle(92,125,30);
    setfillstyle(SOLID_FILL,YELLOW);
    floodfill(92,125,YELLOW);

    setcolor(BLACK);
    setfillstyle(SOLID_FILL,BLACK);
    fillellipse(84,113,2,6);
    fillellipse(100,113,2,6);

    ellipse(92,128,185,355,20,8);
    ellipse(92,128,185,355,20,9);
    ellipse(92,128,185,355,20,10);


    a[0]= 252;
    b[0]= 120;
    a[1]= 252;
    b[1]= 265;
    a[2]= 252;
    b[2]= 410;
    a[3]= 412;
    b[3]= 120;
    a[4]= 412;
    b[4]= 265;
    a[5]= 412;
    b[5]= 410;
    a[6]= 92;
    b[6]= 265;
    a[7]= 92;
    b[7]= 410;
    a[8]= 92;
    b[8]= 120;


    area = imagesize(left, top, left + 60, top + 60);
    p = malloc(area);
    getimage(left, top, left + 60, top + 60, p);
    gotoxy(71,13);
    cout<<level;

    randomize();
    i= random(9);
    putimage(left, top, p, XOR_PUT);
    putimage(a[i]-30 ,b[i]-30 , p, XOR_PUT);
    left=a[i]-30;
    top=b[i]-30;


    gotoxy(71,10);
    cout<<score;

    time_t t, t1, t2, t3;

    t=time(NULL);

    int test=0;

    do
    {
     int x;
     while (bioskey(1) == 0)
     {
       t1=time(NULL);
       x=difftime(t1,t);
       gotoxy(70,16);
       printf("%2d",30-x);

       if(x>=30)
       break;

       i= random(9);
       putimage(left, top, p, XOR_PUT);
       putimage(a[i]-30 ,b[i]-30 , p, XOR_PUT);
       left=a[i]-30;
       top=b[i]-30;
       delay(500);
       test++;
     }

    if(x>=30)
    break;
    key=bioskey(0);

     switch(key)
     {
       case 561:
       if(i==7)
       {
       sound(1000);
       score++;
       delay(50);
       nosound();
       }
       else
       {
       sound(100);
       delay(50);
       nosound();
       }
       break;

       case 818:
       if(i==2)
       {
       sound(1000);
       score++;
       delay(50);
       nosound();
       }
       else
       {
       sound(100);
       delay(50);
       nosound();
       }
       break;

       case 1075:
       if(i==5)
       {
       sound(1000);
       score++;
       delay(50);
       nosound();
       }
       else
       {
       sound(100);
       delay(50);
       nosound();
       }
       break;

       case 1332:
       if(i==6)
       {
       sound(1000);
       score++;
       delay(50);
       nosound();
       }
       else
       {
       sound(100);
       delay(50);
       nosound();
       }
       break;

       case 1589:
       if(i==1)
       {
       sound(1000);
       score++;
       delay(50);
       nosound();
       }
       else
       {
       sound(100);
       delay(50);
       nosound();
       }
       break;

       case 1846:
       if(i==4)
       {
       sound(1000);
       score++;
       delay(50);
       nosound();
       }
       else
       {
       sound(100);
       delay(50);
       nosound();
       }
       break;

       case 2103:
       if(i==8)
       {
       sound(1000);
       score++;
       delay(50);
       nosound();
       }
       else
       {
       sound(100);
       delay(50);
       nosound();
       }
       break;

       case 2360:
       if(i==0)
       {
       sound(1000);
       score++;
       delay(50);
       nosound();
       }
       else
       {
       sound(100);
       delay(50);
       nosound();
       }
       break;

       case 2617:
       if(i==3)
       {
       sound(1000);
       score++;
       delay(50);
       nosound();
       }
       else
       {
       sound(100);
       delay(50);
       nosound();
       }
       break;

       case 283:
       void start();
       char ch;
       again:
       setcolor(RED);
       setfillstyle(SOLID_FILL,BROWN);
       bar(100,200,440,300);
       rectangle(100,200,440,300);
       settextstyle(DEFAULT_FONT, HORIZ_DIR, 2);
       setcolor(WHITE);
       settextstyle(DEFAULT_FONT,HORIZ_DIR,1);
       outtextxy(110,250,"ARE YOU SURE YOU WANT TO EXIT (Y/N)");
       gotoxy(1,1);

       ch = _bios_keybrd(_KEYBRD_READ);

	 if(ch=='y'||ch=='Y')
	 {
	   outtextxy(400,250,"Y");
	   delay(500);
	   exit(0);
	 }

	 if(ch=='n'||ch=='N')
	 {
	 outtextxy(400,250,"N");
	 delay(500);
	 clearviewport();
	 goto label;
	 }
	 else
	 goto again;
      }

    gotoxy(71,10);
    cout<<score;
    i= random(9);
    putimage(left, top, p, XOR_PUT);
    putimage(a[i]-30 ,b[i]-30 , p, XOR_PUT);
    left=a[i]-30;
    top=b[i]-30;
    setcolor(WHITE);

    }while(test<30);

    }
Example #20
0
main()
{    
      
time_t seconds;          //Declare variable to hold seconds on clock.

time(&seconds);          //Get value from system clock andplace in seconds variable.

srand((unsigned int) seconds);               //Convert seconds to a unsignedinteger.
 
  initwindow(1350, 700, "MAZE TRIAL");    
 floodfill(0,0,WHITE);
 
  int r=c=0; // Stores the values of rows and coloumns;
  int R,C; //No. of boxes
  
 /*setbkcolor(BLACK);
settextstyle(TRIPLEX_FONT,HORIZ_DIR,1);
outtextxy(500,5,"enter the ROWS ");
  
  char num[3];
 int i,k=1;
 
 while((i=getch())!=13)
    {
     r+=(i-48)*pow(10,k);
     k--;
    }
    cout<<r;
    
  num[0]=((r-(r%10))/10)+48;
  num[1]=(r%10)+48;
  num[2]='\0';
  
  outtextxy(500,5,"NUMBER OF ROWS ARE : ");
  outtextxy(500,20,num);
   
   getch();
   
   floodfill(0,0,BLUE);

 setbkcolor(BLACK);
settextstyle(TRIPLEX_FONT,HORIZ_DIR,1);
outtextxy(500,5,"enter the COLUMNS ");


 k=1;
 
 while((i=getch())!=13)
    {
     c+=(i-48)*pow(10,k);
     k--;
    }

  num[0]=((c-(c%10))/10)+48;
  num[1]=(c%10)+48;
  num[2]='\0';
  
  outtextxy(500,5,"NUMBER OF COLUMNS ARE : ");
  outtextxy(500,20,num);

getch();

 setbkcolor(WHITE);
settextstyle(TRIPLEX_FONT,HORIZ_DIR,1);


floodfill(0,0,BLUE);*/


  /*cout<<" Columns: ";
  cin>> c;*/
  R=r=10;
  C=c=10;
  
   
   
  while(1)
  {
     for(int i=0;i<r;i++)
     for(int j=0; j<c; j++)
        a[i][j]=0;
      
  stack adrs[1000];   //////////////////////////////////////////////////////////////////
             
      
  adrs[top].x=0;
  adrs[top].y=0;              // initially the address is 0,0   
   
  
  
  
     
     StartMenu();
     int ch;
     ch=getch();
     ch-=48;
     
     setfillstyle(SOLID_FILL,WHITE);
     floodfill(0,0,MAGENTA);
   
   setfillstyle(SOLID_FILL,WHITE);
  floodfill(0,0,BLACK);
  
  settextstyle(3,0,6);
  setbkcolor(WHITE);
  setcolor(BLACK);
  outtextxy(100,100,"Choose Level");
  setbkcolor(RED);
  setcolor(WHITE);
  outtextxy(500,100," 1 EASY ");
  setbkcolor(GREEN);
  setcolor(WHITE);
  outtextxy(750,100," 2 MEDIUM");
  setbkcolor(BLUE);
  setcolor(WHITE);
  outtextxy(1050,100," 3 HARD");
   
   int Level=getch();
   setfillstyle(SOLID_FILL,WHITE);
   floodfill(0,0,MAGENTA);
     
   switch(Level)
   {
    case 49: R=r=10;
             C=c=10;
             break;
             
    case 50: R=r=13;
             C=c=24;
             break;
             
    case 51: R=r=18;
             C=c=35;
             break;
   }
   
  r=(2*r)-1;
  c=(2*c)-1;
   
   basic_design(r,c,ch);
   //out_boundary(r,c);
   int H=1, L=3;
  
   out_boundary(r,c,ch);
      
 getch();
 
     a[0][0]=1;      //int k=0;
     
   while(1)
    { int ender=0;
     
     D=direc(); 
     //cout<<"Receiving "<<D<<"\n\n";
     //getch();
        
     //cout<<"Direction ? ";
     //cin>>D;
     
     switch(D)
     {  
        int nx,ny,ox,oy;
           
        case 1:
                                  
             cout<<"\n\nPresent TOP: "<<top;            //UP
             cout<<"\nPresent TOP x: "<<adrs[top].x;   
             cout<<"\nPresent TOP y: "<<adrs[top].y;
               
                if(adrs[top].x > 0) //if 1
                 {
                  nx = adrs[top].x-2;
                  ny = adrs[top].y;
                  ox = adrs[top].x;
                  oy = adrs[top].y;
                  
                 cout<<"\nFuture New: "<<nx<<ny<<"\n\n";
                  
                  if(nx==adrs[top-1].x && ny==adrs[top-1].y)// if 2
                    continue;
                  else// else 2
                    {
                     if( a[nx][ny] !=1 )//if 3
                       {
                        cout<<"\nOld: "<<ox<<oy;
                        cout<<"\nNew: "<<nx<<ny;
                        cout<<"\nMoved";
                        cout<<"\n\n";
                        
                        top++;
                        adrs[top].x = nx;
                        adrs[top].y = ny;
                        a[nx][ny]=1;
                        a[nx+1][ny]=1;
                        bx=nx+1;
                        by=ny;
                       // setcolor(WHITE);
                        //line(25+25*ny,50+25*nx,50+25*ny,50+25*nx);  
                        coord_cal(bx,by);  // panting the red brick -> white
                       }  // Pointer moved. Next iteration
                     else     //else 3
                      {
                       count++;
                       if(count==5)
                          {
                            count=0;
                           --top; 
                          }//if
                      }//else
                              //Pointer backtracked. Next iteration
                    }  
            
            }   
         break;

         
 
case 2:      
                    //right
       cout<<"\n\nPresent TOP: "<<top;
       cout<<"\nPresent TOP x: "<<adrs[top].x;   
             cout<<"\nPresent TOP y: "<<adrs[top].y;
         
           
                   
       if(adrs[top].y <c-1)
         {
          nx = adrs[top].x;
          ny = adrs[top].y+2;
          ox = adrs[top].x; 
          oy = adrs[top].y;
           
        
          cout<<"\nFuture New: "<<nx<<ny;
          cout<<"\n\n";     
           
                  
          if(top!=0)
            {
             if(nx==adrs[top-1].x && ny==adrs[top-1].y)   
               continue;                   
             else
               {
                if( a[nx][ny] !=1)
                  {
                    cout<<"\nOld: "<<ox<<oy;
                    cout<<"\nNew: "<<nx<<ny;
                    cout<<"Moved";
                    cout<<"\n\n";
               
                    top++;
                    adrs[top].x = nx;
                    adrs[top].y = ny;
                    a[nx][ny]=1;
                    a[nx][ny-1]=1;
                    bx=nx;
                    by=ny-1;
                    //setcolor(BLACK);
                    //line( 50+25*oy,25+25*ox,50+25*oy,50+25*ox );   
                     coord_cal(bx,by);   // panting the red brick -> white
                    // return; // return back to direction specifier.
                  }
                else
                 {count++;
                      if(count==5)
                      {
                        count=0;  --top;} }   //return; // return back to direction specifier
               }
            }
          else
          {
           top++;
           adrs[top].x = nx;
           adrs[top].y = ny;
           a[nx][ny]=1;
           a[nx][ny-1]=1;
                               bx=nx;
                    by=ny-1;
                            coord_cal(bx,by);
           //setcolor(BLACK);
           //line( 50+25*oy,25+25*ox,50+25*oy,50+25*ox );
          }
}         

     break;
  
  case 3:
                                 //DOWN
           cout<<"\n\nPresent TOP: "<<top;
           cout<<"\nPresent TOP x: "<<adrs[top].x;   
             cout<<"\nPresent TOP y: "<<adrs[top].y;
             
             
              
            if(adrs[top].x <r-1)
              {
               nx = adrs[top].x+2;
               ny = adrs[top].y;
               ox = adrs[top].x; 
               oy = adrs[top].y; 
               
        
               cout<<"\nFuture New: "<<nx<<ny;
               cout<<"\n\n";
                              
               if(top!=0)
            {
             if(nx==adrs[top-1].x && ny==adrs[top-1].y)   
               continue;                   
             else
               {
                if( a[nx][ny] !=1)
                  {
                    cout<<"\nOld: "<<ox<<oy;
                    cout<<"\nNew: "<<nx<<ny;
                    cout<<"Moved";
                    cout<<"\n\n";
               
                    top++;
                    adrs[top].x = nx;
                    adrs[top].y = ny;
                    a[nx][ny]=1;
                     a[nx-1][ny]=1;
                     bx=nx-1;
                     by=ny;
                    //setcolor(BLACK);
                   // line( 25+25*oy,50+25*ox,50+25*oy,50+25*ox ); 
                    coord_cal(bx,by);     // panting the red brick -> white
                    // return; // return back to direction specifier.
                  }
                else
                  {count++;
                      if(count==5)
                          { count=0;--top; } }   //return; // return back to direction specifier
               }
            }
          else
          {
           top++;
           adrs[top].x = nx;
           adrs[top].y = ny;
           a[nx][ny]=1;
           a[nx-1][ny]=1;
           bx=nx-1;
                     by=ny;
                    coord_cal(bx,by); 
       
       //    setcolor(BLACK);
         //  line( 25+25*oy,50+25*ox,50+25*oy,50+25*ox );
          }
          
}
     break;
     
case 4:            //left
           
            cout<<"\n\nPresent TOP: "<<top;
            cout<<"\nPresent TOP x: "<<adrs[top].x;   
            cout<<"\nPresent TOP y: "<<adrs[top].y;
            
            if(adrs[top].y >0)
              {
               nx = adrs[top].x;
               ny = adrs[top].y-2;
               ox = adrs[top].x; 
               oy = adrs[top].y; 
               
               cout<<"\nFuture New: "<<nx<<ny<<endl;
                     
               if(nx==adrs[top-1].x && ny==adrs[top-1].y) 
                 continue;
               else 
               {
                if( a[nx][ny] !=1)
                    {
                     cout<<"\nOld: "<<ox<<oy;
                     cout<<"\nNew: "<<nx<<ny;
                     cout<<"Moved";
                     cout<<"\n\n";
                     
                     top++;
                     adrs[top].x = nx;
                     adrs[top].y = ny;
                     a[nx][ny]=1;
                     a[nx][ny+1]=1;
                     bx=nx;
                     by=ny+1;
                     //setcolor(BLACK);
                    // line( 50+25*ny,25+25*nx,50+25*ny,50+25*nx );      
                     coord_cal(bx,by);// panting the red brick -> white
                     //return; // return back to direction specifier.
                    }
                  else
                     {count++;
                      if(count==5)
                       {count=0; --top;} } 
               }
                     //return; // return back to direction specifier.
                  
}
          
          break;
           
}//END OF switch()
           
    for(int i=0;i<r;i+=2)
     for(int j=0; j<c; j+=2)
        {  if(a[i][j]==1)
              ender++;
         }
             
    if(ender==(R*C))
         break;
    
    
      
                   
     
     
     
}// while loop ends
   
   lining_sqb(r, c,a,ch);
 
 
  out_boundary(r,c,ch);
    play(a,r,c,ch);
    // while (!kbhit( ))
       // delay(750);   //getch();
        
  setfillstyle(SOLID_FILL,WHITE);
  floodfill(0,0,MAGENTA);
    }
}  // END OF main()
void main()
{
int gd=VGA,gm=VGAHI,errorcode,area,i,j,play=1,rndplay,rac,r,ch,chh,n=1,speed=151,sp=1,si=1,carx,cary,gear=0,aspeed,booster=100,drumx,drumy,drumv,drumx1,drumy1,spp,coin=200;
int life_=10;
int fire=20;
char info[4];
int soun;
char *buff;
char *fir;
char *boost;
int mouse=23;
int x,y,button;


char *tyre1;
float feul=100;
char *car1buf;
char *pcar4buf;
char *fcar5buf;

int recsize;
FILE *fp;
struct record
{
int coins;
int lifes;
float feuls;
int speeds;
int boosters;
int gear_;
int fire_;
}rec;

recsize=sizeof(rec);

initgraph(&gd,&gm,"c:\bagger");
errorcode = graphresult();
if (errorcode != grOk)
{
   printf("Graphics error: %s\n", grapherrormsg(errorcode));
   printf("Press any key to halt:");
   getch();

   exit(1);
}
fp=fopen("c:\\rruunn.r4l","r");
fread(&rec,recsize,1,fp);
coin=rec.coins;
feul=rec.feuls;
speed=rec.speeds;
booster=rec.boosters;
gear=rec.gear_;
fire=rec.fire_;
life_=rec.lifes;
fclose(fp);
remove("c:\\rruunn.r4l");

if(coin>0 && feul>0 && life_>0)
{

//geting car's image*****************************************

  setcolor(RED);
  settextstyle(8,1,4);
  outtextxy(100,100+60,"You have :  ");

  car(125,75);
  area=imagesize(85,15,165,405);
  buff=malloc(area);
  getimage(85,15,165,405,buff);
  putimage(85,15,buff,XOR_PUT);




setcolor(8);
setfillstyle(1,8);
bar((getmaxx()/2)-130,0,(getmaxx()/2)+130,getmaxy());
roadstru();
basicstructure1();
sean1();
gears(5);
speedgrp(151-speed);
feulgrp(100);
coingrp(200);
boostergrp(100);
firee(20);
lifee(10);
car(250,400);
setcolor(WHITE);
setfillstyle(1,WHITE);
for(i=-2000;i<+25000;i+=100)
bar((getmaxx()/2)-5,i,(getmaxx()/2)+5,i+80);

delay(1000);

setcolor(getbkcolor());
setfillstyle(1,getbkcolor());
for(i=1;i<320;i++)
{
bar(getmaxx()/2,0,(getmaxx()/2)-i,getmaxy());
bar(getmaxx()/2,0,(getmaxx()/2)+i,getmaxy());
delay(5);
}

delay(1000);



setcolor(YELLOW);
settextstyle(7,0,15);
outtextxy(100-20,100,"R");

settextstyle(7,0,15);
outtextxy(495-20,100,"E");

setcolor(LIGHTBLUE);
settextstyle(7,0,7);
outtextxy(198-20,130,"UN   LIF");

setcolor(BLUE);
setlinestyle(0,0,3);
line(275,155,385,155);
line(275-2,160,385-2,160);
line(275-4,165,385-4,165);
line(275-6,170,385-6,170);
line(275-8,175,385-8,175);
line(275-9,180,385-9,180);
line(275-10,185,385-10,185);
line(275-12,190,385-12,190);

setcolor(YELLOW);
settextstyle(10,0,7);
outtextxy(295,95,"4");


setcolor(LIGHTBLUE);
for(i=1;i<=465;i++)
{
line(80,228,80+i,228);
delay(5);
}
for(i=1;i<20;i++)
{
line(80,228+i,545,228+i);
delay(7);
}
delay(500);
setcolor(LIGHTRED);
settextstyle(8,0,5);
setusercharsize(2,1,1,2);
textdisp1(80,225,"Run For Life",RED,LIGHTRED);

setcolor(LIGHTRED);
settextstyle(8,0,6);
setusercharsize(2,1,1,1);
textdisp1(80,325,"Stage Clear !!!",LIGHTBLUE,BLUE);

delay(2000);
setcolor(getbkcolor());
setfillstyle(1,getbkcolor());
for(i=1;i<=getmaxx();i++)
{
bar(0,0,0+i,getmaxy());
delay(5);
}



for(i=1;i<450;i+=10)
{
putimage(50,getmaxy()-i,buff,XOR_PUT);
delay(5);
putimage(50,getmaxy()-i,buff,XOR_PUT);
}
putimage(50,getmaxy()-450,buff,XOR_PUT);

	setcolor(YELLOW);
	settextstyle(8,0,2);
	outtextxy(200,200,"Coin left : ");
	outtextxy(220,240,"Life left : ");
	outtextxy(200,280,"Fuel left : ");
	outtextxy(220,320,"Booster left : ");
	outtextxy(200,360,"Fire left : ");

	for(i=1;i<=coin;i++)
	{
	setcolor(getbkcolor());
	setfillstyle(1,getbkcolor());
	bar(350,200,400,250);
	setcolor(YELLOW);
	sprintf(info,"%d",i);
	outtextxy(350,200,info);
	sound(500);
	delay(50);
	nosound();
	}
	for(i=1;i<=life_;i++)
	{
	setcolor(getbkcolor());
	setfillstyle(1,getbkcolor());
	bar(400,240,450,290);
	setcolor(YELLOW);
	sprintf(info,"%d",i);
	outtextxy(400,240,info);
	sound(400);
	delay(50);
	nosound();
	}
	for(i=1;i<=feul;i++)
	{
	setcolor(getbkcolor());
	setfillstyle(1,getbkcolor());
	bar(350,280,400,330);
	setcolor(YELLOW);
	sprintf(info,"%d",i);
	outtextxy(350,280,info);
	sound(500);
	delay(50);
	nosound();
	}
	for(i=1;i<=booster;i++)
	{
	setcolor(getbkcolor());
	setfillstyle(1,getbkcolor());
	bar(400,320,450,370);
	setcolor(YELLOW);
	sprintf(info,"%d",i);
	outtextxy(400,320,info);
	sound(400);
	delay(50);
	nosound();
	}
	for(i=1;i<=fire;i++)
	{
	setcolor(getbkcolor());
	setfillstyle(1,getbkcolor());
	bar(350,360,400,410);
	setcolor(YELLOW);
	sprintf(info,"%d",i);
	outtextxy(350,360,info);
	sound(500);
	delay(50);
	nosound();
	}
	setcolor(LIGHTBLUE);
	setfillstyle(1,LIGHTBLUE);
	for(i=1;i<400;i++)
	{
	bar(200,50,200+i,150);
	delay(2);
	}
	setcolor(YELLOW);
	rectangle(200,50,600,150);
	setcolor(LIGHTRED);
	rectangle(200+5,50+5,600-5,150-5);
	setcolor(RED);
	settextstyle(3,0,3);
	textdisp(220,60,"Do u accept the next challange");
	setcolor(LIGHTRED);
	rectangle(215,110,400,135);
	rectangle(410,110,585,135);
	setcolor(RED);
	rectangle(215+2,110+2,400-2,135-2);
	rectangle(410+2,110+2,585-2,135-2);
	settextstyle(8,0,1);
	outtextxy(235,106,"Yes, I accept !!!");
	outtextxy(435,106,"No, I Quit");

	change(c);
	show();

	while(mouse==23)
	{
	show();
	moupos(&button,&x,&y);
	if((button & 1)==1)
	{
	if(x>410 && x<585 && y>110 && y<135)
	{
	setcolor(getbkcolor());
	setfillstyle(1,getbkcolor());
	for(i=1;i<=getmaxx();i++)
	{
	bar(0,0,0+i,getmaxy());
	delay(5);
	}
	hide();
	//one step here
	setcolor(RED);
	settextstyle(4,0,8);
	outtextxy(180,200,"Looser !!!");
	coin=0;
	feul=0;
	speed=0;
	booster=0;
	gear=0;
	fire=0;
	life_=0;
	mouse=0;
	delay(1000);
	//************************************************************************
setfillstyle(8,WHITE);            //background color and style
bar(1,1,getmaxx(),getmaxy());

setfillstyle(7,YELLOW);      //bagger plate
bar(150,5,500,55);

setcolor(BLUE);
for(i=1;i<=5;i++)
{                          //border of bagger plate
setfillstyle(1,BLUE);
rectangle(150-i,5-i,500+i,55+i);
}

settextstyle(1,0,5);
setcolor(WHITE);          // the bagger writen
outtextxy(200,3,"Run 4 Life");


setcolor(WHITE);          //work place designed
setfillstyle(1,WHITE);
bar(100,100,550,350);


setcolor(BLUE);
for(i=1;i<=5;i++)
{                           //work place border
rectangle(100-i,100-i,550+i,350+i);
}


setcolor(getbkcolor());                 //man's face
ellipse(300,190,0,360,35,40);

setfillstyle(1,getbkcolor());        //man's hat
for(i=1;i<=33;i++)
{
arc(300,172,0,180,i);
}


for(i=1;i<=12;i+=2)
{
 setlinestyle(0,0,0);                    //his hair
 arc(322-i,195,150,200,50);
}
for(i=1;i<=10;i+=5)                    //his hair
{
 setlinestyle(0,0,3);
 arc(322-i,195,150,200,50);
}


for(i=1;i<=12;i+=2)
{
 setlinestyle(0,0,0);                    //his hair
 arc(277+i,195,338,30,50);
}
for(i=1;i<=10;i+=5)                    //his hair
{
 setlinestyle(0,0,3);
  arc(277+i,195,338,30,50);
}

fillellipse(285,185,18,10);   //his eye masks
fillellipse(315,185,18,10);

setcolor(WHITE);           //his eye
setfillstyle(1,WHITE);
fillellipse(285,185,5,1);
fillellipse(315,185,5,1);

setcolor(getbkcolor());
setfillstyle(1,getbkcolor());
fillellipse(285,185,1,1);    //his eye ball
fillellipse(315,185,1,1);

 setlinestyle(0,0,0);   //his nose
line(295,192,292,205);
line(302,192,304,205);
line(292,205,304,205);

for(i=1;i<6;i+=1)             //his mooch
arc(300,232,60,120,20+i);

 setlinestyle(0,0,3);
line(288,210,280,225);       //his mooch
line(311,210,318,225);

setlinestyle(0,0,0);
arc(300,205,230,310,12);     //his mouth
arc(300,227,60,120,13);

setlinestyle(0,0,3);
for(i=1;i<=10;i+=4)         //his dadhi
line(295+i,220,295+i,230);



setlinestyle(0,0,0);
line(285,227,285,240);  //his neck
line(315,227,315,240);

setlinestyle(0,0,3);
line(285,240,235,249);    //his  coat base and right hand
line(315,240,342,249);
line(230,255,250,320);
arc(237,255,90,180,6);
line(250,320,340,310);
line(270,270,275,290);
line(275,290,330,285);
setlinestyle(0,0,3);
line(330,285,340,310);
line(325,285,335,310);
setlinestyle(0,0,0);


setlinestyle(0,0,0);
arc(340,330,70,100,40);
arc(340,335,70,90,40);
arc(340,340,70,90,40);     //his finger
arc(340,345,70,90,40);
arc(340,350,70,90,40);
arc(315,305,350,20,40);
setlinestyle(0,0,3);

line(342,200,342,290);
line(365,200,350,290);
arc(355,232,71,110,35); //his stick
line(342,310,340,320);
line(347,310,349,320);
line(340,320,349,320);

line(285,240,320,250);//his left hand
line(315,240,305,245);
line(320,250,323,285);
circle(310,260,2);
circle(311,270,2);
circle(312,280,2);
line(356,252,360,253);
line(360,253,365,328);
line(330,270,333,290);
line(365,328,280,318);


setcolor(getbkcolor());
setlinestyle(0,0,3);
delay(1000);
for(j=1;j<=250;j++)
{
for(i=1;i<450;i+=30)
{
line(100+i,100,100+i,100+j);
line(103+i,100,103+i,100+j);
}
delay(5);
}
delay(1000);
setcolor(BLUE);
settextstyle(10,0,3);
outtextxy(200,200,"Arrested");
rectangle(190,210,390,250);
delay(1500);
setcolor(getbkcolor());
setlinestyle(0,0,3);
for(i=1;i<=450;i++)
{
line(100,220,100+i,220);
delay(5);
}
for(i=1;i<120;i++)
{
line(100,220-i,550,220-i);
line(100,220+i,550,220+i);
delay(20);
}
setcolor(getbkcolor());
setfillstyle(1,getbkcolor());
bar(100,340,550,350);
settextstyle(8,0,5);
setcolor(RED);
textdisp(150,200,"You Loose");

delay(1000);
setcolor(getbkcolor());
setfillstyle(1,getbkcolor());
for(i=1;i<350;i++)
{
bar(getmaxx()/2,0,(getmaxx()/2)-i,getmaxy());
bar(getmaxx()/2,0,(getmaxx()/2)+i,getmaxy());
delay(5);
}
	//**************************************************************************
	}
	else if(x>215 && x<400 && y>110 && y<135)
	{
	setcolor(getbkcolor());
	setfillstyle(1,getbkcolor());
	for(i=1;i<=getmaxx();i++)
	{
	bar(0,0,0+i,getmaxy());
	delay(5);
	}
	hide();
	setcolor(LIGHTGREEN);
	settextstyle(4,0,8);
	outtextxy(180,200,"Bravo !!!");
	mouse=0;
	}
	}
	}

}
//*********************************************************************************************
rec.coins=coin;
rec.feuls=feul;
rec.speeds=speed;
rec.gear_=gear;
rec.lifes=life_;
rec.fire_=fire;
rec.boosters=booster;
fp=fopen("c:\\rruunn.r4l","w");
fwrite(&rec,recsize,1,fp);
fclose(fp);
//closegraph();
delay(1500);
}
Example #22
0
void image()
{int i;
 randomize();
 settextstyle(1,HORIZ_DIR,9);
 for (i=-250;i<10;i+=5)
 {setcolor(BLACK);
  outtextxy(i-5,0,*Title);// "Hyper"
  setcolor(LIGHTBLUE);
  outtextxy(i,0,*Title);// "Hyper"
  Delay(1);
 }
 Delay(300);
 setcolor(LIGHTRED);
 settextstyle(3,HORIZ_DIR,16);
 for (i=1;i<7;i++)
 {outtextxy(210+i*60,60,*(Title+i));// "Reader"
  Delay(400);
 }
 Delay(100);
 for (i=1;i<7;i++)
 {settextstyle(4,0,i);
  setcolor(LIGHTCYAN);
  outtextxy(450,190,*(Title+7));// "2000"
  Delay(300);
  setcolor(BLACK);
  settextstyle(4,HORIZ_DIR,i);
  outtextxy(450,190,*(Title+7));// "2000"
 }
 setcolor(LIGHTCYAN);
 settextstyle(4,HORIZ_DIR,i);
 outtextxy(450,190,*(Title+7));// "2000"
 Delay(400);
 setcolor(BLUE);
 line(10,140,250,140);
 line(250,140,250,200);
 line(250,200,400,200);
 line(400,200,400,280);
 line(400,280,600,280);
 Delay(800);
 setcolor(LIGHTGREEN);
 settextstyle(2,0,7);
 outtextxy(20,200,*(Title+8));// "Produced by Zhao Chang."
 Delay(500);
 outtextxy(40,225,*(Title+9));// "Copyright (C)  2000"
 Delay(500);
 outtextxy(37,250,*(Title+10));// "ALL RIGHTS RESERVED."
 Delay(500);
 setcolor(LIGHTMAGENTA);
 settextstyle(1,0,2);
 outtextxy(340,350,*(Title+11));// "Press any key . . ."
 setcolor(WHITE);
 settextstyle(2,0,5);
 outtextxy(142,450,"Version");
 outtextxy(205,450,Version);
 outtextxy(377,450,"Update:");
 outtextxy(435,450,Update);
 people();
 book();
 Delay(2000);
 ClearKey();
 while (!kbhit())
 {ChangeColor();
  book();
  people();
  delaykey(30);
 }
 getch();
 restorecrtmode();
}
Example #23
0
/*This function is supposed to bridge time delays. Since there are none in this program, a time delay is created to implement this functionality.*/
void Load()
{ cleardevice();
 int i,j,k,l,cur,p;
 float p1;
  char percent[5];

 setcolor(7);
 setfillstyle(SOLID_FILL,BLUE);
 rectangle(10,BLUE,635,470);
 floodfill(15,60,WHITE);
 setcolor(9);
 setfillstyle(1,WHITE);
 rectangle(212,165,387,315);
 floodfill(200,200,9);
 char title[13];
 strcpy(title,"CONNECT FOUR");
 setcolor(RED);
 settextstyle(TRIPLEX_FONT,0,6);
 outtextxy(160,60,title);
 for(i=0;i<7;i++)
 for(j=0;j<6;j++)
 {setcolor(WHITE);
 setfillstyle(1,WHITE);
 setcolor(RED);
 settextstyle(TRIPLEX_FONT,0,4);
 outtextxy(203,333,"Loading");
 setfillstyle(1,RED);
 fillellipse(325,360,3,3);
  fillellipse(334,360,3,3);
   fillellipse(343,360,3,3);
 setcolor(WHITE);
 setfillstyle(1,WHITE);
 fillellipse((i+1)*25+198,(j)*25+178,ray/2,ray/2);}
 for(i=0;i<7;i++)
 {for(j=0;j<6;j++)
	{if((i+j)%2==0)
		//drawround(i,j,ray,4);
		{setcolor(4);
 setfillstyle(1,4);
 fillellipse((i+1)*25+198,(j)*25+178,ray/2,ray/2);}
	else
		//drawround(i,j,ray,6);
	       {	setcolor(6);
 setfillstyle(1,6);
 fillellipse((i+1)*25+198,(j)*25+178,ray/2,ray/2);}
 p1=(100*(i+1))/7;
 p=p1;
 itoa(p,percent,10);
 strcat(percent,"%");
}
 delay(100);
 setcolor(RED);
 outtextxy(230,363,percent);
 if(i!=6)
  {delay(150);
 setcolor(WHITE);
 outtextxy(230,363,percent);}}
 settextstyle(1,0,2);
 outtextxy(230,403,"Press any key to continue to game");
 getch();
}
void main()
{
int style,size=5,midx=100,midy=100,fname;
int gd=DETECT,gm;
initgraph(&gd,&gm,"C:\\TC\\bgi");


  settextstyle(GOTHIC_FONT, HORIZ_DIR, size+3);

   /* output a message */


   outtextxy(midx, midy+60,"AN APPLE");




    delay(200);
    getch();

  cleardevice();
   setcolor(BLUE);
   /* select the text style */
   settextstyle(GOTHIC_FONT, HORIZ_DIR, size);

   /* output a message */
   setbkcolor(WHITE);

   outtextxy(midx, midy,"Once upon a time,");
     outtextxy(midx, 150,"mr.issac newton was ");
   outtextxy(midx, midy+100,"sitting under the tree");
   outtextxy(midx, midy+150,"and then .");
   delay(700);
   outtextxy(midx, midy+150,"         .");
     delay(700);
   outtextxy(midx, midy+150,"          .");
     delay(700);
   outtextxy(midx, midy+150,"           .");
     delay(700);
   outtextxy(midx, midy+150,"            .");
     delay(700);
   outtextxy(midx, midy+150,"             .");
     delay(700);
   outtextxy(midx, midy+150,"              .");
     delay(700);
   outtextxy(midx, midy+150,"               .");
     delay(700);
   outtextxy(midx, midy+150,"                .");
//zzz
cleardevice();

line(0,450,640,450);  //ground
circle(180,180,100);  //tree circle
{

//setfillstyle(1,GREEN);
//floodfill(181,250,15);
}
line(150,275,140,450);
line(210,275,220,450); //tree base
{

//setfillstyle(1,BROWN);
//floodfill(200,300,15);
}
circle(230,380,10); //man face
line(230,390,260,450); //body
line(260,450,290,420);  //leg
line(290,420,310,450);  //leg
line(235,400,260,420);  //hand_1
line(235,400,233,430);  //hand_2
line(260,420,280,420);  //hand_1
line(233,430,241,450);  //hand_2

delay(1000);
settextstyle(1,HORIZ_DIR,1);
outtextxy(260,330,"z");
delay(1000);
settextstyle(1,HORIZ_DIR,2);
outtextxy(280,310,"z");
delay(1000);
settextstyle(1,HORIZ_DIR,3);
outtextxy(300,290,"z");
delay(1000);
settextstyle(1,HORIZ_DIR,4);
outtextxy(320,270,"z");
delay(1000);
settextstyle(1,HORIZ_DIR,5);
outtextxy(340,250,"z");

getch();
cleardevice();
//tree

clrscr();
int x=230,y=366;
int k=15,l=1;


for(int i=0;i<=200;i++)
{
cleardevice();


line(0,450,640,450);  //ground
circle(180,180,100);  //tree circle
{

//setfillstyle(1,GREEN);
//floodfill(181,250,15);
}
circle(230,166+i,4);  //apple
line(150,275,140,450);
line(210,275,220,450); //tree base
{

//setfillstyle(1,BROWN);
//floodfill(200,300,15);
}
circle(230,380,10); //man face
line(230,390,260,450); //body
line(260,450,290,420);  //leg
line(290,420,310,450);  //leg
line(235,400,260,420);  //hand_1
line(235,400,233,430);  //hand_2
line(260,420,280,420);  //hand_1
line(233,430,241,450);  //hand_2

 }
 delay(10);
 for(int j=0;j<=11;j++)
 {
 cleardevice();
 if((j==0) || (j==11))
{
 sound(1200);
 {
 delay(100);
 }}
 nosound();
 x=x+k;
 y=y+l;
 circle(x,y,4);//apple
 k=k-1;
 l=l+1;
line(0,450,640,450);  //ground
circle(180,180,100);  //tree circle
{

//setfillstyle(1,GREEN);
//floodfill(181,250,15);
}
line(150,275,140,450);
line(210,275,220,450); //tree base
{

//setfillstyle(1,BROWN);
//floodfill(200,300,15);
}
circle(230,380,10); //man face
line(230,390,260,450); //body
line(260,450,290,420);  //leg
line(290,420,310,450);  //leg
line(235,400,260,420);  //hand_1
line(235,400,233,430);  //hand_2
line(260,420,280,420);  //hand_1
line(233,430,241,450);  //hand_2
if(y==450)
{
break;
}
 delay(80);
 }
getch();
cleardevice();
//newvish
int x4=225,y4=185;

for(int p=0;p<=60;p++)
{

 cleardevice();
 j=j+1;
 circle(x4+25+p,y4-15+j,30);
line(0,440,640,440);//final line
line(x4+p,y4+j,150,310); //main body line
line(150,310,170,340);//right thighs
line(170,340,170,440);//right legs
line(150,310,130,440);//left leg
line(185+p,250+11,220+p,300+j);//elbow
line(220+p,300+j,260+p,320+j);//hand
circle(320,430,10);
delay(80);
}
getch();
cleardevice();
settextstyle(1, 0, 1);
//vishmod
circle(250,130,30);//face

line(250,160,250,310);
line(250,310,230,440);
line(250,310,280,440);
line(250,210,300,240);
line(300,240,335,230);
circle(335,220,10);//apple
//setfillstyle(SOLID_FILL, RED) ;
//floodfill(335,220, RED);
line(0,440,640,440);
delay(1000);
ellipse(450, 100, 205, 194, 120, 70);//thinking
line(332, 115, 290, 130);
line(343, 130, 290, 130);
delay(1500);
settextstyle(2, 0, 5);
outtextxy(350, 80, "Why this apple fall down??") ;
delay(1500);
outtextxy(350, 92, "Why it didnt went") ;
delay(1500);
outtextxy(350, 104, "up in the sky???") ;
delay(1500);
getch();
cleardevice();
//sitting
circle(200, 150, 30);//face
line(175, 165, 130, 270);  //body
line(130, 270, 200, 225);//thighs
line(200, 225, 200, 320);//legs
line(170, 175, 185, 230);//upper hand
line(185, 230, 210, 170);//lower hand
arc(140, 330, 0, 180, 60); //rock arc
line(80, 330, 80, 370);//rock left
line(200, 330,200, 370);//rock right
line(0, 370, 640, 370);//ground
delay(1800);
circle(240, 145, 2);//one
delay(1300);
circle(250, 140, 5);//two
delay(1300);
circle(270, 130, 10);//three
delay(1300);
ellipse(405, 80, 0, 360, 140, 75);//thinking
settextstyle(2, 0, 5);
outtextxy(290, 35, "The apple must have fallen") ;
delay(1500);
outtextxy(290, 50, "on the earth due to some") ;
delay(1500);
outtextxy(290, 65, "kind of force which") ;
delay(1500);
outtextxy(290, 80,"pulled it downward...") ;
delay(1500);
outtextxy(290, 95, "Lets name that mysterious");
delay(1500);
outtextxy(305, 110, "force as GRAVITY....");


getch();
cleardevice();
//public
circle(100, 140, 20);//face
line(100,160, 100, 270);//body
line(100, 270, 80, 340);//leg
line(100, 270,120, 340);//leg
line(100, 180, 130, 210);//hand
line(130, 210, 150, 180);//hand
circle(155,175, 5);//palm
line(157,170, 165, 162);//finger
line(100, 180, 80, 210);//back hand
line(80, 210, 95, 230);//back hand
line(10, 340, 10, 450);//stage
line(10, 340, 150, 340);//stage
line(150, 340, 150, 450);//stage
line(0, 450, 640, 450);//ground
// setfillstyle(SOLID_FILL, RED);
//floodfill(20, 350, RED);
//speech
ellipse(250, 70, 220, 210, 140, 66);
line(130, 102, 115, 120);
line(143, 112, 115, 120);
settextstyle(2, 0, 5);
outtextxy(145, 22, "THE ACCELARATION OF THE ");
outtextxy(135,40, "FALLING OBJECT IS DIRECTLY");
outtextxy(135, 58, "PROPORTIONAL TO THE HEIGHT OF");
outtextxy(135, 76, "THE OBJECT FROM THE");
outtextxy(138, 94, "CENTER OF THE EARTH...");
//publics   one
circle(250,270, 20);//face
line(250, 290, 250,380);//body
line(250, 380, 230, 450);//legs
line(250, 380, 270, 450);//legs
line(250, 300, 230, 340);//arms
line(250, 300, 270,340);//arms



//public 2
circle(300,270, 20);//face
line(300, 290, 300,380);//body
line(300, 380, 280, 450);//legs
line(300, 380, 320, 450);//legs
line(300, 300, 280, 340);//arms
line(300, 300, 320,340);//arms
//public 3
circle(350,270, 20);//face
line(350, 290, 350,380);//body
line(350, 380, 330, 450);//legs
line(350, 380, 370, 450);//legs
line(350, 300, 330, 340);//arms
line(350, 300, 370,340);//arms
//public 4
circle(400,270, 20);//face
line(400, 290, 400,380);//body
line(400, 380, 380, 450);//legs
line(400, 380, 420, 450);//legs
line(400, 300, 380, 340);//arms
line(400, 300, 420,340);//arms

//public 5
circle(450,270, 20);//face
line(450, 290, 450,380);//body
line(450, 380, 430, 450);//legs
line(450, 380, 470, 450);//legs
line(450, 300, 430, 340);//arms
line(450, 300, 470,340);//arms
getch();
cleardevice();
//helicopter
for(i=500;i>=-160;i--)
{
sound(300);
{
delay(10);
}
nosound();
arc(200+i, 250,90, 270, 40);//forward
line(200+i, 210, 250+i, 210);//top
line(200+i, 290, 250+i, 290);//down
arc(250+i, 250, 270, 90, 40);//back
line(220+i, 210, 225+i, 200);//fan
line(230+i, 210, 225+i, 200);//fan
ellipse(225+i,195, 0, 360, 60, 5);//fanmain
line(210+i, 290, 200+i, 310);//base
line(240+i, 290, 250+i, 310);//base
line(190+i, 310, 260+i, 310);//base
line(200+i,250, 200+i, 225);//window
line(200+i, 250, 175+i, 250);//window
arc(200+i, 250, 90, 180, 25);//window
line(370+i, 250,285+i,230);
line(370+i, 250, 285+i, 270);
circle(370+i, 250, 20);//fan
rectangle(420+i, 190, 770+i,310);//banner
line(420+i, 190, 370+i, 250);//rope1
line(420+i, 310, 370+i, 250);//rope2
setcolor(i);
textbackground(i);
settextstyle(1,0, 1);
outtextxy(270+160+i, 200,"The natural force of attraction");
outtextxy(270+160+i, 215,"exerted by, a celestial body");
outtextxy(270+160+i, 230,"such as Earth, upon objects at");
outtextxy(270+160+i, 245,"or near its surface ending to");
outtextxy(270+160+i, 260,"draw them toward the center of");
outtextxy(270+160+i, 275,"the body is called GRAVITY");
delay(7);
cleardevice();
}
setcolor(RED);
arc(200-160, 250,90, 270, 40);//forward
line(200-160, 210, 250-160, 210);//top
line(200-160, 290, 250-160, 290);//down
arc(250-160, 250, 270, 90, 40);//back
line(220-160, 210, 225-160, 200);//fan
line(230-160, 210, 225-160, 200);//fan
ellipse(225-160,195, 0, 360, 60, 5);//fanmain
line(210-160, 290, 200-160, 310);//base
line(240-160, 290, 250-160, 310);//base
line(190-160, 310, 260-160, 310);//base
line(200-160, 250, 200-160, 225);//window
line(200-160, 250, 175-160, 250);//window
arc(200-160, 250, 90, 180, 25);//window
line(370-160, 250, 285-160,230);
line(370-160, 250, 285-160, 270);
circle(370-160, 250, 20);//fan
rectangle(420-160, 190, 770-160,310);//banner
line(420-160, 190, 370-160, 250);//rope1
line(420-160, 310, 370-160, 250);//rope2
setcolor(MAGENTA);
settextstyle(1,0, 1);
outtextxy(270, 200,"The natural force of attraction");
outtextxy(270, 215,"exerted by, a celestial body");
outtextxy(270, 230,"such as Earth, upon objects at");
outtextxy(270, 245,"or near its surface ending to");
outtextxy(270, 260,"draw them toward the center of");
outtextxy(270, 275,"the body is called GRAVITY");

   /* CREDITS */

   getch();
    cleardevice();

   /* select the text style */


   /* output a message */
   settextstyle(GOTHIC_FONT, HORIZ_DIR, size+3);
   outtextxy(midx, midy-100,"Credits");
   settextstyle(GOTHIC_FONT, HORIZ_DIR, size-2);
    delay(700);
     outtextxy(midx, 150,"Niraj Chauhan ");
    delay(700);
   outtextxy(midx, midy+100,"Suresh Das");
    delay(700);
   outtextxy(midx, midy+150,"Pranav Purandare");

   delay(700);
   outtextxy(midx, midy+200,"Nikhil Ratate");
     delay(700);
   outtextxy(midx, midy+250,"Pankaj Suthar");
     delay(700);
   outtextxy(midx, midy+300,"Vishal Tandon");
     delay(700);
  getch();
closegraph();

}
Example #25
0
/* keyboard of lesson screen */
void keyboard_lesson(void)
{

	int z,i,j;
	setfillstyle(1,7);
	bar(60,303,532,435);
	keyboard_but(60,305,532,435,0);

	settextstyle(0,0,1);
	keyboard_but(75,315,106,330,0);//ESC button
	color_text(78,318,"Esc",8);

	for(z=126;z<490;z+=33)
		keyboard_but(z,315,z+28,330,0); //DRAWING BUTTONS 4 1ST ROW (FUNCTION KEYS)

	for(i=130,j=0;i<500;i+=33,j++)
		color_text(i,318,str0[j],8); //to write char in first row

	for(z=75;z<460;z+=29)
		keyboard_but(z,340,z+25,355,0);    //Keep the keyboard button  of 2nd row up

	for(i=85,j=0;i<490;i+=29,j++){
		if(j>10)
			color_text(i-5,346,str1[j],8);
		else
			color_text(i,343,str1[j],8);  //to write char in 2nd row
	}
	outtextxy(404,337,"_");
	outtextxy(436,343,"+");
	outtextxy(466,343,"|");

	keyboard_but(481,340,516,355,0);   // BACKSPACE
	color_text(491,343,"<-",8);

	keyboard_but(75,358,106,373,0);  //  tab
	color_text(80,359,"<-",8);
	color_text(83,365,"->",8);

	outtextxy(85,349,"~");
	outtextxy(360,397,"<");
	outtextxy(390,397,">");
	outtextxy(418,397,"?");

	for(z=110;z<460;z+=30)
		keyboard_but(z,358,z+26,373,0);   //Keep the keyboard button  of 3rd row up

	for(i=120,j=0;i<460;i+=30,j++){
		if(j>9)
			color_text(i+5,363,str2[j],8);
		else
			color_text(i,361,str2[j],8);  //to write char in 3rd row
	}
	outtextxy(416,361,"{");
	outtextxy(446,361,"}");

	for(z=119;z<440;z+=30)
		keyboard_but(z,376,z+26,391,0);   //Keep the keyboard button  of 4th row up

	for(i=129,j=0;i<460;i+=30,j++)
	{
		settextstyle(0,0,1);         //to write char in 4th row
		if(j==9)
			color_text(i+5,381,str3[j],8);
		else if(j==10)
			color_text(i+6,385,str3[j],8);
		else
			color_text(i,379,str3[j],8);
	}
	outtextxy(393,379,":");
	outtextxy(426,379,"\"");

	for(z=143;z<420;z+=30)
		keyboard_but(z,394,z+26,409,0);    //Keep the keyboard button  of 5th row up

	for(i=153,j=0;i<450;i+=30,j++)
	{
		settextstyle(0,0,1);

		if(j>6)
			color_text(i+4,399,str4[j],8);

		else
			color_text(i,397,str4[j],8); //to write char in 5th row


	}

	keyboard_but(165,412,396,427,0); //space
	keyboard_but(448,376,516,391,0);
	keyboard_but(470,358,516,373,0);  //enter
	setcolor(7);
	line(470,373,515,373);
	line(470,374,515,374);
	line(470,375,515,375);
	line(471,376,515,376);

	keyboard_but(75,376,115,391,0); // CAPS LOCK BUTTON
	settextstyle(2,0,4);
	color_text(79,377,"C.Lock",8);

	keyboard_but(75,394,139,409,0);          //l-shift
	outtextxy(82,393,"^");
	outtextxy(450,393,"^");   //pin-point of shift button
	line(451,400,451,405);   // 434these 4 lines make the long sticky portion of shift-button
	line(453,400,453,405);
	line(451,405,453,405);
	line(83,400,83,405);
	line(85,400,85,405);
	line(83,405,85,405);
	settextstyle(2,0,4);
	setcolor(8);
	outtextxy(85,395," Shift"); // left shift


	keyboard_but(443,394,516,409,0);         //r-shift
	outtextxy(458,395," Shift");

	/*ctrl,window,alt*/
	for(i=75;i<136;i+=30)
		 keyboard_but(i,412,i+26,427,0);

	settextstyle(2,0,4);
	outtextxy(78,413,"Ctrl");
	outtextxy(141,413,"Alt");

	/*LEFT- window button*/
	rectangle(117,415,127,424);
	line(122,415,122,424);
	line(117,419,127,419);
	for(i=415;i<424;i+=2)
		for(z=115;z>107;z-=2)
			putpixel(z,i,8);


	/*ctrl,alt,window,task*/
	for(i=400;i<500;i+=30)
		 keyboard_but(i,412,i+26,427,0);

	/* RIGHT- window button*/
	rectangle(442,415,452,424);
	line(447,415,447,424);
	line(442,419,452,419);
	for(i=415;i<424;i+=2)
		for(z=440;z>433;z-=2)
			putpixel(z,i,8);

	settextstyle(2,0,4);
	outtextxy(405,413,"Alt");
	outtextxy(492,413,"Ctrl");
	rectangle(467,415,477,424);
	for(i=417;i<422;i+=2)
		  line(470,i,474,i);
}
Example #26
0
void login()
{
	struct login log;
	int gd,gm,x=60,y=8,p=155,q=35;
	int i,a=190,bo=50,d=90,c=75;
	int left, top, right, bottom;
       //	int points[]={620,150,620,400,20,400,320,150};
	int l,t,r,b;
       /*	int counter=0,flag=0;
	char uid[25],pwd[25],s_uid[][25]={"9913103538"};
       char s_pwd[][25]={"qwerty"},ch='a',bb[5],inst[5];
       //	int pa;
       //	char arr[20]={"abc"};
	int j=0;                                        */
	int j,counter=0,flag=0;
	char uid[25],pwd[25],abc[10],s_uid[][25]={"9913103563"},inst[5];
	char s_pwd[][25]={"qwerty"},ch='a',bb[5];

	char ch4;
	gd=DETECT;
	initgraph(&gd,&gm,"c:\\turboc3\\bgi");
	{
	delay(500);

	setcolor(YELLOW);
	settextstyle(1,HORIZ_DIR,4);
       outtextxy(a,bo,"JAYPEE INSTITUTE");
      settextstyle(1,HORIZ_DIR,4);
      outtextxy(c,d," OF INFORMATION TECHNOLOGY");
      settextstyle(8,0,3);
      outtextxy(200,130,"SECTOR-128,NOIDA");
      setcolor(CYAN);
       settextstyle(1,0,4);
      outtextxy(232,170,"INFO-KIOSK");


	for(i=0;i<=360;i++)
	{
		circle(300,330,8);
		if(i<=90)
		continue;
		else if(i>90&&i<=180)
		{
		setcolor(CYAN);

		}
		else if(i>180&&i<=270)
		{
		setcolor(YELLOW);

		}
		else
		{
		setcolor(RED);
		}
		pieslice(300,330,0,i,80);
		settextstyle(3,0,2);
		outtextxy(215,410,"Loading....please Wait");
		delay(10);
	}
	closegraph();
	}
	initgraph(&gd,&gm,"c:\\turboc3\\bgi" );
	left = getmaxy() / 1 - 500 ;
top = getmaxy() / 2 - 1000;
right = getmaxx() / 2 + 500;
bottom = getmaxy() / 2-180;
setfillstyle(1,6);
rectangle(top,left,right,bottom);
floodfill(getmaxx()/3,getmaxy()/100,15);
       settextstyle(3,0,3);
       outtextxy(x,y,"JAYPEE INSTITUTE OF INFORMATION TECHNOLOGY");
       settextstyle(3,0,1);
       outtextxy(p,q,"Deemed to be University under section 3 of UCG Act");
     //	int gd=DETECT,gm,
	delay(500);
	     //	initgraph(&gd,&gm,"C:\\turboc3\\bgi");
l = getmaxy() / 1 - 350 ;
t = getmaxy() / 2 - 240;
r = getmaxx() / 2 + 340;
b = getmaxy() / 1-60;
setfillstyle(1,6);
rectangle(t,l,r,b);
floodfill(getmaxx()/2,getmaxy()/2,15);
setcolor(BLACK);
settextstyle(1,0,9);
outtextxy(15,140,"LOGIN");
settextstyle(1,0,9);
outtextxy(22,240,"PAGE");


//fseek(fl,0,SEEK_END);
gotoxy(45,13);
printf("Institue:");
fflush(stdin);
gets(inst);
gotoxy(45,15);
printf("User-Id:");
fflush(stdin);
gets(uid);
gotoxy(45,17);
printf("Batch:");
fflush(stdin);
gets(bb);
gotoxy(45,19);
printf("Password:"******"\b");  /*printing backspace to move cursor 1 pos back*/
			printf("%c",32);/*making the char invisible which is already on console*/
			printf("\b"); /*printing backspace to move cursor 1 pos back*/
			i--;
			pwd[j]='\0';
		}
		else
		continue;
	}
	else
	{
	putchar('*');/* char - '*' will be printed instead of the character */
	pwd[j]=ch;
	j++;
	}
}
pwd[j]='\0';
for(j=0;j<=2;j++)
{
	if((strcmp(pwd,s_pwd[j])==0) && (stricmp(uid,s_uid[j]))==0)
	{
		flag=1;
		break;
	}
}
if(flag)
{gotoxy(45,21);
printf(" USER AUTHENTICATED ");
}
else
{
gotoxy(45,21);
printf("DENIED");
getch();
exit(0);
}
	getch();
	closegraph();
}
Example #27
0
int continue_close(int min, int sec, int eff, int err, int speed)
{
	unsigned int sum;
	void* summary;
	int x,y,j=-2,pr=-1,i;

    //	sum=imagesize(200,90,380,250);
	sum=imagesize(170,90,410,250);
	summary= malloc(sum);
	getimage(170,90,410,250,summary);

	show_summary(min,sec,eff,err,speed);
	draw_3dbox(210,220,280,240,15);
	draw_3dbox(305,220,370,240,15);
	settextstyle(0,0,1);
	color_text(214,227,"Continue",3);
	color_text(317,227,"Close",3);
	showMouse();
	while(1)
	{
		while(1)
		{
			x=getMouseX(); /* get the mouse position*/
			y=getMouseY();
			for(i=0;i<2;i++)
			{
				if(x>=210+(i*95)&&x<=280+(i*90)&&y>=220&&y<=240 )
				{
					j=i;     /* check the position*/
					break;
				}
			}
			settextstyle(0,0,1);
			if(j>=0&&j<2&& j!=pr)
			{
				hideMouse();
				draw_3dbox(210+(j*95),220,280+(j*90),240,6);	/* change the color of the box*/
				/* change the text color*/
				if(j)
					color_text(317,227,"Close",15);	/*cursor on no*/
				else if(!j)
					color_text(214,227,"Continue",15);   /*cursor on yes*/
				showMouse();
			}
			if(j!=pr && pr>=0 && pr<2)
			{
				hideMouse();
				draw_3dbox(210+(pr*95),220,280+(pr*90),240,15);
				/* when mouse moves away change the color to normal one*/
				if(pr)
					color_text(317,227,"Close",3);
				else if(!pr)
					color_text(214,227,"Continue",3);
				showMouse();         /*cursor on yes/no*/
			}
			pr = j;	/* keeps the current postion to use next time as previous*/
			j = -1;
			if(mouseClicked())
			{
				x=getMouseX();       /*get the position where mouse is clicked*/
				y=getMouseY();
				break;
			}
		}/*end of while 2 which changes color of button*/

		/*check the position of mouse clicked*/
		if(x>=210&&x<=280&&y>=220&&y<=240)  // continue
		{
			hideMouse();
			up_down_button(210,220,280,240,214,227,18,15,15,6);
			putimage(170,90,summary,COPY_PUT);
			//showMouse();     /*if clicked on back return to previous stage*/
			free(summary);
			return 0;
		}
		else if(x>=305&&x<=370&&y>=220&&y<=240)
		{
			hideMouse();
			up_down_button(305,220,370,240,317,227,23,15,15,6);
			free(summary);   //if clicked on close exit from the lesson
			time_interval=0, min=0, sec=0, minute=0,second=0,eff=0, err=0, speed=0;
			pressed=0, correct= 0, wrong= 0, cpm=0, correction=0;
			showMouse();
			return 1;
		}
	}/*end of while 1*/
}
Example #28
0
void main()
{int gdriver=DETECT,gmode=DETECT;
randomize();
initgraph(&gdriver,&gmode,"");
setbkcolor(BLACK);
clrscr();
cleardevice();
load();
x=random(640);
y=random(480);
//c=random(16);
color();
//setfillstyle(1,c);
setlinestyle(random(6),random(10),random(5));
settextstyle(3,HORIZ_DIR,1);
while(ch!='q')
{//cleardevice();
//outtextxy(30,40," Q   W   E  or arrow key ");
init();
show();
while(!kbhit())
{
check();
//gotoxy(4,2);
//cout<<"\n\n\tX = "<<mx<<"   Y = "<<my<<"  B = "<<b;
if(ch=='w'){cleardevice();ch='A';}
if(x<0||x>640||y<0||y>480||ch=='e')
{ch='A';

x=random(640);
y=random(480);
color();
setlinestyle(random(6),random(10),random(5));
setfillstyle(random(10),random(16));
//c=random(16);
setcolor(c);
}
//change();
mchange();
//if(((m%4000)>200&&(m%4000)<400)||((m%4000)>1000&&(m%4000)<1500)){
//sound((m%4000)+3000);
//}
//if((m%4000)==400||(m%4000)==1500)nosound();
//putpixel(x,y,c);
// Uncomment any one of these and watch
//circle(x+random(20),y+random(20),random(10));
//rectangle(x-random(2),y-random(2),x+random(2),y+random(2));
//line(x,y,320,240);
//line(x,y,(x*y)%100,(x*y)%100);
//line(x-y%40,y,x,x^2);
//line(x-y%40,y,x,(y+(x^2))%480);
//line(y,x,x,y);
//line(x*2,y/2,x/2,y*2);
//circle(x+random(50),y+random(50),(x*y)%10);
//ellipse(x+random(60),y+random(60),0,random(360),random(30),random(30));
//floodfill(x,y,c);
//ellipse(x+random(400),y+random(400),0,random(360),random(100),random(100));
//ellipse(x,y,0,360,5,5);
//ellipse(x-random(640),y-random(480),0,random(360),random(100),random(100));
//bar3d(x-random(3),y-random(3),x+random(3),y+random(3),random(3),1);
//linerel(x,y);
//lineto(x,y);
button();
draw();
//arc(x,y,0,random(360),random(40));
//x=random(640);
//y=random(480);
delay(1);
}
ch=getch();
key();
}
closegraph();
}
Example #29
0
void advanced_level(int file_no,int MINUTE, int angleINCREASE){

	FILE *file;
	file= fopen(file_name[file_no],"r");

	char choice[2],comp;
	// line & i will keep track wid total lines and chars respectively
	int i=0,chars=0, file_pointer,line,z,char_x,char_y,dummy_choice;
	int j1,ch1,x1,y1,time_up;

	prev= -1;
	time_interval=0, min=0, sec=0, eff=0, err=0, speed=0;
	pressed=0, correct= 0, wrong= 0, cpm=0, correction=0;
	minute=MINUTE, INCREASE= angleINCREASE,second=0;
	tutorial_window();
	hideMouse();

	file_pointer=0; choice[1]='\0';

	setcolor(4);
	settextstyle(0,0,1);
	outtextxy(542,50,"0");
	outtextxy(562,50,":");
	outtextxy(574,50,"00");
	show_number(minute,550,50,4,0,1);
	user_response(250,130,1,3);
	time(&start_time);

	settextstyle(2,0,5);
	color_text(535,76,"ESC to",3);
	color_text(536,76,"ESC to",3);
	color_text(524,92,"quit/pause",3);
	color_text(525,92,"quit/pause",3);

	dummy_choice= 'A'; //just to initialize the drawing of a key
	increase=0, angle=89;

	file_open4_screen(file,173,72,36,1,6,30,0);

	while(!feof(file)){

		i=0;char_x=173;char_y=90; line=0; chars=0;
		rewind(file);
		fseek(file,file_pointer,0);

		while(line<6){
			if(feof(file)){
				summary_content();
				end_lesson(min,sec,eff,err,speed);
				return;
				//break;
			}
			gettime (&new_time);
			time_up= time_control();
			if(time_up)
				return ;

			if(i>=0){
				color_text(char_x+8*i,(char_y+36*line)+1,"_",4);
				color_text(char_x+8*i,(char_y+36*line)-23,"^",4);
			}

			if(kbhit()){

				check_kb_up_down(dummy_choice,0);
				choice[0]= getch(); // user input
				dummy_choice= choice[0];
				pressed++;
				check_kb_up_down(choice[0],1);

				if(chars>29){
					color_text((char_x+i*8),(char_y+36*line)+1,"_",15);
					color_text((char_x+i*8),(char_y+36*line)-23,"^",15);
					i=0; line++; chars=0;
				}

				if(choice[0]==27 )  // ESC
				{
					pressed--;
					make_sound(2000,100);
					if(i>0)
						summary_content();

					z = continue_close(min,sec,eff,err,speed);
					if(z)
						return;
					else
						continue;
				}

				if(choice[0]==0){ // error checking for function keys
					int ch1=getch();
					if(ch1==80||ch1==72||ch1==75||ch1==77)   //error checking  to avoide right,left,up
						continue;
				}

				else if(choice[0]==9)
					continue;    //error checking for tab

				else if(choice[0]==8){  //BACKSPACE
					correction++;

					if(i>0 || line>0){
						if(i>0){
							file_pointer--;
							fseek(file,-1,SEEK_CUR);
							setfillstyle(1,15);
							bar(char_x+i*8,char_y+36*line,char_x+(i*8)-8,char_y+7+36*line);
							color_text((char_x+i*8)-8,(char_y+36*line)+1,"_",4);
							color_text(char_x+i*8,(char_y+36*line)+1,"_",15);
							color_text((char_x+i*8)-8,(char_y+36*line)-23,"^",4);
							color_text(char_x+i*8,(char_y+36*line)-23,"^",15);
							i--; chars--;
						}

						if(i>29){
							line++; i=0;chars=0;
						}

					}
					make_sound(1000,100);

				}

				else{
					file_pointer++; correct++;
					fscanf(file,"%c",&comp);
					setcolor(4);
					if(comp=='\n'){
						i=0; chars=1; line++; continue;

					}
					if(comp!=choice[0] && choice[0]==' ')
					{
						char choice1 = '-';	//when space is pressed instead of any key, print dash
						print_lesson(char_x+i*8,char_y+36*line,choice1,9);
						make_sound(500,100);
						wrong++; correct--;
					}

					else if(comp != choice[0]){
						wrong++; correct--;
						setcolor(9);
						make_sound(500,100);
						outtextxy(char_x+i*8,char_y+36*line,choice);
					}
					else
						outtextxy(char_x+i*8,char_y+36*line,choice);

					color_text((char_x+i*8)+8,(char_y+36*line)-23,"^",4);
					color_text(char_x+i*8,(char_y+36*line)-23,"^",15);
					color_text((char_x+i*8)+8,(char_y+36*line)+1,"_",4);
					color_text(char_x+i*8,(char_y+36*line)+1,"_",15);
					i++; chars++;
				}
			}

		}
		if(feof(file))
			break;
		setfillstyle(1,15);
		bar(165,56,417,300);
		undr_line(165,81,12,250,18,7);
		file_open4_screen(file,173,72,36,1,6,30,file_pointer);
	}
	fclose(file);
	closegraph();
}
Example #30
0
void showFont(char *name)
   {
   int      i, j, fontHandle;
   uchar    ascii[3], message[30];;

   settextstyle(DEFAULT_FONT, HORIZ_DIR, 0);
   setcolor(CYAN);
   outtextxy(10, 20, "Microcosm BGI Font Demonstration Program");
   outtextxy(10, 40,
      "(C) Copyright 1992-1995 Tom Wright, Microcosm, 619-488-4462");
   outtextxy(10, 60, "internet e-mail [email protected]");
   outtextxy(400, 180, name);
   outtextxy(400, 200, "Microcosm Helvetica-like");
   i = (name[1]=='B' || name[1]=='b')+
      2*(strchr(&name[1], 'I')!=NULL || strchr(&name[1], 'i')!=NULL);
   outtextxy(400, 220, style[i]);
   sprintf(message, "CapHeight = %2d Pixels", name[3]-(name[3]<'A'?  '0': 55));
   outtextxy(400, 240, message);
   outtextxy(400, 300, "Register and get");
   outtextxy(400, 320, "245 BGI Fonts!");
   outtextxy(400, 340, "Send $29.95 to");
   outtextxy(400, 360, "Microcosm");
   outtextxy(400, 380, "819 Devon Ct.");
   outtextxy(400, 400, "San Diego, CA 92109");
   outtextxy(400, 420, "CA residents add 7% tax");
   outtextxy(400, 440, "See README file for details.");
   for (i=0; i<13; i++)
      {
      sprintf(ascii, "%2X", 32+(i>5? i+1 : i)*16);
      outtextxy(10, 195+i*20, ascii);
      }
   for (j=0; j<16; j++)
      {
      sprintf(ascii, "%1X", j);
      outtextxy(40+20*j, 170, ascii);
      }
   fontHandle = installuserfont(name);
   checkerrors();
   settextstyle(fontHandle, HORIZ_DIR, 0);
   setusercharsize(1, 1, 1, 1);
   checkerrors();
   setcolor(WHITE);
   outtextxy(10, 120, "The quick brown fox jumped over the lazy dog.");
   outtextxy(10, 140, "THE QUICK BROWN FOX JUMPED OVER THE LAZY DOG.");
   ascii[1] = '\0';
   for (i=0; i<13; i++)
      for (j=0; j<16; j++)
         {
         ascii[0] = 32+(i>5? i+1 : i)*16+j;
         outtextxy(40+20*j, 190+i*20, ascii);
         }
   bzzt();
// settextstyle(DEFAULT_FONT, HORIZ_DIR, 0);
   for (i=0; i<=nBlink; i++) /* I hope you don't find this too offensive. */
      {
      setcolor(GREEN);
      outtextxy(400, 270, "Just 10ยข a font!");
      if (i<nBlink)
         {
         delay(200); if (kbhit()) break; delay(200); if (kbhit()) break;
         setcolor(BLACK);
         fillpoly(4, box);
         delay(200); if (kbhit()) break; delay(200); if (kbhit()) break;
         }
      }
   if (nBlink)
      nBlink--;
   setcolor(WHITE);
   if (getch()==27)                    // 27 == Esc
      { closegraph(); exit(1); }
   cleardevice();
   }