Esempio n. 1
0
void drawFeature(unsigned i, char mini)
{
    t_point* featurePoints;
    if(mini)
    {
        allLargeFeatures[i].updatepolyMiniPoints();
        featurePoints = allLargeFeatures[i].getpolyPoints();
        i = allLargeFeatures[i].getID();
    } else {
        featurePoints = allFeatures[i].getpolyPoints();
    }
    
    //closed features are polygons
    if (allFeatures[i].isClosed())
    {
        setcolor(colorScheme[allFeatures[i].getcolorID()][colorMode]);
        fillpoly(featurePoints, allFeatures[i].getnPoints());

    } else { //open features are lines
        setcolor(colorScheme[allFeatures[i].getcolorID()][colorMode]);
        if(mini)
        {
            for (unsigned j = 0; j < allFeatures[i].getnPoints() - 1; j ++) {
                drawline(featurePoints[j],featurePoints[j+1]);
            }
        } else {
            setlinewidth(floor(allFeatures[i].getlineWidth()/trueScreen.get_width()));
            setlinestyle(allFeatures[i].getlineStyle());
            for (unsigned j = 0; j < allFeatures[i].getnPoints() - 1; j ++) {
                drawline(featurePoints[j],featurePoints[j+1]);
                fillarc(featurePoints[j].x,featurePoints[j].y,allFeatures[i].getlineWidth()/2200,0,360);
            }
            fillarc(featurePoints[allFeatures[i].getnPoints() - 1].x,featurePoints[allFeatures[i].getnPoints() - 1].y,allFeatures[i].getlineWidth()/2200,0,360);
        }           
    }
}
Esempio n. 2
0
void mancha4 ()
{ int poly [20];
poly[0]=400;
poly[1]=310;
//2
poly[2]=440;
poly[3]=310;
//3
poly[4]=440;
poly[5]=250;
//4
poly[6]=420;
poly[7]=250;
//5
poly[8]=420;
poly[9]=210;
//6
poly[10]=400;
poly[11]=210;
//7
poly[12]=400;
poly[13]=230;
//8
poly[14]=380;
poly[15]=230;
//9
poly[16]=380;
poly[17]=290;
//10
poly[18]=400;
poly[19]=290;

setcolor(0);
setfillstyle(1,9);
fillpoly (10,poly);
}
Esempio n. 3
0
void cabeza ()
{ int poly [50];
poly[0]=160;
poly[1]=350;
//2
poly[2]=200;
poly[3]=350;
//3
poly[4]=200;
poly[5]=330;
//4
poly[6]=400;
poly[7]=330;
//5
poly[8]=400;
poly[9]=350;
//6
poly[10]=440;
poly[11]=350;
//7
poly[12]=440;
poly[13]=250;
//8
poly[14]=420;
poly[15]=250;
//9
poly[16]=420;
poly[17]=210;
//10
poly[18]=400;
poly[19]=210;
//11
poly[20]=400;
poly[21]=190;
//12
poly[22]=380;
poly[23]=190;
//13
poly[24]=380;
poly[25]=170;
//14
poly[26]=340;
poly[27]=170;
//15
poly[28]=340;
poly[29]=150;
//16
poly[30]=260;
poly[31]=150;
//17
poly[32]=260;
poly[33]=170;
//18
poly[34]=220;
poly[35]=170;
//19
poly[36]=220;
poly[37]=190;
//20
poly[38]=200;
poly[39]=190;
//21
poly[40]=200;
poly[41]=210;
//22
poly[42]=180;
poly[43]=210;
//23
poly[44]=180;
poly[45]=250;
//24
poly[46]=160;
poly[47]=250;
//25
poly[48]=160;
poly[49]=350;

setcolor(7);
setfillstyle(1,7);
fillpoly (25,poly);
}
int main()
{
	int gdriver = DETECT, gmode, poly1[10], poly2[10], angle, r1, r2, r3, r4, r5, a, b, ch, unit;
	initgraph(&gdriver, &gmode, "C:\\TURBOC3\\BGI");

	unit = MAXY / 18;

	r1 = sqrt(72) * unit;
	r2 = sqrt(40) * unit;
	r3 = sqrt(32) * unit;
	r4 = sqrt(16) * unit;
	r5 = sqrt(8) * unit;

	a = 320;
	b = 240;
	ch = 'S';

	angle = 90;

	while(ch != 'q')
	{
		poly1[0] = r1 * cos((angle + 135) / 57.3) + a;
		poly1[1] = r1 * sin((angle + 135) / 57.3) + b;

		poly1[2] = r2 * cos((angle + 108.43) / 57.3) + a;
		poly1[3] = r2 * sin((angle + 108.43) / 57.3) + b;

		poly1[4] = r5 * cos((angle + 135) / 57.3) + a;
		poly1[5] = r5 * sin((angle + 135) / 57.3) + b;

		poly1[6] = r2 * cos((angle + 161.56) / 57.3) + a;
		poly1[7] = r2 * sin((angle + 161.56) / 57.3)+ b;

		poly1[8] = poly1[0];
		poly1[9] = poly1[1];



		poly2[0] = r3 * cos((angle + 135) / 57.3) + a;
		poly2[1] = r3 * sin((angle + 135) / 57.3) + b;

		poly2[2] = r4 * cos((angle + 90) / 57.3) + a;
		poly2[3] = r4 * sin((angle + 90) / 57.3) + b;

		poly2[4] = 0 + a;
		poly2[5] = 0 + b;

		poly2[6] = r4 * cos((angle + 180) / 57.3) + a;
		poly2[7] = r4 * sin((angle + 180) / 57.3)+ b;

		poly2[8] = poly2[0];
		poly2[9] = poly2[1];

		rectangle(0, 0, MAXX, MAXY);
		setfillstyle(SOLID_FILL, DARKGRAY);
		fillpoly(5, poly1);
		line(poly1[0], poly1[1], poly2[0], poly2[1]);
		line(poly1[2], poly1[3], poly2[2], poly2[3]);
		line(poly1[4], poly1[5], poly2[4], poly2[5]);
		line(poly1[6], poly1[7], poly2[6], poly2[7]);
		setfillstyle(SOLID_FILL, LIGHTGRAY);
		fillpoly(5, poly2);
//		delay(200);
		switch(getch())
		{
			case 77:  	angle++;
					break;

			case 75:  	angle--;
					break;

			case 113:	ch = 'q';
					break;
		}
		cleardevice();
	}
	closegraph();
	return 0;
}
 void handle(event me[2])
 {setviewport(5,5,5+440,5+height,1);
  clearviewport();
  if(is1(flag,0))
  {rad1=pow(m1/500,0.33333333);
   rad2=pow(m2/500,0.33333333);
   //
   if(is1(flag,12))
   {delete tms;
    set0(flag,12);
    if(is1(flag,7))
    {delete array[0];delete array[1];delete array[2];delete array[3];
     set0(flag,7);
    }
    if(is1(flag,6))
    {delete array[0];delete array[1];delete array[2];delete array[3];
     set0(flag,6);
    }
    if(is1(flag,5))
    {delete array[0];delete array[1];delete array[2];delete array[3];
     set0(flag,5);
    }
   }
   //
    if((me[1].b&1)==1)
    {vector vm2(me[2].x-5-220,height/2-me[2].y+5),
	     vm1(me[1].x-5-220,height/2-me[1].y+5);
     if((me[2].b&1)==0)
     { if((r1+v1-vm1).mod()<=5)
       set1(flag,8);
       else if((r2+v2-vm1).mod()<=5)
       set1(flag,9);
       else if((r1-vm1).mod()<=rad1)
       set1(flag,10);
       else if((r2-vm1).mod()<=rad2)
       set1(flag,11);
     }
     else if(me[1].x>5&&me[1].x<445&&me[1].y>5&&me[1].y<(5+height))
     { if(is1(flag,8))
	v1=vm1-r1;
       else if(is1(flag,9))
	v2=vm1-r2;
       else if(is1(flag,10))
	r1=vm1;
       else if(is1(flag,11))
	r2=vm1;
     }
    }
    else
    {set0(flag,8);set0(flag,9);set0(flag,10);set0(flag,11);
    }
    setcolor(COL1);
    setfillstyle(SOLID_FILL,COL1);
    fillellipse(r1.x+220,height/2-r1.y,rad1*10./9,rad1);
    setcolor(14);
    setfillstyle(SOLID_FILL,14);
    fillellipse(r2.x+220,height/2-r2.y,rad2*10./9,rad2);
    //
    setcolor(1);
    line(220+r1.x,height/2-r1.y,220+r1.x+v1.x,height/2-r1.y-v1.y);
    double ang=angle(v1.x,-v1.y);
    int pol[8];
    setfillstyle(SOLID_FILL,1);
    pol[0]=220+r1.x+v1.x;pol[1]=height/2-r1.y-v1.y;
    pol[2]=220+r1.x+v1.x+4*cos(ang+2.5);pol[3]=height/2-r1.y-v1.y+4*sin(ang+2.5);
    pol[4]=220+r1.x+v1.x+4*cos(ang-2.5);pol[5]=height/2-r1.y-v1.y+4*sin(ang-2.5);
    pol[6]=220+r1.x+v1.x;pol[7]=height/2-r1.y-v1.y;
    fillpoly(4,pol);
    //
    setcolor(2);
    line(220+r2.x,height/2-r2.y,220+r2.x+v2.x,height/2-r2.y-v2.y);
    ang=angle(v2.x,-v2.y);
    setfillstyle(SOLID_FILL,2);
    pol[0]=220+r2.x+v2.x;pol[1]=height/2-r2.y-v2.y;
    pol[2]=220+r2.x+v2.x+4*cos(ang+2.5);pol[3]=height/2-r2.y-v2.y+4*sin(ang+2.5);
    pol[4]=220+r2.x+v2.x+4*cos(ang-2.5);pol[5]=height/2-r2.y-v2.y+4*sin(ang-2.5);
    pol[6]=220+r2.x+v2.x;pol[7]=height/2-r2.y-v2.y;
    fillpoly(4,pol);
  }
  if(is1(flag,1))
  {if(is0(flag,12))
   {set1(flag,12);
    tms=new Two_Mass_System(m1,m2,r1,r2,v1,v2);
    if(is1(flag,13))
    {  setviewport(0,0,639,349,1);
       active
       setfillstyle(SOLID_FILL,7);
       bar(0,349-charheight-1,639,349);
       status("Wait...");
       active
       setviewport(5,5,5+440,5+height,1);
     if((tms->s->flag==2||tms->s->flag==3)&&tms->s->T*2/0.05<2000)
     {array[0]=new double[tms->s->T*2/0.05+25];
      array[1]=new double[tms->s->T*2/0.05+25];
      array[2]=new double[tms->s->T*2/0.05+25];
      array[3]=new double[tms->s->T*2/0.05+25];
      long i=0;
      for(double q=0;q<=tms->s->T*2+0.6;q+=0.05,i++)
      {tms->position_wrt_cm(q,w1,w2);
       array[0][i]=w1.x;
       array[1][i]=w1.y;
       array[2][i]=w2.x;
       array[3][i]=w2.y;
      }
      set1(flag,7);
     }
     if(tms->s->flag==1||tms->s->flag==4)
     {array[0]=new double[20/0.05+25];
      array[1]=new double[20/0.05+25];
      array[2]=new double[20/0.05+25];
      array[3]=new double[20/0.05+25];
      long i=0;
      for(double q=0;q<=20+0.5;q+=0.05,i++)
      {tms->position_wrt_cm(q,w1,w2);
       array[0][i]=w1.x;
       array[1][i]=w1.y;
       array[2][i]=w2.x;
       array[3][i]=w2.y;
      }
      set1(flag,6);
     }
     if(tms->s->flag==2&&tms->s->T*2/0.05>=2000)
     {array[0]=new double[40/0.05+25];
      array[1]=new double[40/0.05+25];
      array[2]=new double[40/0.05+25];
      array[3]=new double[40/0.05+25];
      long i=0;
      for(double q=-20-0.5;q<=20+0.5;q+=0.05,i++)
      {tms->position_wrt_cm(q,w1,w2);
       array[0][i]=w1.x;
       array[1][i]=w1.y;
       array[2][i]=w2.x;
       array[3][i]=w2.y;
      }
      set1(flag,5);
     }
    }
    t=0;
   }

   if(is1(flag,7))
   {setcolor(8);
    for(long i=2;i<t/0.05&&i*0.05<=tms->s->T*2+0.5;i++)
    {line(220+array[0][i],height/2-array[1][i]*0.9,220+array[0][i+1],height/2-array[1][i+1]*0.9);
     line(220+array[2][i],height/2-array[3][i]*0.9,220+array[2][i+1],height/2-array[3][i+1]*0.9);
    }
   }
   if(is1(flag,6))
   {setcolor(8);
     for(long i=2;i<t/0.05&&i*0.05<=20;i++)
     {line(220+array[0][i],height/2-array[1][i]*0.9,220+array[0][i+1],height/2-array[1][i+1]*0.9);
      line(220+array[2][i],height/2-array[3][i]*0.9,220+array[2][i+1],height/2-array[3][i+1]*0.9);
     }
   }
   if(is1(flag,5))
   {setcolor(8);
     for(long i=(20+0.5)/0.05;i*0.05-(20+0.5)<t&&i*0.05-(20+0.5)<=20;i++)
     {line(220+array[0][i],height/2-array[1][i]*0.9,220+array[0][i+1],height/2-array[1][i+1]*0.9);
      line(220+array[2][i],height/2-array[3][i]*0.9,220+array[2][i+1],height/2-array[3][i+1]*0.9);
     }
     for(i=0.5/0.05;i*0.05<(20+0.5)+t-tms->s->T*2&&i*0.05<=(20+0.5);i++)
     {line(220+array[0][i],height/2-array[1][i]*0.9,220+array[0][i+1],height/2-array[1][i+1]*0.9);
      line(220+array[2][i],height/2-array[3][i]*0.9,220+array[2][i+1],height/2-array[3][i+1]*0.9);
     }
   }
   if(is1(flag,13))
   { tms->position_wrt_cm(t,d1,d2);
     setviewport(0,0,639,349,1);
     if(tms->s->flag==1)status("Moving in Parabolic path");
     if(tms->s->flag==2)status("Moving in Elliptical path");
     if(tms->s->flag==3)status("Moving in Circular path");
     if(tms->s->flag==4)status("Moving in Hyperbolic path");
     setviewport(5,5,5+440,5+height,1);
   }
   else tms->position(t,d1,d2);
   setcolor(COL1);
   setfillstyle(SOLID_FILL,COL1);
   fillellipse(d1.x+220,height/2-d1.y*0.9,rad1*10./9,rad1);
   setcolor(COL2);
   setfillstyle(SOLID_FILL,COL2);
   fillellipse(d2.x+220,height/2-d2.y*0.9,rad2*10./9,rad2);
   t+=dt;
  }
  if(is1(flag,15))
  {setcolor(15);
   char str[100]="An Application by ";
   char ma[13];
   for(int i=0;i<13;i++)
    ma[i]=char(~st_[i]);
   strcat(str,ma);
   strcat(str," to obserb how a Mass  ");
   outtextxy(5,5, str );
   outtextxy(5,5+charheight+5,    "Body is affected in the Gravitational Feild developed" );
   outtextxy(5,5+2*(charheight+5),"by anoher Mass Body. ( Written in CPP )");
  }
  setviewport(0,0,639,349,1);
  setcolor(8);
  line(445,6,445,5+height);
  line(444,7,444,5+height);
  line(443,8,443,5+height);
  line(6,5+height,445,5+height);
  line(7,5+height-1,445,5+height-1);
  line(8,5+height-2,445,5+height-2);
 }
Esempio n. 6
0
int main(void)
{
   int gdriver, gmode;

   /* install a user written device driver */
   gdriver = installuserdriver("svga256", detectSVGA256);

   /* must force use of detection routine */
   gdriver = DETECT;

   /* check for any installation errors */
    /* initialize graphics and local variables */
   initgraph(&gdriver, &gmode, "d:\\prog\\project\\");
   int y1=getmaxy();
   int x=getmaxx();

   struct palettetype pal;
float i, ht, y, xmax;
   getpalette(&pal);
   /* check for any initialization errors */
       /* draw a line */
    for (i=0; i<pal.size; i++)
   setrgbpalette(pal.colors[i], i*4, i*4, i*4);
   setcolor(9);
   line(0, 0, getmaxx(), getmaxy());
    ht = getmaxy() / 255;
xmax = getmaxx();
y = 0;
for (i=0; i<256; i++)
{
   static int t[]={0,0,0,50,50,50,50,0,};
   setfillstyle(SOLID_FILL, i);
   setcolor(0);
   fillpoly(4,t);
   char cnum[10];
   settextstyle(DEFAULT_FONT,HORIZ_DIR,2);
   setcolor(0);
   itoa(i,cnum,10);
   outtextxy(t[0],t[1],cnum);
   for(int i=0;i<8;i+=2)
   t[i]+=50;
   //bar(0, y, xmax, y+ht);
   y += ht;
   if(t[4]>getmaxx())
   {for(int i=0;i<8;i+=2)
   t[i+1]+=50;
   for(i=0;i<4;i+=2)
   t[i]=0;
   for(i=4;i<8;i+=2)
   t[i]=50;}
//   getch();

}    setcolor(59);
   //line(0, 0, getmaxx(), getmaxy());
    //circle(0,0,500);
    printf("%i%i",x+1,y1+1);
    //printf(" hello %i",getpalettesize());
   /* clean up */
    getch();
   closegraph();
   return 0;
}
Esempio n. 7
0
//This function drwas the legend and the corresponding lables on the graphics window
void drawLegend(struct dimenssionStruct*dimenPtr)
{

				//This array defines coords for the legend keys (rectangular boxes)
				int coords[]={0,0,0,0,0,0,0,0};
		
				//Counter var
				int i;
	
				//Sets x coord for the  legend, which is x range of bore hole display area (including the borders) + another 35px
				int  x=(int)dimenPtr->rangeXScale+35;
				
				//This variable contains total distance from the top of the window
				int height=0;
	
			//-----------------
				//Draws legend for Soil Type
				setcolor(WHITE);
				outtextxy(x,2,"SOIL TYPE");
		
		
		
				//Initializes variable to the height of this text
				height=textheight("SOIL TYPE");
	
		
				//Sets drawing color to white and shows the text on graphics window
				setcolor(WHITE);
				outtextxy(x,2,"SOIL TYPE");
		
		
				for(i=0;i<9;i++)
				{
		
	
			
							//Top top left coord
					
								coords[0]=x;
					
					
								//Adds a padding of 10 px on the top
								coords[1]=height+10;
					
							//End of top left coord
				
				
				
				
							//Top right coord
					
								//Makes the legend key 20px wide
								coords[2]=x+20;
					
								//Adds padding of 10px from the top
								coords[3]=height+10;
					
							//End of top right coord
					
					
							//Bottom Right Coord
				
								//Makes the legend key 20px wide
								coords[4]=x+20;
					
					
								//Adds 25px to the height variable (Equation= total height from top of the window + 5 px top padding + 20px height)
								coords[5]=height+25;
				
					
							//End of Bottom Right Coord
				
				
							//Botton Left coord
				
								coords[6]=x;
					
								//Adds 25px to the height variable (Equation= total height from top of the window + 5 px top padding + 20 px height)
								coords[7]=height+25;
					
							//End of Botton Left coord
				
				
								height+=20;
					
								//Draws the Legend Key
								setcolor(typeColor[i]);
								setfillstyle(SOLID_FILL,typeColor[i]);
								fillpoly(4,coords);
					
					
					
								//Draws the label for this legend key
								setcolor(WHITE);
								outtextxy(coords[2]+4,coords[1],typeName[i]);
				
				
				
		

	


				}
		//---------------------

		
		
		//------------------------
		//Draws legend for sample color
	
		
		
				//Sets drawing color to white and shows the text on graphics window
				setcolor(WHITE);
				outtextxy(x,height+12,"SAMPLE COLORS");
		
				//Sets the top padding to 10px
				height+=textheight("SAMPLE COLORS")+10;
		
				for(i=0;i<9;i++)
				{
		
	
			
					
							//Top top left coord
								coords[0]=x;
					
					
								//Adds a padding of 10 px on the top
								coords[1]=height+10;
					
							//End of top left coord
				
				
				
				
							//Top right coord
					
								//Makes the legend key 20px wide
								coords[2]=x+20;
					
								//Adds padding of 10px from the top
								coords[3]=height+10;
					
							//End of top right coord
					
					
							//Bottom Right Coord
				
								//Makes the legend key 20px wide
								coords[4]=x+20;
					
					
								//Adds 25px to the height variable (Equation= total height from top of the screen + 5 px top padding + 20px height)
								coords[5]=height+25;

					
							//End of Bottom Right Coord
				
				
								//Botton Left coord
				
								coords[6]=x;
					
								//Adds 25px to the height variable (Equation= total height from top of the screen + 5 px top padding + 20 px height)
								coords[7]=height+25;
					
							//End of Botton Left coord
				
								height+=20;
					
								//Draws the Legend Key
								setcolor(colorValue[i]);
								setfillstyle(SOLID_FILL,colorValue[i]);
								fillpoly(4,coords);
					
					
					
								//Draws the label for this legend key
								setcolor(WHITE);
								outtextxy(coords[2]+4,coords[1],colorName[i]);
				
	

				}
		//------------------
		
		//----------------------------
		//Draws legend for sample strength
		
		
				//Sets drawing color to white and shows the text on graphics window
				setcolor(WHITE);
				outtextxy(x,height+12,"SAMPLE STRENGTH");
	
				//Sets the top padding to 10px
				height+=textheight("SAMPLE STRENGTH")+10;
		
				for(i=0;i<10;i++)
				{
		
	
			
							//Top top left coord
					
								coords[0]=x;
					
					
								//Adds a padding of 10 px on the top
								coords[1]=height+10;
					
							//End of top left coord
				
				
				
				
							//Top right coord
					
								//Makes the legend key 20px wide
								coords[2]=x+20;
					
								//Adds padding of 10px from the top
								coords[3]=height+10;
					
							//End of top right coord
					
					
							//Bottom Right Coord
				
								//Makes the legend key 20px wide
								coords[4]=x+20;
					
					
								/*Adds 25px to the height variable 
								(Equation= total height from top of the screen + 5 px top padding + 20px height)*/
								coords[5]=height+25;
					
							//End of Bottom Right Coord
				
				
							//Botton Left coord
				
								coords[6]=x;
					
								//Adds 25px to the height variable (Equation= total height from top of the screen + 5 px top padding + 20 px height)
								coords[7]=height+25;
					
							//End of Botton Left coord
				
				
					
				
								height+=20;
					
								//Draws the Legend Key
								setcolor(hardColor[i]);
								setfillstyle(SOLID_FILL,hardColor[i]);
								fillpoly(4,coords);
					
					
					
								//Draws the label for this legend key
								setcolor(WHITE);
								outtextxy(coords[2]+4,coords[1],hardName[i]);;
	


				}
		

}
Esempio n. 8
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();
   }
int main(void)
{
   /* request auto detection */
   int gdriver = DETECT, gmode, errorcode;
   int xmax, ymax;

   /* initialize graphics and local variables */
   initgraph(&gdriver, &gmode, "c:\\TurboC3\\BGI");

   /* read result of initialization */
   errorcode = graphresult();
   /* an error occurred */
   if (errorcode != grOk)
   {
      printf("Graphics error: %s\n", grapherrormsg(errorcode));
      printf("Press any key to halt:");
      getch();
      exit(1);
   }

   setcolor(getmaxcolor());
   xmax = getmaxx();
   ymax = getmaxy();
    int level=0,flag=0,t1=500,t2=300;
   int well[8]={350-85,250,350-85,400,350+85,400,350+85,250};
   while(!kbhit())
   {

     int bucketwater[8]={310,470-level,370,470-level,370,getmaxy(),310,getmaxy()};

   int bucket[10]={310,430,370,430,370,getmaxy(),310,getmaxy(),310,430};
   drawpoly(5,bucket);
    int y=0,x=0,y1=0,y2=0,s=0;
    while(level<50)
   {



   cleardevice();
   circle(500,200,30); //head
   line(500,230,500,400);  //body
   line(500,400,450,450); //left leg
   line(500,400,550,450);  //right leg

  /* int s=0;
   while(s<25)
   {
   line(500,250,450,220+s);
   line(500,250,450,210+s);
   setcolor(BLACK);
    line(500,250,450,220+s);
   line(500,250,450,210+s);
 setcolor(WHITE);
   s=s++;
   } */
   if(flag!=0)
    {
    setfillstyle(1,BLUE);
    fillpoly(4,bucketwater);
    }
   drawpoly(5,bucket);

   if(y2<70)
   {
 ellipse(340,220+y2,0,360,10,5);
   line(340,220,340,225);
   line(330,220+y2,330,245+y2);
   line(350,220+y2,350,245+y2);
   line(330,245+y2,350,245+y2);
   line(358,170,t1-x,t2-y);
    line(500,270,450,240);
   line(500,270,450,230);

   y2++;
  }

  if((y2<90)&&(y2>20))
  y2++;


  // line(350-85,250,350-85,400);   //walls
  // line(350+85,250,350+85,400);    //wall
  // arc(350,235,242,298,185);  //base

  setfillstyle(1,BROWN);
  fillpoly(4,well);
  setfillstyle(1,LIGHTGRAY);
  fillellipse(350,250,85,20); //top
   line(350-85,250,350-85,150);//structure
   line(350+85,250,350+85,150);//to hold
   line(350-85,150,350+85,150);//pulley
   if(x%2==0)
   {
   line(350,165,350,185);
   line(340,175,360,175);
   }
   else
   {
   line(350+5,165+2,350-5,185-2);
   line(350-5,165+2,350+5,185-2);
   }

   line(350,150,350,165);
   circle(350,175,10); //pulley
  if(y>90)
   {
   line(360-2,165+5,400+x,200+y);
  // t1=x;
  // t2=y;
    }
  //  int s=10;
   if((y>=50)&&(y<90))
   {
   ellipse(340,240-y1,0,360,10,5);
   line(340,175,340,240-y1);
   line(330,240-y1,330,265-y1);
   line(350,240-y1,350,265-y1);
   line(330,265-y1,350,265-y1);
    line(360-2,165+5,400+x,200+y);
   if(s<20)
   {
   line(500,270,450,240+s);
   line(500,270,450,230+s);
   s++;
   }
 //  line(450,250,400,220+s);
   //line(450,250,400,210+s);

    t1=400+x;
    t2=200+y;

  // floodfill(335,280,BLUE);
   y1++;
   }

   else if(y>=90)
   {
    int water[8]={330,270-y1,330,470-y1,350,470-y1,350,270-y1};

   {
   line(500,250,350,220);
   line(500,250,350,210);

   }
  ellipse(340,270-y1,0,360,10,10);
   line(340,175,340,270-y1-10);
  // line(330,270-y1,330,295-y1);
  // line(350,270-y1,350,295-y1);
  // line(330,295-y1,350,295-y1);
    setfillstyle(1,BLUE);
    fillpoly(4,water);
   // delay(15);
    fillpoly(4,bucketwater);
    level++;
    if(level%10==0)
    { flag=1;

     break;
    }


   }
   else
   {
   line(340,175,340,250);
   }
   y++;
   x++;
  // s+=3;


   delay(20);


   }
  int overflow[8]={370,430,370,getmaxy(),380,getmaxy(),380,430};
  setfillstyle(1,LIGHTBLUE);
  fillpoly(4,overflow);
   }
   /* clean up */
   getch();
   closegraph();
   return 0;
}
Esempio n. 10
0
void desenhaCampo()				//desenho do background
{
setbkcolor(GREEN); 				//cor do fundo
 
setfillstyle(1, BLUE); 			//cor da agua

bar(360, 0, 440, 600);			//rio principal

bar(440, 150, 580, 200); 		// primerio braco da direita	
poly[0] = 580;
poly[1] = 150;
poly[2] = 580;
poly[3] = 200;
poly[4] = 680;
poly[5] = 150;
poly[6] = 680;
poly[7] = 100;
poly[8] = 580;
poly[9] = 150;
fillpoly(5, poly);
bar(680, 100, 800, 150); 
		
bar(240, 300, 360, 350);		//braco da esquerda	
poly[0] = 0;
poly[1] = 250;
poly[2] = 120;
poly[3] = 300;
poly[4] = 240;
poly[5] = 350;
poly[6] = 240;
poly[7] = 300;
poly[8] = 0;
poly[9] = 200;
fillpoly(5, poly);
 					
poly[0] = 360;					//segundo braco da direita  
poly[1] = 350;
poly[2] = 360;
poly[3] = 400;
poly[4] = 560;
poly[5] = 450;
poly[6] = 560;
poly[7] = 400;
poly[8] = 360;
poly[9] = 350;
fillpoly(5, poly);
setcolor(BLUE);
bar(560, 400, 600, 450);
poly[0] = 600;
poly[1] = 400;
poly[2] = 600;
poly[3] = 450;
poly[4] = 800;
poly[5] = 600;
poly[6] = 800;
poly[7] = 525;
poly[8] = 600;
poly[9] = 400;
fillpoly(5, poly);

bar(150, 0, 200, 600);			//rio vertical 1
bar(0, 550, 800, 600);			//rio horizontal 1
}
Esempio n. 11
0
File: SNAKE.CPP Progetto: Sir2B/Uni
void main(void)
{
   int gdriver = DETECT, gmode, errorcode;
   void
*body,*food,*tail1,*tail2,*tail3,*tail4,*head1,*head2,*head3,*head4;
   int x, y,X[5000],Y[5000],i=3,
maxx,maxy,speed=100,bo=10,t[10],score=0,hscore=20;
   unsigned int size;
   char a='6',b,scor[4],hs[4];
   int k=2,l,r1,r2,f=0,z=100,first=0,second=1;;
   r1=300;
   r2=350;

   ifstream infile("c:\tc\bin\rattle.txt");
   infile.getline(hs,4);
   infile.close();
   hscore = atoi(hs);



   /* initialize graphics and local variables */
   initgraph(&gdriver, &gmode, "C:\\TURBOC3\\BGI");

   /* read result of initialization */
   errorcode = graphresult();
   if (errorcode != grOk)  /* an error occurred */
   {
      printf("Graphics error: %s", grapherrormsg(errorcode));
      printf("Press any key to halt:");
      getch();
      exit(1); /* terminate with an error code */
   }
   maxx = getmaxx();
   maxy = getmaxy();
   y = 160;
   x = 80;
   for(int j=0; j<=3; j++)
   {
	X[i-j]=x-bo*(j+1);
	Y[i-j]=y;

   }

   //body

   setfillstyle(1,2);
   bar(10,10,20,20);
   setcolor(0);
   setlinestyle(0,1,3);
   line(9,9,21,21);
   line(9,21,21,9);
   size = imagesize(10,10,20,20);
   body = malloc(size);
   getimage(10,10,20,20,body);
   cleardevice();

   setcolor(0);
   //tail1-right
   t[0]=20; t[1]=10;
   t[2]=10; t[3]=10;
   t[4]=20; t[5]=15;
   t[6]=10; t[7]=20;
   t[8]=20; t[9]=21;
   fillpoly(5, t);
   size = imagesize(10,10,20,21);
   tail1 = malloc(size);
   getimage(10,10,20,21,tail1);
   cleardevice();

   //tail2-left
   t[0]=10; t[1]=10;
   t[2]=20; t[3]=10;
   t[4]=10; t[5]=15;
   t[6]=20; t[7]=20;
   t[8]=10; t[9]=21;
   fillpoly(5, t);
   size = imagesize(10,10,20,21);
   tail2 = malloc(size);
   getimage(10,10,20,21,tail2);
   cleardevice();

   //tail3-up
   t[0]=10; t[1]=20;
   t[2]=10; t[3]=10;
   t[4]=15; t[5]=20;
   t[6]=20; t[7]=10;
   t[8]=20; t[9]=21;
   fillpoly(5, t);
   size = imagesize(10,10,20,21);
   tail3 = malloc(size);
   getimage(10,10,20,21,tail3);
   cleardevice();

   //tail4-down
   t[0]=10; t[1]=10;
   t[2]=10; t[3]=21;
   t[4]=15; t[5]=10;
   t[6]=20; t[7]=21;
   t[8]=20; t[9]=10;
   fillpoly(5, t);
   size = imagesize(10,10,20,21);
   tail4 = malloc(size);
   getimage(10,10,20,21,tail4);
   cleardevice();

   //head1-right
   setlinestyle(1,1,1);
   setcolor(2);
   fillellipse(10,10,10,5);
   setcolor(4);
   //eyes
   fillellipse(15,7,1,1);
   fillellipse(15,13,1,1);
   size = imagesize(10,5,20,15);
   head1 = malloc(size);
   getimage(10,5,20,15,head1);

   //head2-left
   //eyes
   fillellipse(5,7,1,1);
   fillellipse(5,13,1,1);
   size = imagesize(0,5,10,15);
   head2 = malloc(size);
   getimage(0,5,10,15,head2);
   cleardevice();

   //head3-up
   //eyes
   setcolor(2);
   fillellipse(12,12,5,10);
   setcolor(4);
   fillellipse(9,6,1,1);
   fillellipse(15,6,1,1);
   size = imagesize(7,2,18,12);
   head3 = malloc(size);
   getimage(7,2,18,12,head3);


   //head4-down
   //eyes
   fillellipse(9,17,1,1);
   fillellipse(15,17,1,1);
   size = imagesize(7,12,18,22);
   head4 = malloc(size);
   getimage(7,12,18,22,head4);
   cleardevice();


   //food
   setcolor(15);
   setfillstyle(1,15);
   fillellipse(10,10,3,5);
   size = imagesize(5,3,15,17);
   food = malloc(size);
   getimage(5,3,15,17,food);
   cleardevice();

    /* repeat until a key is pressed */

   maxx=getmaxx();
   maxy=getmaxy();
   setlinestyle(0,1,3);
   setcolor(9);
   rectangle(0,0,maxx,maxy);
   setlinestyle(0,1,2);
   line(maxx-150,0,maxx-150,maxy);
   setcolor(8);
   setfillstyle(1,8);
   bar(maxx-147,3,maxx-3,63);
   setcolor(12);
   int maze=1;
   if(maze==1)
   {
   setfillstyle(1,6);
   bar(4,4,maxx-154,14);
   bar(4,4,14,maxy-4);
   bar(4,maxy-4,maxx-154,maxy-14);
   bar(maxx-154-10,4,maxx-154,maxy-4);
   }


   settextstyle(0,0,1);
   delay(300);
   outtextxy(maxx-125,30,"RATTLE SNAKE");
   delay(300);
   setcolor(11);
   setlinestyle(0,1,2);
   rectangle(maxx-145,65,maxx-5,205);
   outtextxy(maxx-128,70,"INSTRUCTIONS");
   delay(200);
   setcolor(6);
   outtextxy(maxx-140,90,"Commands     Key");
   delay(300);
   setcolor(8);
   outtextxy(maxx-140,110," Move Up      8");
   delay(50);
   outtextxy(maxx-140,130," Move Down    5");
    delay(50);
   outtextxy(maxx-140,150," Move Right   6");
    delay(50);
   outtextxy(maxx-140,170," Move Left    4");
    delay(50);
   outtextxy(maxx-140,190," Exit         0");
   delay(200);
   setcolor(12);
   setlinestyle(0,1,2);
   rectangle(maxx-145,210,maxx-5,350);
   setcolor(1);
   outtextxy(maxx-130,220,"Player's Name");
   setcolor(15);
   outtextxy(maxx-100,230,"Yellow");
   setcolor(4);
   delay(200);
   itoa(score,scor,10);
   outtextxy(maxx-140,250,"Score");
   outtextxy(maxx-50,250,scor);
   delay(200);
   setcolor(10);
   outtextxy(maxx-140,280,"Level");
   delay(200);
   setcolor(13);
   outtextxy(maxx-140,310,"Maze        1");
   delay(200);
   setcolor(14);
   outtextxy(maxx-140,340,"High Score  ");
   outtextxy(maxx-50,340,hs);

   for(j=0; j<=1000; j++)
   {
	putpixel(random(maxx-150),random(maxy),6);
	delay(1);
   }

   while (a!='0')
   {

       // plot new image
      if(a=='6')
	    putimage(x, y, head1, XOR_PUT);
      if(a=='4')
	    putimage(x, y, head2, XOR_PUT);
      if(a=='8')
	    putimage(x, y, head3, XOR_PUT);
      if(a=='5')
	    putimage(x, y, head4, XOR_PUT);

      for(j=0; j<k; j++)
      {
	   putimage(X[i-j], Y[i-j], body, XOR_PUT);
      }

      if((X[i-j-1]-X[i-j])<0  && (Y[i-j-1]-Y[i-j])==0)
	    putimage(X[i-j], Y[i-j], tail1, XOR_PUT);

      if((X[i-j-1]-X[i-j])>0  && (Y[i-j-1]-Y[i-j])==0)
	    putimage(X[i-j], Y[i-j], tail2, XOR_PUT);

      if((X[i-j-1]-X[i-j])==0  && (Y[i-j-1]-Y[i-j])<0)
	    putimage(X[i-j], Y[i-j], tail3, XOR_PUT);

      if((X[i-j-1]-X[i-j])==0  && (Y[i-j-1]-Y[i-j])>0)
	    putimage(X[i-j], Y[i-j], tail4, XOR_PUT);

      delay(speed);

      if(second==1)
      {
	setcolor(15);
	outtextxy(maxx-140,360,"Press Any Key...");
	getch();
	setcolor(0);
	outtextxy(maxx-140,360,"Press Any Key...");
	a='6';

	second=2;
      }


      if(first==1)
      {
	setcolor(15);
	outtextxy(maxx-140,360,"Congratulations  ");
	sound(100);
	delay(300);
	nosound();
	getch();
	setcolor(0);
	outtextxy(maxx-140,360,"Congratulations  ");
	second++;
	first=2;

      }

	// erase old image
      if(a=='6')
	    putimage(x, y, head1, XOR_PUT);
      if(a=='4')
	    putimage(x, y, head2, XOR_PUT);
      if(a=='8')
	    putimage(x, y, head3, XOR_PUT);
      if(a=='5')
	    putimage(x, y, head4, XOR_PUT);


      for(j=0; j<k; j++)
      {
	   putimage(X[i-j], Y[i-j], body, XOR_PUT);

      }

      if((X[i-j-1]-X[i-j])<0  && (Y[i-j-1]-Y[i-j])==0)
	    putimage(X[i-j], Y[i-j], tail1, XOR_PUT);

      if((X[i-j-1]-X[i-j])>0  && (Y[i-j-1]-Y[i-j])==0)
	    putimage(X[i-j], Y[i-j], tail2, XOR_PUT);

      if((X[i-j-1]-X[i-j])==0  && (Y[i-j-1]-Y[i-j])<0)
	    putimage(X[i-j], Y[i-j], tail3, XOR_PUT);

      if((X[i-j-1]-X[i-j])==0  && (Y[i-j-1]-Y[i-j])>0)
	    putimage(X[i-j], Y[i-j], tail4, XOR_PUT);


      if(f==0)
      {
	putimage(r1,r2,food,XOR_PUT);
	f=1;
      }

      z--;
      if((x>=r1 && y>=r2 && x<=r1+10 && y<=r2+10) || (x<=r1 && y<=r2 &&
x>=r1-10 && y>=r2-10) || z==0)
      {
	if(z!=0)
	{
		sound(800);
		delay(20);
		setcolor(0);
		score += 10;
		outtextxy(maxx-50,250,scor);
		itoa(score,scor,10);
		if(score>hscore)
		{
			strcpy(hs,scor);
			setfillstyle(1,1);
			bar(maxx-140,337,maxx-20,348);
			setcolor(14);
			outtextxy(maxx-50,340,hs);
			outtextxy(maxx-140,340,"High Score  ");
			if(first==0)
			{
			first=1;
			}
		}
		setcolor(4);
		outtextxy(maxx-50,250,scor);
		k++;
	nosound();
	}
	z=100;
	putimage(r1,r2,food,XOR_PUT);
	repr1:
	r1=random(450);
	    if(r1<50)
	       goto repr1;
	repr2:
	r2=random(400);
	    if(r2<50)
		goto repr2;

	f=0;
      }


      i++;
      X[i]=x;
      Y[i]=y;

      b=a;
      if(kbhit())
      {
		rep:
		a=getche();

		if((b=='6' && a=='4') || (b=='4' && a=='6'))
			a=b;

		if((b=='8' && a=='5') || (b=='5' && a=='8'))
			a=b;

		if(a!='6' && a!='4' && a!='8' && a!='0' && a!='5')
			a=b;
      }

 /*     if(x>maxx-170)
	x=0;

      if(y>maxy)
	y=0;*/

      if(a=='8')
	y -= bo;

      if(a=='5')
	y += bo;

      if(a=='4')
	x -= bo;

      if(a=='6')
	x += bo;

      for(j=i+1; j<i-k; j--)
      {
	if((Y[i]>=Y[j] && Y[i]<=Y[j]+10) || (Y[i]<=Y[j] && Y[i]>=X[j]-10))
	{
		if((X[i]>=X[j] && X[i]<=X[j]+10) || (X[i]<=X[j] && X[i]>=X[j]-10))
		{
			a='0';
		}

		 outtextxy(maxx-140,360,"C ");


	}

	if((X[i]>=X[j] && X[i]<=X[j]+10) || (X[i]<=X[j] && X[i]>=X[j]-10))
	{
		if((Y[i]>=Y[j] && Y[i]<=Y[j]+10) || (Y[i]<=Y[j] && Y[i]>=X[j]-10))
		{
			a='0';
		}

			outtextxy(maxx-140,360,"C  ");
	}

       }

/*      for(j=i; j<i-k; j--)
      {
	if((y>=Y[j] && y<=Y[j]+10) || (y<=Y[j] && y>=Y[j]-10))
	{
		if((x>=X[j] && x<=X[j]+10) || (x<=X[j] && x>=X[j]-10))
		{
			a='5';
		}
	}

	if((x>=X[j] && x<=X[j]+10) || (x<=X[j] && x>=X[j]-10))
	{
		if((y>=Y[j] && y<=Y[j]+10) || (y<=Y[j] && y>=Y[j]-10))
		{
			a='5';
		}
	}
	if(j==0)
		break;
      }      */


  /*	if(x<=0)
	x=maxx-170;

	if(y<=0)
	y=maxy;*/

	if(maze==1)
	{
		if(x<=14 || x>=maxx-184 || y<=14 || y>=maxy-14)
		{
		   a='0';
		}
	}

   }

   if(score>hscore)
   {
	ofstream onfile("c:\tc\bin\rattle.txt");
	onfile<<scor;
	onfile.close();
   }

   setcolor(15);
   outtextxy(maxx-140,390,"    Gameover");
   sound(100);
   delay(400);
   nosound();
   getch();
   /* clean up */
   free(body);
   closegraph();

}
Esempio n. 12
0
void Brick(int x, int y, char Color)
{	int up[6] = { x,y,  x+20,y,  x,y+20 };			//for upper border portion
	int lw[6] = { x+20,y+20,  x+20,y,  x,y+20 };		//for lower border portion
	switch(Color)
	{  case BLUE:
		setcolor(BLUEBR);
		setfillstyle(1,BLUEBR);				//for upper border color
		fillpoly(3, up);
		setcolor(BLUEDR);
		setfillstyle(1,BLUEDR);				//for lower border color
		fillpoly(3, lw);
		setcolor(BLUE);
		setfillstyle(1,BLUE);				//for center box
		bar(x+5, y+5, x+15, y+15);
		break;
	  case RED:
		setcolor(REDBR);
		setfillstyle(1,REDBR);				//for upper border color
		fillpoly(3, up);
		setcolor(REDDR);
		setfillstyle(1,REDDR);				//for lower border color
		fillpoly(3, lw);
		setcolor(RED);
		setfillstyle(1,RED);		       	        //for center box
		bar(x+5, y+5, x+15, y+15);
		break;
	  case GREEN:
		setcolor(GREENBR);
		setfillstyle(1,GREENBR);			//for upper border color
		fillpoly(3, up);
		setcolor(GREENDR);
		setfillstyle(1,GREENDR);			//for lower border color
		fillpoly(3, lw);
		setcolor(GREEN);
		setfillstyle(1,GREEN);				//for center box
		bar(x+5, y+5, x+15, y+15);
		break;
	  case PURPLE:
		setcolor(PURPLEBR);
		setfillstyle(1,PURPLEBR);			//for upper border color
		fillpoly(3, up);
		setcolor(PURPLEDR);
		setfillstyle(1,PURPLEDR);			//for lower border color
		fillpoly(3, lw);
		setcolor(PURPLE);
		setfillstyle(1,PURPLE);				//for center box
		bar(x+5, y+5, x+15, y+15);
		break;
	  case YELLOW:
		setcolor(YELLOWBR);
		setfillstyle(1,YELLOWBR);			//for upper border color
		fillpoly(3, up);
		setcolor(YELLOWDR);
		setfillstyle(1,YELLOWDR);			//for lower border color
		fillpoly(3, lw);
		setcolor(YELLOW);
		setfillstyle(1,YELLOW);				//for center box
		bar(x+5, y+5, x+15, y+15);
		break;
	}
}
Esempio n. 13
0
int main(void)
{
	int gdriver = DETECT, gmode;
	int i, x, y,n=0;
	int poly[16];
	initgraph(&gdriver, &gmode, "c:\\tc\\bgi");
	//********************* legs *********************************
	x = 10;
	y =300;
	n = 0;
	poly[n++] = x+20;        /* 1st vertex */
	poly[n++] = y+102;
	poly[n++] = x+5;
	poly[n++] = y-50;
	poly[n++] = x+45;
	poly[n++] = y-50;
	poly[n++] = x+60;
	poly[n++] = y+102;
	setfillstyle(SOLID_FILL,YELLOW);
	fillpoly(4, poly);
	x = 7;
	y =300;
	n = 0;
	poly[n++] = x+115;        /* 1st vertex */
	poly[n++] = y+102;
	poly[n++] = x+137;
	poly[n++] = y-50;
	poly[n++] = x+172;
	poly[n++] = y-50;
	poly[n++] = x+152;
	poly[n++] = y+102;
	setfillstyle(SOLID_FILL,YELLOW);
	fillpoly(4, poly);
	//*************      mane         **********
	x = 50;
	y = 10;
	n=0;
	poly[n++] = x+10; //1
	poly[n++] = y+60;
	poly[n++] = x+60; //2
	poly[n++] = y+60;
	poly[n++] = x+140;//6
	poly[n++] = y+140;
	poly[n++] = x+140;//7
	poly[n++] = y+250;
	poly[n++] = x+50; //8
	poly[n++] = y+350;
	poly[n++] = x-50;  //9
	poly[n++] = y+250;
	poly[n++] = x-50; //10
	poly[n++] = y+140;
	setfillstyle(SOLID_FILL, BROWN);
	fillpoly(7, poly);
	//*************      mane         **********
	x = 50;
	n=0;
	y = 20;
	poly[n++] = x; //1
	poly[n++] = y+40;
	poly[n++] = x+30; //2
	poly[n++] = y+40;
	poly[n++] = x+45; //3
	poly[n++] = y+60;
	poly[n++] = x+60; //4
	poly[n++] = y+40;
	poly[n++] = x+90; //5
	poly[n++] = y+40;
	poly[n++] = x+130;//6
	poly[n++] = y+90;
	poly[n++] = x+130;//7
	poly[n++] = y+180;
	poly[n++] = x+50; //8
	poly[n++] = y+250;
	poly[n++] = x-40;  //9
	poly[n++] = y+190;
	poly[n++] = x-40; //10
	poly[n++] = y+100;
	setfillstyle(SOLID_FILL, BROWN);
	fillpoly(10, poly);
	//**************************** face ********************
	x = 50;
	y = 60;
	n = 0;
	poly[n++] = x+10;        /* 1st vertex */
	poly[n++] = y+30;
	poly[n++] = x+80; /* 2nd */
	poly[n++] = y+30;
	poly[n++] = x+105; /* 3rd */
	poly[n++] = y+70;
	poly[n++] = x+105; //4
	poly[n++] = y+130;
	poly[n++] = x+60; //5
	poly[n++] = y+170;
	poly[n++] = x+40;     //6
	poly[n++] = y+170;
	poly[n++] = x-15;     //72
	poly[n++] = y+130;
	poly[n++] = x-15;     //8
	poly[n++] = y+70;
	setfillstyle(SOLID_FILL, YELLOW);
	fillpoly(8, poly);
	//********************** mouth ****************************
	setcolor(BROWN);
	x = 60;
	y = 60;
	n = 0;
	poly[n++] = x+20;
	poly[n++] = y+120;
	poly[n++] = x+55;
	poly[n++] = y+120;
	poly[n++] = x+65;
	poly[n++] = y+130;
	poly[n++] = x+65; //4
	poly[n++] = y+160;
	poly[n++] = x+55; //5
	poly[n++] = y+170;
	poly[n++] = x+20;     //6
	poly[n++] = y+170;
	poly[n++] = x+10;     //7
	poly[n++] = y+160;
	poly[n++] = x+10;     //8
	poly[n++] = y+130;
	setfillstyle(SOLID_FILL, WHITE);
	fillpoly(8, poly);
	//************************ nose *****************************
	setcolor(BROWN);
	x = 60;
	y = 50;
	n = 0;
	poly[n++] = x+20;        /* 1st vertex */
	poly[n++] = y+130;
	poly[n++] = x+25;
	poly[n++] = y+120;
	poly[n++] = x+50;
	poly[n++] = y+120;
	poly[n++] = x+55; /* 2nd */
	poly[n++] = y+130;
	poly[n++] = x+38; /* 3rd */
	poly[n++] = y+145;
	setfillstyle(SOLID_FILL, RED);
	fillpoly(5, poly);
	line(110,170,112,160);
	line(108,140,112,160);
	line(85,170,83,160);
	line(87,140,83,160);
	/*line(83,175,85,190);
	line(135,175,110,180);
	line(110,180,117,205);
	line(115,220,117,205);
	line(100,215,100,245);
	line(100,275,75,300);
	line(100,235,125,250);  */
	//***************************** eyes ***********************
	//left
	x = 80;
	y =60;
	n = 0;
	poly[n++] = x+30;        /* 1st vertex */
	poly[n++] = y+82;
	poly[n++] = x+50;
	poly[n++] = y+77;
	poly[n++] = x+70;
	poly[n++] = y+82;
	poly[n++] = x+50;
	poly[n++] = y+87;
	setfillstyle(SOLID_FILL,RED);
	fillpoly(4, poly);
	//right
	x = 15;
	y =60;
	n = 0;
	poly[n++] = x+30;        /* 1st vertex */
	poly[n++] = y+82;
	poly[n++] = x+50;
	poly[n++] = y+77;
	poly[n++] = x+70;
	poly[n++] = y+82;
	poly[n++] = x+50;
	poly[n++] = y+87;
	setfillstyle(SOLID_FILL,RED);
	/* draw a filled polygon */
	fillpoly(4, poly);
	//**************************** paw ***************************
	x = 87;
	y =320;
	n = 0;
	poly[n++] = x+30;        /* 1st vertex */
	poly[n++] = y+82;
	poly[n++] = x+40;
	poly[n++] = y+67;
	poly[n++] = x+70;
	poly[n++] = y+67;
	poly[n++] = x+80;
	poly[n++] = y+82;
	poly[n++] = x+70;
	poly[n++] = y+92;
	poly[n++] = x+40;
	poly[n++] = y+92;
	setfillstyle(SOLID_FILL,YELLOW);
	fillpoly(6, poly);
	//right
	x = -5;
	y =320;
	n = 0;
	poly[n++] = x+30;        /* 1st vertex */
	poly[n++] = y+82;
	poly[n++] = x+40;
	poly[n++] = y+67;
	poly[n++] = x+70;
	poly[n++] = y+67;
	poly[n++] = x+80;
	poly[n++] = y+82;
	poly[n++] = x+70;
	poly[n++] = y+92;
	poly[n++] = x+40;
	poly[n++] = y+92;
	setfillstyle(SOLID_FILL,YELLOW);
	fillpoly(6, poly);
	getch();
	/* clean up */
	closegraph();
	return 0;
}
Esempio n. 14
0
//////////COMIENZA CODIGO PARA HONGO VOID HONGOCOMPLETO!!
void construccion ()
{ int poly [68];
	clearviewport();
	setbkcolor(WHITE);
poly[0]=200;
poly[1]=450;
//2              23
poly[2]=400;
poly[3]=450;
//3
poly[4]=400;
poly[5]=430;
//4
poly[6]=420;
poly[7]=430;
//5
poly[8]=420;
poly[9]=390;
//6
poly[10]=440;
poly[11]=390;
//7
poly[12]=440;
poly[13]=370;
//8
poly[14]=460;
poly[15]=370;
//9
poly[16]=460;
poly[17]=230;
//10
poly[18]=440;
poly[19]=230;
//11
poly[20]=440;
poly[21]=190;
//12
poly[22]=420;
poly[23]=190;
//13
poly[24]=420;
poly[25]=170;
//14
poly[26]=400;
poly[27]=170;
//15
poly[28]=400;
poly[29]=150;
//16
poly[30]=360;
poly[31]=150;
//17
poly[32]=360;
poly[33]=130;
//18
poly[34]=240;
poly[35]=130;
//19
poly[36]=240;
poly[37]=150;
//20
poly[38]=200;
poly[39]=150;
//21
poly[40]=200;
poly[41]=170;
//22
poly[42]=180;
poly[43]=170;
//23
poly[44]=180;
poly[45]=190;
//24
poly[46]=160;
poly[47]=190;
//25
poly[48]=160;
poly[49]=230;
//26
poly[50]=140;
poly[51]=230;
//27
poly[52]=140;
poly[53]=370;
//28
poly[54]=160;
poly[55]=370;
//29
poly[56]=160;
poly[57]=370;
//30
poly[58]=160;
poly[59]=390;
//31
poly[60]=180;
poly[61]=390;
//32
poly[62]=180;
poly[63]=430;
//33
poly[64]=200;
poly[65]=430;
//34
poly[66]=200;
poly[67]=450;
setcolor(0);
setfillstyle(1,1);
fillpoly (34,poly);
}
Esempio n. 15
0
void GetPathInstructions(vector<unsigned> Path){
    
    
    
    
    // First, draw a box in the graphics window, on which the path instructions 
    // will be displayed. 
    float tempXCenter = get_visible_world().get_xcenter();
    float tempYCenter = get_visible_world().get_ycenter();
    float BoxLeft = tempXCenter + 0.18 * get_visible_world().get_width();
    float BoxRight = tempXCenter + 0.48 * get_visible_world().get_width();
    float BoxBottom = tempYCenter - 0.48 * get_visible_world().get_height();
    float BoxTop = tempYCenter + 0.12 * get_visible_world().get_height();
    t_bound_box HelpBox(BoxLeft, BoxBottom, BoxRight, BoxTop);
    
    // string intro = "Welcome to Map-2-Go"; 
    
    setcolor(246, 246, 246);

    fillrect(HelpBox);

    
    // Draw the borders of the box. 
    setcolor(200, 200, 200);
    setlinewidth(6);

    t_point border[6];
    border[5].x = BoxRight;
    border[5].y = BoxTop;

    
    // Add depth to the box, making the user feel as if he or she is looking 
    // in 3D perspective at the box. 
    border[2].x = BoxLeft + 0.02 * HelpBox.get_width();
    border[2].y = BoxBottom - 0.02 * HelpBox.get_width();

    border[3].x = BoxRight + 0.02 * HelpBox.get_width();
    border[3].y = BoxBottom - 0.02 * HelpBox.get_width();

    border[4].x = BoxRight + 0.02 * HelpBox.get_width();
    border[4].y = BoxTop - 0.02 * HelpBox.get_width();

    border[0].x = BoxRight;
    border[0].y = BoxBottom;

    border[1].x = BoxLeft;
    border[1].y = BoxBottom;

    fillpoly(border, 6);
    setcolor(20, 20, 20);
    setlinewidth(1);

    drawrect(border[1], border[5]);

    drawline(border[1], border[2]);
    drawline(border[2], border[3]);
    drawline(border[3], border[0]);
    drawline(border[4], border[5]);
    drawline(border[4], border[3]);
    
    // From now on, start displaying the path instructions. 
    
    settextrotation(0); 
    setcolor(20,20,20); 
    setfontsize(12); 
    
    string InstructionLabel = "Path Instructions"; 
    
    // Write "Path Instructions" onto the box in the graphics window. 
    drawtext(HelpBox.left() + 0.5 * HelpBox.get_width(), HelpBox.top() - 0.03 * HelpBox.get_height(), InstructionLabel, HelpBox.get_width(), HelpBox.get_height());

    // Draw a line separating the header above from the instructions later on. 
    setlinewidth(2);
    drawline(HelpBox.left() + 0.05 * HelpBox.get_width(), HelpBox.top() - 0.06 * HelpBox.get_height(), HelpBox.right() - 0.05 * HelpBox.get_width(), HelpBox.top() - 0.06 * HelpBox.get_height()); //splitline 

    settextrotation(0); 
    setcolor(20,20,20); 
    setfontsize(10); 
   
    
    /////////////////////////////////////////////////////////
   
    bool differentStreet; // Bool flag to determine if two street segments belong to different streets. 
    bool needExtraLine; // Bool flag to determine if obtained path instruction has too many characters 
    // to fit in the width of the box. 
    
    int numLines = 0; // This counter determines how far down the box each subsequent instruction will be displayed at. 
    int displayStraightInstruction = 0; // When this integer counter is zero, a path instruction that has "Go Straight" 
    // will be displayed once, but if the subsequent instruction is still "Go Straight", the integer counter will have 
    // incremented by one already - thus preventing the redundant instruction rom being displayed. 
    
    // Traverse the vector of street segments, and access the current and current+1 street segment with each iteration. 
    for (unsigned i = 0; i < Path.size()-1; i++){
        
 
        
        int LeftOrRight = 3; // This integer determines whether to turn right, left, or go straight. It is initialized 
        // to 3 for each iteration, so as not to match any of the above cases initially. 
        
        string tempString; // This will store the path instruction. 
        string tempString2; // This will store the remainder of the path instruction, if the instruction is longer than 
        // 50 characters and will potentially be cut off. 
        
        // The bool flags are initially set to false, for each iteration. 
        differentStreet = false; 
        needExtraLine = false; 
        
        // Obtain street name of the first street segment. 
        string StreetName1 = getStreetName(getStreetSegmentStreetID(Path[i])); 
        // Obtain street name of the second street segment. 
        string StreetName2 = getStreetName(getStreetSegmentStreetID(Path[i+1])); 
        
        // If the second segment's street name is "(unknown)" or " ", then do not go and create 
        // a proper path instruction for it. 
        if ((StreetName2 != "(unknown)") && (StreetName2 != " ")){
            
            // If the second segment's street name WAS ACTUALLY a valid name...
            
            // If the two street names are different, the user will then go onto a different street, so 
            // set the flag to true. 
            if (StreetName2!=StreetName1){
                differentStreet = true; 
            }

            // Call TurnLeftOrRight function to determine which way to turn. 
            // If the returned value is 2, turn right; if the value is 0, turn left; 
            // else if the value is 1, go straight. 
            LeftOrRight = TurnLeftOrRight(Path[i],Path[i+1]); 
            if (LeftOrRight==2){
                tempString.append("Turn right");
                //displayStraightInstruction = 0; // If turning right, automatically enable the instruction to be 
                // displayed again, regardless of whether or not the street name remains the same. 
            } 
            else if (LeftOrRight==1){
                tempString.append("Go straight"); 
            } 
            else if (LeftOrRight==0){
                tempString.append("Turn left"); 
                //displayStraightInstruction = 0; // If turning left, automatically enable the instruction to be 
                // displayed again, regardless of whether or not the street name remains the same. 
            } 

            /////////////////////////////////////////////////////////
            
            // If the user does go onto a different street, add " onto " into the instruction. 
            if (differentStreet){
                tempString.append(" onto "); 
                tempString.append(StreetName2);
                displayStraightInstruction = 0; // If different street names, set the displayStraightInstruction counter 
                // back to zero, so that subsequent "Go Straight" instructions can be displayed at least once. 
            }
            else{ // If the user does NOT go onto a different street, add " along " into the instruction. 
                tempString.append(" along "); 
                tempString.append(StreetName2); 
            }
            
            /////////////////////////////////////////////////////////

            // If the string length is two wide to fit onto the box (max 50 characters), 
            // store the remainder of the string into a second string, and print it on the next line. 
            if (tempString.length()>=50){
                needExtraLine = true; 
                size_t pos = tempString.find_last_of(' ',string::npos); // Find the last occurrence of whitespace in the string.  
                tempString2 = tempString.substr(pos+1,30);
                tempString.erase(pos,string::npos); 
            }
            
            /////////////////////////////////////////////////////////
            
            // The following if case only applies to an instruction if it tells the user to "Go Straight". 
            // For the first occurrence of "Go Straight", the instruction will be displayed, but if it appears 
            // consecutively many times afterwards, the instructions will be disabled by incrementing the 
            // displayStraightInstruction counter. 
            if (displayStraightInstruction < 1){
                // Draw the text onto the box. 
                drawtext(HelpBox.left() + 0.5 * HelpBox.get_width(), HelpBox.top() - (0.10 +0.04*numLines) * HelpBox.get_height(), tempString, HelpBox.get_width(), HelpBox.get_height());
                numLines++; // Increment the numLines counter so set the subsequent line further down the box. 
                if (needExtraLine){ // If an extra line is needed, display this instruction too. 
                    drawtext(HelpBox.left() + 0.5 * HelpBox.get_width(), HelpBox.top() - (0.10 +0.04*numLines) * HelpBox.get_height(), tempString2, HelpBox.get_width(), HelpBox.get_height());
                    numLines++; 
                }
            }
            
            // Before iterating the overall for loop again and checking the next two segments, check if 
            // the instruction this time was 
            if (!differentStreet)
                displayStraightInstruction++; 

        }
        
    }
    
    // After exiting the for loop and displaying all instructions, display this message for users to 
    // know how to clear the screen of any displayed path or path instructions. 
    string endMessage = "Press 'Esc' to clear the path instructions. "; 
    drawtext(HelpBox.left() + 0.5 * HelpBox.get_width(), HelpBox.top() - (0.10 +0.04*numLines + 0.015) * HelpBox.get_height(), endMessage, HelpBox.get_width(), HelpBox.get_height());
    // DisplayPathInstructions(InstructionVector); 
    
} 
Esempio n. 16
0
void graphicize()
{
    clrscr();
    int gd = DETECT, gm, errorcode;
    int rect[8]={0};
    initgraph(&gd, &gm, "c://turboc3/tc/bgi");
    errorcode = graphresult();
    if (errorcode != grOk)
    {
       cout << ":: Graphics error ::";
       cout << "\nCheck the BGI Directory Path for Graphics Files";
       getch();
       exit(1);
    }
    int gmx=getmaxx();
    int gmy=getmaxy();
    setviewport((gmx-600)/2, (gmy-200)/2, ((gmx-600)/2)+600, ((gmy-200)/2)+200, 1);
    setbkcolor(3);
    setcolor(1);
    line(0,0,600,0);line(0,30,600,30);line(0,60,600,60);
    line(0,90,600,90);line(0,120,600,120);line(0,150,600,150);
    line(0,180,600,180);
    int r;

    int l;
    for(l=0;l<gsize;l++)
    {
	rect[0]=gtable[l][1];
	rect[1]=(gtable[l][0]-1)*30;
	rect[2]=gtable[l][2];
	rect[3]=(gtable[l][0]-1)*30;
	rect[4]=gtable[l][2];
	rect[5]=gtable[l][0]*30;
	rect[6]=gtable[l][1];
	rect[7]=gtable[l][0]*30;
	setfillstyle(SOLID_FILL,6);
	fillpoly(4,rect);
    }
    setviewport((gmx-600)/2+3, (gmy-200)/2-20, ((gmx-600)/2)+600, ((gmy-200)/2)+200, 1);
    outtextxy(0,5,"01");
    outtextxy(20,5,"02");
    outtextxy(40,5,"03");
    outtextxy(60,5,"04");
    outtextxy(80,5,"05");
    outtextxy(100,5,"06");
    outtextxy(120,5,"07");
    outtextxy(140,5,"08");
    outtextxy(160,5,"09");
    outtextxy(180,5,"10");
    outtextxy(200,5,"11");
    outtextxy(220,5,"12");
    outtextxy(240,5,"13");
    outtextxy(260,5,"14");
    outtextxy(280,5,"15");
    outtextxy(300,5,"16");
    outtextxy(320,5,"17");
    outtextxy(340,5,"18");
    outtextxy(360,5,"19");
    outtextxy(380,5,"20");
    outtextxy(400,5,"21");
    outtextxy(420,5,"22");
    outtextxy(440,5,"23");
    outtextxy(460,5,"24");
    outtextxy(480,5,"25");
    outtextxy(500,5,"26");
    outtextxy(520,5,"27");
    outtextxy(540,5,"28");
    outtextxy(560,5,"29");
    outtextxy(580,5,"30");
    setviewport((gmx-600)/2, (gmy-200)/2-20, ((gmx-600)/2)+600, ((gmy-200)/2)+200, 1);
    line(0,0,600,0);
    for(r=0;r<31;r++)
    {
	line(20*r,0,20*r,200);
    }

    setviewport((gmx-600)/2, 50 , ((gmx-600)/2)+600, ((gmy-200)/2)+200, 1);
    setcolor(4);
    settextstyle(DEFAULT_FONT,HORIZ_DIR,3);
    outtext("GANNT CHART");
    setviewport((gmx-600)/2, 80 , ((gmx-600)/2)+600, ((gmy-200)/2)+200, 1);
    setcolor(8);
    settextstyle(DEFAULT_FONT,HORIZ_DIR,1);
    outtext("No. of Processes : ");

    if(n==1) outtext("1");
    if(n==2) outtext("2");
    if(n==3) outtext("3");
    if(n==4) outtext("4");
    if(n==5) outtext("5");
    if(n==6) outtext("6");
    setviewport((gmx-600)/2, 100 , ((gmx-600)/2)+600, ((gmy-200)/2)+200, 1);

    outtext("Scheduling Method : ");
    if(choice=='1') outtext("FCFS - First Come First Serve");
    if(choice=='2') outtext("SJF - Shortest Job First");
    if(choice=='3') outtext("SRTF - Shortest Remaining Time First");
    if(choice=='4') outtext("RR - Round Robin");
    setviewport((gmx-600)/2-10, (gmy-200)/2, ((gmx-600)/2)+600, ((gmy-200)/2)+200, 1);
    setcolor(1);
    outtextxy(0,25-15,"1");
    outtextxy(0,55-15,"2");
    outtextxy(0,85-15,"3");
    outtextxy(0,115-15,"4");
    outtextxy(0,145-15,"5");
    outtextxy(0,175-15,"6");

    getch();
    closegraph();
}
void CGameControllerRalla3::Tick()
{
    if (g_Game.Keyboard.KeyPressed)
    {
        switch(g_Game.Keyboard.Key)
        {
            case 13:
                if (g_Game.m_WorldPaused && m_PlayerWin != PLAYER_NULL)
                {
                    g_Game.m_GameState = CGameContext::GAME_MENU;
                    return;
                }
                break;
        }
    }

    if (!g_Game.m_WorldPaused)
    {
        /** Captar Raton **/
        if (g_Game.Mouse.m_isPressed)
        {
            vec2 m_MousePos = vec2(mousex(), mousey());

            for (int i=0; i<3;i++)
            {
                for (int o=0;o<3;o++)
                {
                    if (m_MousePos.x > g_Game.GetScreenW()/2-dimTX/2 + dimTX/3*o && m_MousePos.x <= g_Game.GetScreenW()/2-dimTX/2 + dimTX/3*(o+1)
                        && m_MousePos.y >= 20+((dimTY/3)*i) && m_MousePos.y <= 20+((dimTY/3)*(i+1)))
                    {
                        if (v_GameTable[i][o] != PLAYER_NULL)
                        {
                            m_Indicator.m_Timer = GetTickCount() + 1000 * 0.15f;
                            m_Indicator.m_Pos = vec2(g_Game.GetScreenW()/2-dimTX/2 + dimTX/3*o, 20+((dimTY/3)*i));
                            continue;
                        }

                        v_GameTable[i][o] = m_ActivePlayer;
                        CheckWinner(m_ActivePlayer);

                        if (m_CPU)
                            m_ActivePlayer = (m_ActivePlayer==PLAYER_1)?PLAYER_CPU:PLAYER_1;
                        else
                            m_ActivePlayer = (m_ActivePlayer==PLAYER_1)?PLAYER_2:PLAYER_1;
                    }
                }
            }
            clearmouseclick(WM_LBUTTONDOWN);
        }

        //Comprobar Empate
        if (m_PlayerWin == PLAYER_NULL)
        {
            bool draw=true;
            for (int i=0; i<3; i++)
            {
                for (int o=0; o<3; o++)
                    if (v_GameTable[i][o] == PLAYER_NULL)
                    {
                        draw=false;
                        break;
                    }
            }
            if (draw)
            {
                m_PlayerWin = PLAYER_DRAW;
                EndRound();
            }
        }

        //Jugada de la Makina
        if (m_PlayerWin == PLAYER_NULL && m_ActivePlayer == PLAYER_CPU)
        {
            int i, o;
            bool error = true;
            for (int i=rand()%3; i<3; i++)
            {
                for (int o=rand()%3; o<3; o++)
                {
                    if (v_GameTable[i][o] == PLAYER_NULL)
                    {
                        if ((i-1 > 0 && (v_GameTable[i-1][o] == PLAYER_NULL || v_GameTable[i-1][o] == PLAYER_CPU))
                            || (i+i<3 && (v_GameTable[i+1][o] == PLAYER_NULL || v_GameTable[i+1][o] == PLAYER_CPU))
                            || (o-1 > 0 && (v_GameTable[i][o-1] == PLAYER_NULL || v_GameTable[i][o-1] == PLAYER_CPU))
                            || (o+1 > 0 && (v_GameTable[i][o+1] == PLAYER_NULL || v_GameTable[i][o+1] == PLAYER_CPU))
                            || (i-1>0 && o-1>0 && (v_GameTable[i-1][o-1] == PLAYER_NULL || v_GameTable[i-1][o-1] == PLAYER_CPU))
                            || (i+1<3 && o-1>0 && (v_GameTable[i+1][o-1] == PLAYER_NULL || v_GameTable[i+1][o-1] == PLAYER_CPU))
                            || (i+1<3 && o+1<3 && (v_GameTable[i+1][o+1] == PLAYER_NULL || v_GameTable[i+1][o+1] == PLAYER_CPU))
                            || (i-1>0 && o+1<3 && (v_GameTable[i-1][o+1] == PLAYER_NULL || v_GameTable[i-1][o+1] == PLAYER_CPU)))
                        {
                            v_GameTable[i][o]=PLAYER_CPU;
                            error = false;
                            break;
                        }
                    }
                }

                if (!error)
                    break;
            }

            if (error)
            {
                do {
                    i=rand() % 3;
                    o=rand() % 3;
                } while (v_GameTable[i][o] != PLAYER_NULL);

                v_GameTable[i][o]=PLAYER_CPU;
            }

            CheckWinner(PLAYER_CPU);
            m_ActivePlayer = PLAYER_1;
        }

        //Resetear Color Indicador
        if (GetTickCount() < m_Indicator.m_Timer)
        {
            setfillstyle(SOLID_FILL, RED);
            int points[4*2];
            points[0]=static_cast<int>(m_Indicator.m_Pos.x);
            points[1]=static_cast<int>(m_Indicator.m_Pos.y);
            points[2]=static_cast<int>(m_Indicator.m_Pos.x) + dimTX/3;
            points[3]=points[1];
            points[4]=points[2];
            points[5]=static_cast<int>(m_Indicator.m_Pos.y) + dimTY/3;
            points[6]=points[0];
            points[7]=points[5];
            fillpoly(4, points);
        }
    }

    /** Dibujar Tablero **/
    int offsetx = dimTX/3;
    int offsety = dimTY/3;

    setcolor(DARKGRAY);
    for (int i=offsety; i<dimTY-dimTY/3; i+=offsety)
    {
        moveto(g_Game.GetScreenW()/2-dimTX/2, i+20);
        lineto(g_Game.GetScreenW()/2-dimTX/2+dimTX, i+20);
    }
    for (int i=offsetx; i<dimTX-dimTX/3; i+=offsetx)
    {
        moveto(g_Game.GetScreenW()/2-dimTX/2+i, 1+20);
        lineto(g_Game.GetScreenW()/2-dimTX/2+i, dimTY+20);
    }
    setcolor(WHITE);
    //Fichas
    for (int i=0;i<3;i++)
    {
        for (int o=0;o<3;o++)
        {
            if (v_GameTable[i][o] == PLAYER_NULL)
                continue;

            if (v_GameTable[i][o] == PLAYER_1)
            {
                circle(g_Game.GetScreenW()/2-dimTX/2 + dimTX/3*(o+1) - ((dimTX/3)/2), 20+dimTY/3*(i+1) - (dimTY/3)/2, 25);
            }
            else
            {
                moveto(g_Game.GetScreenW()/2-dimTX/2 + dimTX/3*(o+1)-((dimTX/3)/2) -25, 20+dimTY/3*(i+1)-(dimTY/3)/2 -25);
                lineto(g_Game.GetScreenW()/2-dimTX/2 + dimTX/3*(o+1)-((dimTX/3)/2) +25, 20+dimTY/3*(i+1)-(dimTY/3)/2 +25);
                moveto(g_Game.GetScreenW()/2-dimTX/2 + dimTX/3*(o+1)-((dimTX/3)/2) +25, 20+dimTY/3*(i+1)-(dimTY/3)/2 -25);
                lineto(g_Game.GetScreenW()/2-dimTX/2 + dimTX/3*(o+1)-((dimTX/3)/2) -25, 20+dimTY/3*(i+1)-(dimTY/3)/2 +25);
            }
        }
    }
}
Esempio n. 18
0
/*右上の葉っぱの描画関数*/
void rightleaf(void){
  float x5[29], y5[29];//座標の配列
  
  /*葉っぱ部分*/
  newhsvcolor(win, 122, 255, 200);

  x5[0]=616.0;    y5[0]=676.0;
  x5[1]=618.0;    y5[1]=679.0;
  x5[2]=628.0;    y5[2]=679.0;
  x5[3]=645.0;    y5[3]=692.0;
  x5[4]=676.0;    y5[4]=696.0;
  x5[5]=675.0;    y5[5]=692.0;
  x5[6]=690.0;    y5[6]=693.0;
  x5[7]=693.0;    y5[7]=690.0;
  x5[8]=690.0;    y5[8]=684.0;
  x5[9]=699.0;    y5[9]=680.0;
  x5[10]=706.0;    y5[10]=674.0;
  x5[11]=717.0;    y5[11]=667.0;
  x5[12]=733.0;    y5[12]=653.0;
  x5[13]=743.0;    y5[13]=633.0;
  x5[14]=747.0;    y5[14]=626.0;
  x5[15]=747.0;    y5[15]=619.0;
  x5[16]=741.0;    y5[16]=617.0;
  x5[17]=722.0;    y5[17]=617.0;
  x5[18]=721.0;    y5[18]=615.0;
  x5[19]=692.0;    y5[19]=617.0;
  x5[20]=691.0;    y5[20]=613.0;
  x5[21]=686.0;    y5[21]=612.0;
  x5[22]=685.0;    y5[22]=615.0;
  x5[23]=679.0;    y5[23]=619.0;
  x5[24]=670.0;    y5[24]=621.0;
  x5[25]=663.0;    y5[25]=629.0;
  x5[26]=639.0;    y5[26]=646.0;
  x5[27]=628.0;    y5[27]=661.0;
  x5[28]=614.0;    y5[28]=672.0;
  
  fillpoly(win, x5, y5, 29, 0);
  
  /*葉脈を描く*/
  newlinewidth(win, THICK);//葉脈の太さ
  newhsvcolor(win, 122, 153, 255);//色指定
  
  moveto(win, 614, 673);
  lineto(win, 638, 672);
  lineto(win, 680, 673);
  
  moveto(win, 652, 671);/*主となる部分*/
  lineto(win, 684, 663);
  lineto(win, 689, 659);
  lineto(win, 705, 647);
  lineto(win, 717, 640);
  lineto(win, 727, 637);
  lineto(win, 731, 632);
  lineto(win, 739, 627);
  
  moveto(win, 689, 659);/*中上*/
  lineto(win, 702, 659);
  lineto(win, 710, 657);
  
  moveto(win, 667, 665);/*下1*/
  lineto(win, 674, 662);
  lineto(win, 680, 638);
    
  moveto(win, 705, 645);/*下2*/
  lineto(win, 715, 625);  
}
Esempio n. 19
0
 void draw(int xmax,int ymax,int *poly)
 {
   x=60;
   int i=0;

   START:
      setfillstyle(7,RED);
      cleardevice();
      int fire_poly[]={65,80+i,65,180+i,55,130+i,25,200+i,25,100+i,40,140+i,65,80+i};

   switch(i)
   {

     case 0:  drawpoly(5, poly);
		//tree(x,ymax);
	       drawpoly(7,fire_poly);
	       setfillstyle(5,YELLOW);
	       fillpoly(7,fire_poly);
	       man_mv(x,ymax);
		delay(300);
		switch(path)
	      {
	       case 0:    if(p==11)
			  {
			   getch();
			   cleardevice();
			   outtextxy(xmax/2,ymax/2,"LOST LIFE\n Press any key to Continue........\n");
			   p=-1;
			   path=random(3);
			   getch();
			  }
			  else if(p==9)
			   p=-1;


			   switch(p)
			 {
			  case -1: bird(20,1); p++;
				   break;
			  case 0: bird(a,b);
				  p++;
				  break;
			  case 1: bird(2*a,b);
				  p++;
				  break;
			  case 2: bird(3*a,2*b); p++;
				  break;
			  case 3: bird(2*a,3*b); p++;
				  break;
			  case 4: bird(4*a,4*b); p++;
				  if(x==380)
				     p++;
				  break;
			  case 5: bird(4*a,ymax-60);
				  break;
			  case 6: bird(4*a,3*b); p++;
				  break;
			  case 7: bird(2*a,2*b); p++;
				  break;
			  case 8: bird(a,4*b);
				  if(x==60)
				   p=9;
				  else
				   p=11;
				  break;
			  case 9: bird(a-20,3*b);
				  delay(1000);
				  break;
			  /*case 10:bird(4*a,ymax-60);
				  getch();
				  //delay(1000);
				  break; */
			  case 11:bird(a,ymax-60);
				  //delay(1000);
				  break;

			 }

	      i+=150;
	     if(!kbhit())
	  {
	     delay(300);
	   goto START;
	  }
       ch=getch();
       delay(100);
       switch(ch)
       {
	 case 'a': if(x==60) ;
		   else   x-=160;
		  break;
	case 'd': if(x==540) ;
		   else  x+=160;
		  break;
       }
	  goto START;

	    case 1:      if(p==11)
			  {
			   getch();
			   cleardevice();
				   outtextxy(xmax/2,ymax/2,"LOST LIFE\n Press any key to Continue........\n");

			   p=-1;
			   path=random(3);
			   getch();
			  }
			  else if(p==9)
			   p=-1;


			   switch(p)
			 {
			  case -1: bird(20,1); p++;
				   break;
			  case 0: bird(a,b);
				  p++;
				  break;
			  case 1: bird(2*a,3*b);
				  p++;
				  break;
			  case 2: bird(3*a,2*b); p++;
				  break;
			  case 3: bird(4*a,3*b); p++;
				  break;
			  case 4: bird(5*a,4*b); p++;
				  if(x==540)
				     p++;
				  break;
			  case 5: bird(5*a,ymax-60);
				  break;
			  case 6: bird(4*a,3*b); p++;
				  break;
			  case 7: bird(2*a,3*b); p++;
				  break;
			  case 8: bird(a,4*b);
				  if(x==60)
				   p=9;
				  else
				   p=11;
				  break;
			  case 9: bird(a-20,3*b);
				  delay(1000);
				  break;
			  /*case 10:bird(4*a,ymax-60);
				  getch();
				  //delay(1000);
				  break; */
			  case 11:bird(a,ymax-60);
				  //delay(1000);
				  break;

			 }

	       i+=150;
		 if(!kbhit())
		{
		 delay(300);
		 goto START;
		}
	ch=getch();
	delay(100);
	switch(ch)
       {
	 case 'a': if(x==60) ;
		   else   x-=160;
		  break;
	case 'd': if(x==540) ;
		   else  x+=160;
		  break;
       }
	  goto START;

   }  break;

   case 150:   drawpoly(5, poly);
		//tree(x,ymax);
		drawpoly(7,fire_poly);
		setfillstyle(5,RED);
	       fillpoly(7,fire_poly);
		man_mv(x,ymax);
		 delay(300);
	       switch(path)
	      {
	       case 0:   if(p==5)
			  {
			   getch();
			   //cleardevice();
			   outtextxy(xmax/2,ymax/2,"LOST LIFE\n Press any key to Continue........\n");
			     p=-1;
			   path=random(3);
			   getch();
			  }
			  else if(p==9)
			   p=-1;


			    switch(p)
			 {
			  case -1: bird(20,1); p++;
				   break;
			  case 0: bird(a,b); p++;
				  break;
			  case 1: bird(2*a,b); p++;
				  break;
			  case 2: bird(3*a,2*b); p++;
				  break;
			  case 3: bird(2*a,3*b); p++;
				  break;
			  case 4: bird(4*a,4*b); p++;
				  if(x==380)
				     p++;
				  break;
			  case 5: bird(4*a,ymax-60);
				  break;
			  case 6: bird(4*a,3*b); p++;
				  break;
			  case 7: bird(2*a,2*b); p++;
				  break;
			  case 8: bird(a,4*b);
				  if(x==60)
				   p=9;
				  else
				   p=11;
				  break;
			  case 9: bird(a-20,3*b);
				  delay(1000);
				  break;
			  /*case 10:bird(4*a,ymax-60);
				  getch();
				 // delay(1000);
				  break;  */
			  case 11:bird(a,ymax-60);
				 // delay(1000);
				  break;

			  }

		i=0;
		if(!kbhit())
		 {
		 delay(600);
		 goto START;
		 }
		 ch=getch();
		delay(100);
	       switch(ch)
	       {
		case 'a': if(x==60) ;
			   else   x-=160;
			  break;
		case 'd': if(x==540) ;
			   else  x+=160;
			  break;
	       }
	      goto START;


	    case 1:      if(p==5)
			  {
			   getch();
			   cleardevice();
				   outtextxy(xmax/2,ymax/2,"LOST LIFE\n Press any key to Continue........\n");
			   p=-1;
			   path=random(3);
			   getch();
			  }
			  else if(p==9)
			   p=-1;


			   switch(p)
			 {
			  case -1: bird(20,1); p++;
				   break;
			  case 0: bird(a,b);
				  p++;
				  break;
			  case 1: bird(2*a,3*b);
				  p++;
				  break;
			  case 2: bird(3*a,2*b); p++;
				  break;
			  case 3: bird(4*a,3*b); p++;
				  break;
			  case 4: bird(5*a,4*b); p++;
				  if(x==540)
				     p++;
				  break;
			  case 5: bird(5*a,ymax-60);
				  break;
			  case 6: bird(4*a,3*b); p++;
				  break;
			  case 7: bird(2*a,3*b); p++;
				  break;
			  case 8: bird(a,4*b);
				  if(x==60)
				   p=9;
				  else
				   p=11;
				  break;
			  case 9: bird(a-20,3*b);
				  delay(1000);
				  break;
			  /*case 10:bird(4*a,ymax-60);
				  getch();
				  //delay(1000);
				  break; */
			  case 11:bird(a,ymax-60);
				  //delay(1000);
				  break;

			 }



		i=0;
		if(!kbhit())
		 {
		 delay(600);
		 goto START;
		 }
		 ch=getch();
		delay(100);
	       switch(ch)
	       {
		case 'a': if(x==60) ;
			   else   x-=160;
			  break;
		case 'd': if(x==540) ;
			   else  x+=160;
			  break;
	       }
	      goto START;
  } break;

 }
 }
Esempio n. 20
0
/*下の葉っぱを描く関数*/
void underleaf(void){
  float x7[49], y7[49];//座標の配列

  /*葉っぱ部分*/
  newhsvcolor(win, 122, 255, 200);//色指定

  x7[0]=648.0;    y7[0]=588.0;
  x7[1]=640.0;    y7[1]=585.0;
  x7[2]=636.0;    y7[2]=580.0;
  x7[3]=628.0;    y7[3]=572.0;
  x7[4]=618.0;    y7[4]=570.0;
  x7[5]=609.0;    y7[5]=562.0;
  x7[6]=606.0;    y7[6]=555.0;
  x7[7]=594.0;    y7[7]=527.0;
  x7[8]=589.0;    y7[8]=519.0;
  x7[9]=587.0;    y7[9]=513.0;
  x7[10]=588.0;    y7[10]=504.0;
  x7[11]=585.0;    y7[11]=503.0;
  x7[12]=587.0;    y7[12]=490.0;
  x7[13]=588.0;    y7[13]=481.0;
  x7[14]=593.0;    y7[14]=472.0;
  x7[15]=595.0;    y7[15]=466.0;
  x7[16]=604.0;    y7[16]=466.0;
  x7[17]=606.0;    y7[17]=468.0;
  x7[18]=607.0;    y7[18]=453.0;
  x7[19]=625.0;    y7[19]=431.0;
  x7[20]=642.0;    y7[20]=418.0;
  x7[21]=646.0;    y7[21]=415.0;
  x7[22]=648.0;    y7[22]=412.0;
  x7[23]=658.0;    y7[23]=412.0;
  x7[24]=658.0;    y7[24]=408.0;
  x7[25]=689.0;    y7[25]=410.0;
  x7[26]=692.0;    y7[26]=415.0;
  x7[27]=692.0;    y7[27]=456.0;
  x7[28]=688.0;    y7[28]=459.0;
  x7[29]=695.0;    y7[29]=477.0;
  x7[30]=696.0;    y7[30]=470.0;
  x7[31]=699.0;    y7[31]=470.0;
  x7[32]=698.0;    y7[32]=494.0;
  x7[33]=701.0;    y7[33]=500.0;
  x7[34]=704.0;    y7[34]=499.0;
  x7[35]=707.0;    y7[35]=496.0;
  x7[36]=712.0;    y7[36]=496.0;
  x7[37]=712.0;    y7[37]=507.0;
  x7[38]=706.0;    y7[38]=515.0;
  x7[39]=705.0;    y7[39]=522.0;
  x7[40]=700.0;    y7[40]=533.0;
  x7[41]=700.0;    y7[41]=543.0;
  x7[42]=691.0;    y7[42]=558.0;
  x7[43]=677.0;    y7[43]=567.0;
  x7[44]=673.0;    y7[44]=574.0;
  x7[45]=669.0;    y7[45]=584.0;
  x7[46]=662.0;    y7[46]=587.0;
  x7[47]=651.0;    y7[47]=587.0;
  x7[48]=654.0;    y7[48]=589.0;
  
  fillpoly(win, x7, y7, 49, 0);
  
  /*葉脈を描く*/
  newlinewidth(win, THICK);//葉脈の太さ指定
  newhsvcolor(win, 122, 153, 255);//色指定
  
  moveto(win, 650, 587);/*主となる部分(左下まで)*/
  lineto(win, 650, 574);
  lineto(win, 650, 553);
  lineto(win, 650, 519);
  lineto(win, 649, 491);
  lineto(win, 647, 458);
  lineto(win, 643, 445);
  
  moveto(win, 650, 574);/*左上1*/
  lineto(win, 645, 565);
  
  moveto(win, 650, 553);/*左上2*/
  lineto(win, 640, 524);
  lineto(win, 606, 482);
    
  moveto(win, 650, 519);/*右上2*/
  lineto(win, 661, 508);
  lineto(win, 665, 496);
  
  moveto(win, 649, 491);/*右下3*/
  lineto(win, 656, 483);
  lineto(win, 659, 468);
  lineto(win, 666, 457);
  lineto(win, 675, 439);
  
  moveto(win, 654, 568);/*右上1*/
  lineto(win, 662, 553);
  lineto(win, 667, 548);
  lineto(win, 677, 536);
  lineto(win, 689, 516);
}
Esempio n. 21
0
	//draws the bar as per the current location of the bar
	void drawBar(){
	fillpoly(4,bar);
	}
Esempio n. 22
0
/*水滴が落ちる部分の葉っぱ(一番上)*/
void mainleaf(void){
  float x3[41], y3[41];//座標の配列

  /*葉っぱ部分*/
  newhsvcolor(win, 122, 255, 200);//色指定
  x3[0]=416.0;    y3[0]=767.0;
  x3[1]=419.0;    y3[1]=763.0;
  x3[2]=352.0;    y3[2]=759.0;
  x3[3]=288.0;    y3[3]=718.0;
  x3[4]=312.0;    y3[4]=719.0;
  x3[5]=307.0;    y3[5]=711.0;
  x3[6]=305.0;    y3[6]=707.0;
  x3[7]=303.0;    y3[7]=696.0;
  x3[8]=300.0;    y3[8]=695.0;
  x3[9]=300.0;    y3[9]=692.0;
  x3[10]=286.0;    y3[10]=661.0;
  x3[11]=281.0;    y3[11]=657.0;
  x3[12]=281.0;    y3[12]=651.0;
  x3[13]=277.0;    y3[13]=647.0;
  x3[14]=272.0;    y3[14]=628.0;
  x3[15]=271.0;    y3[15]=624.0;
  x3[16]=270.0;    y3[16]=613.0;
  x3[17]=275.0;    y3[17]=613.0;
  x3[18]=293.0;    y3[18]=613.0;
  x3[19]=295.0;    y3[19]=615.0;
  x3[20]=305.0;    y3[20]=615.0;
  x3[21]=342.0;    y3[21]=627.0;
  x3[22]=343.0;    y3[22]=621.0;
  x3[23]=370.0;    y3[23]=635.0;
  x3[24]=383.0;    y3[24]=636.0;
  x3[25]=399.0;    y3[25]=647.0;
  x3[26]=418.0;    y3[26]=669.0;
  x3[27]=421.0;    y3[27]=676.0;
  x3[28]=423.0;    y3[28]=671.0;
  x3[29]=427.0;    y3[29]=679.0;
  x3[30]=428.0;    y3[30]=686.0;
  x3[31]=429.0;    y3[31]=688.0;
  x3[32]=428.0;    y3[32]=702.0;
  x3[33]=431.0;    y3[33]=705.0;
  x3[34]=434.0;    y3[34]=709.0;
  x3[35]=434.0;    y3[35]=718.0;
  x3[36]=427.0;    y3[36]=731.0;
  x3[37]=428.0;    y3[37]=753.0;
  x3[38]=432.0;    y3[38]=748.0;
  x3[39]=432.0;    y3[39]=759.0;
  x3[40]=424.0;    y3[40]=763.0;
  
  fillpoly(win, x3, y3, 41, 0);
  
  /*葉脈を描く*/
  newlinewidth(win, THICK);//太さの指定
  newhsvcolor(win, 122, 153, 255);//色指定
  
  moveto(win, 428, 761);/*主となる部分*/
  lineto(win, 416, 749);
  lineto(win, 402, 739);
  lineto(win, 394, 732);
  lineto(win, 383, 723);
  lineto(win, 361, 698);
  lineto(win, 357, 692);
  lineto(win, 325, 660);
  lineto(win, 319, 651);
  lineto(win, 315, 644);
  lineto(win, 289, 626);
  
  moveto(win, 402, 739);/*左上部分*/
  lineto(win, 391, 736);
  lineto(win, 369, 731);
  lineto(win, 352, 730);
  
  moveto(win, 394, 732);/*右上部分*/
  lineto(win, 389, 686);
  
  moveto(win, 361, 698);/*左中部分*/
  lineto(win, 342, 691);
  lineto(win, 327, 686);
  lineto(win, 313, 685);
  
  moveto(win, 357, 692);/*右中部分*/
  lineto(win, 351, 649);
  
  moveto(win, 319, 651);/*左下部分*/
  lineto(win, 299, 646);
  lineto(win, 287, 646);
  
  moveto(win, 315, 644);/*右下部分*/
  lineto(win, 309, 632);
  lineto(win, 307, 623);
}
void CGameControllerSimon::Tick()
{
    /** Control Iluminacion Pads**/
    for (int i=0; i<NUM_PADS;i++)
    {
        if (v_Pads[i].m_Used && GetTickCount() >= v_Pads[i].m_Timer)
            v_Pads[i].m_Used = false;
    }
    /** Control de Animaciones **/
    for(size_t i=0; i<v_Anims.size(); i++)
    {
        if (GetTickCount() >= v_Anims[i]->m_Timer)
        {
            if (v_Anims[i]->m_Radius <= 0)
                continue;

            v_Anims[i]->m_Radius += v_Anims[i]->m_Dir;
            v_Anims[i]->m_Timer = GetTickCount() + 1000 * 0.0f;

            if (v_Anims[i]->m_Radius <= 0)
            {
            }
        }
    }


    /** Dibujar Animaciones **/
    for(size_t i=0; i<v_Anims.size(); i++)
    {
        setcolor(v_Anims[i]->m_Color);
        circle(static_cast<int>(v_Anims[i]->m_Pos.x), static_cast<int>(v_Anims[i]->m_Pos.y), v_Anims[i]->m_Radius);
    }

    /** Dibujar Tablero **/
    setcolor(WHITE);
    int offsetx = dimTW/3;
    int offsety = dimTH/3;

    for (int i=offsety; i<dimTH-dimTH/3; i+=offsety)
    {
        moveto(g_Game.GetScreenW()/2-dimTW/2, i+g_Game.GetScreenH()/2-dimTH/2);
        lineto(g_Game.GetScreenW()/2-dimTW/2+dimTW, i+g_Game.GetScreenH()/2-dimTH/2);
    }
    for (int i=offsetx; i<dimTW-dimTW/3; i+=offsetx)
    {
        moveto(g_Game.GetScreenW()/2-dimTW/2+i, 1+g_Game.GetScreenH()/2-dimTH/2);
        lineto(g_Game.GetScreenW()/2-dimTW/2+i, dimTH+g_Game.GetScreenH()/2-dimTH/2);
    }

    circle(g_Game.GetScreenW()/2 - dimTW/2*2+(dimTW/3)*3, g_Game.GetScreenH()/2, dimTH/2 + (dimTH/3)/2);
    arc(g_Game.GetScreenW()/2-dimTW/2, dimTH/3+(dimTH/3)/2+g_Game.GetScreenH()/2-dimTH/2, 90, 270, (dimTH/3)/2);
    arc(g_Game.GetScreenW()/2-dimTW/2+(dimTW/3)*3, dimTH/3+(dimTH/3)/2+g_Game.GetScreenH()/2-dimTH/2, 270, 90, (dimTH/3)/2);
    arc(g_Game.GetScreenW()/2-dimTW/2+(dimTW/3)/2+dimTW/3, g_Game.GetScreenH()/2-dimTH/2+1, 0, 180, (dimTH/3)/2);
    arc(g_Game.GetScreenW()/2-dimTW/2+(dimTW/3)/2+dimTW/3, (dimTH/3)*3+g_Game.GetScreenH()/2-dimTH/2+1, 180, 0, (dimTH/3)/2);

    //Cuadros Luminosos
    int points[4*2];
    //--Derecha\Centro\Izquierda
    for (int i=0;i<3;i++)
    {
        if (i==0)
            setfillstyle(SOLID_FILL, GetPadColor(PAD_RED, v_Pads[PAD_RED].m_Used));
        else if (i == 1)
            setfillstyle(SOLID_FILL, GetPadColor(PAD_YELLOW, v_Pads[PAD_YELLOW].m_Used));
        else
            setfillstyle(SOLID_FILL, GetPadColor(PAD_GREEN, v_Pads[PAD_GREEN].m_Used));

        points[0]=g_Game.GetScreenW()/2-dimTW/2+dimTH/3*i;
        points[1]=g_Game.GetScreenH()/2-dimTH/2+dimTH/3;
        points[2]=points[0]+(dimTW/3);
        points[3]=points[1];
        points[4]=points[2];
        points[5]=points[1]+(dimTH/3);
        points[6]=points[0];
        points[7]=points[5];
        fillpoly(4, points);
    }
    //--Arriba\Abajo
    for (int i=0;i<3;i+=2)
    {
        if (i==0)
            setfillstyle(SOLID_FILL, GetPadColor(PAD_BLUE, v_Pads[PAD_BLUE].m_Used));
        else
            setfillstyle(SOLID_FILL, GetPadColor(PAD_CYAN, v_Pads[PAD_CYAN].m_Used));

        points[0]=g_Game.GetScreenW()/2-dimTW/2+dimTH/3;
        points[1]=g_Game.GetScreenH()/2-dimTH/2+dimTH/3*i;
        points[2]=points[0]+(dimTW/3);
        points[3]=points[1];
        points[4]=points[2];
        points[5]=points[1]+(dimTH/3);
        points[6]=points[0];
        points[7]=points[5];
        fillpoly(4, points);
    }


    //La makina Juega
    //** Generar Pad Iluminati **/
    if (!g_Game.m_WorldPaused && m_Started && m_ActivePlayer == PLAYER_CPU && GetTickCount() > m_TimerCPU)
    {
        if (m_SeqCPUPos == 0)
            v_Seq.push_back(rand()%NUM_PADS);

        PushPad(v_Seq[m_SeqCPUPos]);
        m_SeqCPUPos++;

        if (m_SeqCPUPos >= v_Seq.size()-1)
        {
            m_SeqCPUPos = 0;
            m_ActivePlayer = PLAYER_1;
        }
        m_TimerCPU = GetTickCount() + 1000 * 0.7f;
    }
}
Esempio n. 24
0
main()
{
    int driver = DETECT, mode;
    char c;
    int k1[] = { 0, 0, 20, 0, 20, 60, 30, 60, 30, 100, 0, 100, 0, 0 };
    int k2[] = { 40, 0, 50, 0, 50, 60, 60, 60, 60, 100, 30, 100, 30, 60, 40, 60, 40, 0 };
    int k3[] = { 70, 0, 90, 0, 90, 100, 60, 100, 60, 60, 70, 60, 70, 0 };
    int k4[] = { 90, 0, 110, 0, 110, 60, 120, 60, 120, 100, 90, 100, 90, 0 };
    int k5[] = { 130, 0, 140, 0, 140, 60, 150, 60, 150, 100, 120, 100, 120, 60, 130, 60, 130, 0 };
    int k6[] = { 160, 0, 170, 0, 170, 60, 180, 60, 180, 100, 150, 100, 150, 60, 160, 60, 160, 0 };
    int k7[] = { 190, 0, 210, 0, 210, 100, 180, 100, 180, 60, 190, 60, 190, 0 };
    int k8[] = { 210, 0, 230, 0, 230, 60, 240, 60, 240, 100, 210, 100, 210, 0 };
    int k9[] = { 250, 0, 260, 0, 260, 60, 270, 60, 270, 100, 240, 100, 240, 60, 250, 60, 250, 0 };
    int k10[] = { 280, 0, 300, 0, 300, 100, 270, 100, 270, 60, 280, 60, 280, 0 };
    int k11[] = { 300, 0, 330, 0, 330, 100, 300, 100, 300, 0 };
    int k12[] = { 330, 0, 360, 0, 360, 100, 330, 100, 330, 0 };
    initgraph(&driver, &mode, "");
    int maxx = getmaxx();
    int maxy = getmaxy();
    for (long j = 0; j <= 300; j++) {
        putpixel(random(maxx), random(maxy), 4);
        delay(1);
    }
    setfillstyle(SOLID_FILL, BLACK);
    bar(89, 39, 571, 261);
    setlinestyle(SOLID_LINE, 3, 3);
    line(90, 50, 90, 250); //outline
    line(100, 40, 540, 40);
    line(100, 260, 540, 260);
    line(550, 250, 550, 50);
    arc(100, 50, 90, 180, 10);
    arc(100, 250, 180, 270, 10);
    arc(540, 250, 270, 360, 10);
    arc(540, 50, 0, 90, 10);
    circle(200, 90, 35);
    setfillstyle(SOLID_FILL, 9);
    floodfill(200, 90, WHITE);
    circle(482, 95, 42);
    setfillstyle(SOLID_FILL, 3);
    floodfill(482, 95, WHITE);
    setlinestyle(SOLID_LINE, 1, 1);
    rectangle(270, 60, 370, 130);
    setfillstyle(SOLID_FILL, 14);
    floodfill(290, 80, WHITE);
    rectangle(270, 130, 295, 140);
    setfillstyle(SOLID_FILL, 5);
    floodfill(280, 135, WHITE);
    rectangle(295, 130, 320, 140);
    setfillstyle(SOLID_FILL, 5);
    floodfill(300, 135, WHITE);
    rectangle(320, 130, 345, 140);
    setfillstyle(SOLID_FILL, 5);
    floodfill(330, 135, WHITE);
    rectangle(345, 130, 370, 140);
    setfillstyle(SOLID_FILL, 5);
    floodfill(350, 135, WHITE);
    rectangle(120, 60, 145, 70);
    setfillstyle(SOLID_FILL, 1);
    floodfill(130, 65, WHITE);
    rectangle(120, 90, 145, 100);
    setfillstyle(SOLID_FILL, 1);
    floodfill(130, 95, WHITE);
    ellipse(132, 125, 0, 360, 11, 8);
    setfillstyle(SOLID_FILL, RED);
    floodfill(132, 125, WHITE);
    circle(230, 130, 5);
    setfillstyle(SOLID_FILL, RED);
    floodfill(230, 130, WHITE);
    rectangle(387, 60, 427, 75);
    setfillstyle(SOLID_FILL, 10);
    floodfill(395, 70, WHITE);
    rectangle(385, 90, 403, 110);
    setfillstyle(SOLID_FILL, 6);
    floodfill(390, 100, WHITE);
    rectangle(411, 90, 430, 110);
    setfillstyle(SOLID_FILL, 6);
    floodfill(420, 100, WHITE);
    rectangle(387, 120, 427, 135);
    setfillstyle(SOLID_FILL, 10);
    floodfill(395, 130, WHITE);
    rectangle(150, 260, 510, 250);
    setfillstyle(SOLID_FILL, 8);
    floodfill(180, 255, WHITE);
    circle(500, 120, 6);
    setfillstyle(SOLID_FILL, 8);
    floodfill(500, 120, WHITE);
    setviewport(225, 300, 530, 410, 1);
    int poly1[] = { 0, 2, 12, 60, 22, 54, 18, 28, 35, 2, 0, 2 };
    int poly2[] = { 10, 10, 23, 10, 14, 20, 10, 10 };
    int poly3[] = { 50, 0, 60, 2, 60, 45, 50, 42, 50, 0 };
    int poly4[] = { 71, 70, 83, 13, 105, 74, 87, 53, 71, 70 };
    int poly5[] = { 85, 30, 90, 45, 83, 43, 85, 30 };
    int poly6[] = { 110, 53, 120, 2, 130, 57, 148, 0, 135, 84, 132, 84, 118, 29, 110, 53 };
    int poly7[] = { 177, 2, 200, 35, 180, 85, 160, 33, 177, 2 };
    int poly8[] = { 178, 20, 190, 35, 179, 70, 166, 34, 178, 20 };
    drawpoly(6, poly1);
    setfillstyle(SOLID_FILL, RED);
    fillpoly(6, poly1);
    drawpoly(4, poly2);
    setfillstyle(SOLID_FILL, BLACK);
    fillpoly(4, poly2);
    drawpoly(5, poly3);
    setfillstyle(SOLID_FILL, RED);
    fillpoly(5, poly3);
    drawpoly(5, poly4);
    setfillstyle(SOLID_FILL, RED);
    fillpoly(5, poly4);
    drawpoly(4, poly5);
    setfillstyle(SOLID_FILL, BLACK);
    fillpoly(4, poly5);
    drawpoly(8, poly6);
    setfillstyle(SOLID_FILL, RED);
    fillpoly(8, poly6);
    drawpoly(5, poly7);
    setfillstyle(SOLID_FILL, RED);
    fillpoly(5, poly7);
    drawpoly(5, poly8);
    setfillstyle(SOLID_FILL, BLACK);
    fillpoly(5, poly8);
    setviewport(150, 150, 510, 250, 1);
    pnobody();
    c = getch();
    do {
        switch (c) {
        case 'q': {
            setfillstyle(SOLID_FILL, GREEN);
            fillpoly(7, k1);
            pno(261);
            setfillstyle(SOLID_FILL, BLUE);
            fillpoly(7, k1);
            break;
        }
        case 'w': {
            setfillstyle(SOLID_FILL, RED);
            fillpoly(9, k2);
            pno(293);
            setfillstyle(SOLID_FILL, BLUE);
            fillpoly(9, k2);
            pnobody();
            break;
        }
        case 'e': {
            setfillstyle(SOLID_FILL, GREEN);
            fillpoly(7, k3);
            pno(329);
            setfillstyle(SOLID_FILL, BLUE);
            fillpoly(7, k3);
            pnobody();
            break;
        }
        case 'r': {
            setfillstyle(SOLID_FILL, RED);
            fillpoly(7, k4);
            pno(350);
            setfillstyle(SOLID_FILL, BLUE);
            fillpoly(7, k4);
            pnobody();
            break;
        }
        case 't': {
            setfillstyle(SOLID_FILL, GREEN);
            fillpoly(9, k5);
            pno(392);
            setfillstyle(SOLID_FILL, BLUE);
            fillpoly(9, k5);
            pnobody();
            break;
        }
        case 'y': {
            setfillstyle(SOLID_FILL, RED);
            fillpoly(9, k6);
            pno(440);
            setfillstyle(SOLID_FILL, BLUE);
            fillpoly(9, k6);
            pnobody();
            break;
        }
        case 'u': {
            setfillstyle(SOLID_FILL, GREEN);
            fillpoly(7, k7);
            pno(493);
            setfillstyle(SOLID_FILL, BLUE);
            fillpoly(7, k7);
            pnobody();
            break;
        }
        case 'i': {
            setfillstyle(SOLID_FILL, RED);
            fillpoly(7, k8);
            pno(523);
            setfillstyle(SOLID_FILL, BLUE);
            fillpoly(7, k8);
            pnobody();
            break;
        }
        case 'o': {
            setfillstyle(SOLID_FILL, GREEN);
            fillpoly(9, k9);
            pno(587);
            setfillstyle(SOLID_FILL, BLUE);
            fillpoly(9, k9);
            pnobody();
            break;
        }
        case 'p': {
            setfillstyle(SOLID_FILL, RED);
            fillpoly(7, k10);
            pno(659);
            setfillstyle(SOLID_FILL, BLUE);
            fillpoly(7, k10);
            pnobody();
            break;
        }
        case '[': {
            setfillstyle(SOLID_FILL, GREEN);
            fillpoly(5, k11);
            pno(698);
            setfillstyle(SOLID_FILL, BLUE);
            fillpoly(5, k11);
            pnobody();
            break;
        }
        case ']': {
            setfillstyle(SOLID_FILL, RED);
            fillpoly(5, k12);
            pno(784);
            setfillstyle(SOLID_FILL, BLUE);
            fillpoly(5, k12);
            pnobody();
            break;
        }
        case '1': {
            setfillstyle(SOLID_FILL, YELLOW);
            bar(20, 0, 40, 60);
            pno(311);
            setfillstyle(SOLID_FILL, BLACK);
            bar(20, 0, 40, 60);
            pnobody();
            break;
        }
        case '2': {
            setfillstyle(SOLID_FILL, WHITE);
            bar(50, 0, 70, 60);
            pno(370);
            setfillstyle(SOLID_FILL, BLACK);
            bar(50, 0, 70, 60);
            pnobody();
            break;
        }
        case '4': {
            setfillstyle(SOLID_FILL, YELLOW);
            bar(110, 0, 130, 60);
            pno(415);
            setfillstyle(SOLID_FILL, BLACK);
            bar(110, 0, 130, 60);
            pnobody();
            break;
        }
        case '5': {
            setfillstyle(SOLID_FILL, WHITE);
            bar(140, 0, 160, 60);
            pno(466);
            setfillstyle(SOLID_FILL, BLACK);
            bar(140, 0, 160, 60);
            pnobody();
            break;
        }
        case '6': {
            setfillstyle(SOLID_FILL, YELLOW);
            bar(170, 0, 190, 60);
            pno(554);
            setfillstyle(SOLID_FILL, BLACK);
            bar(170, 0, 190, 60);
            pnobody();
            break;
        }
        case '8': {
            setfillstyle(SOLID_FILL, WHITE);
            bar(230, 0, 250, 60);
            pno(662);
            setfillstyle(SOLID_FILL, BLACK);
            bar(230, 0, 250, 60);
            pnobody();
            break;
        }
        case '9': {
            setfillstyle(SOLID_FILL, YELLOW);
            bar(260, 0, 280, 60);
            pno(740);
            setfillstyle(SOLID_FILL, BLACK);
            bar(260, 0, 280, 60);
            pnobody();
            break;
        }
        case 'Q': {
            setfillstyle(SOLID_FILL, GREEN);
            fillpoly(7, k1);
            pno(261);
            setfillstyle(SOLID_FILL, BLUE);
            fillpoly(7, k1);
            break;
        }
        case 'W': {
            setfillstyle(SOLID_FILL, RED);
            fillpoly(9, k2);
            pno(293);
            setfillstyle(SOLID_FILL, BLUE);
            fillpoly(9, k2);
            pnobody();
            break;
        }
        case 'E': {
            setfillstyle(SOLID_FILL, GREEN);
            fillpoly(7, k3);
            pno(329);
            setfillstyle(SOLID_FILL, BLUE);
            fillpoly(7, k3);
            pnobody();
            break;
        }
        case 'R': {
            setfillstyle(SOLID_FILL, RED);
            fillpoly(7, k4);
            pno(350);
            setfillstyle(SOLID_FILL, BLUE);
            fillpoly(7, k4);
            pnobody();
            break;
        }
        case 'T': {
            setfillstyle(SOLID_FILL, GREEN);
            fillpoly(9, k5);
            pno(392);
            setfillstyle(SOLID_FILL, BLUE);
            fillpoly(9, k5);
            pnobody();
            break;
        }
        case 'Y': {
            setfillstyle(SOLID_FILL, RED);
            fillpoly(9, k6);
            pno(440);
            setfillstyle(SOLID_FILL, BLUE);
            fillpoly(9, k6);
            pnobody();
            break;
        }
        case 'U': {
            setfillstyle(SOLID_FILL, GREEN);
            fillpoly(7, k7);
            pno(493);
            setfillstyle(SOLID_FILL, BLUE);
            fillpoly(7, k7);
            pnobody();
            break;
        }
        case 'I': {
            setfillstyle(SOLID_FILL, RED);
            fillpoly(7, k8);
            pno(523);
            setfillstyle(SOLID_FILL, BLUE);
            fillpoly(7, k8);
            pnobody();
            break;
        }
        case 'O': {
            setfillstyle(SOLID_FILL, GREEN);
            fillpoly(9, k9);
            pno(587);
            setfillstyle(SOLID_FILL, BLUE);
            fillpoly(9, k9);
            pnobody();
            break;
        }
        case 'P': {
            setfillstyle(SOLID_FILL, RED);
            fillpoly(7, k10);
            pno(659);
            setfillstyle(SOLID_FILL, BLUE);
            fillpoly(7, k10);
            pnobody();
            break;
        }
        case ' ': {
            break;
        }
        }
        c = getch();
    } while (c != ' ');
    setviewport(0, 0, maxx, maxy, 1);
    cleardevice();
    for (j = 0; j <= 1100; j++) {
        putpixel(random(maxx), random(maxy), 4);
        delay(1);
    }
    setcolor(4);
    outtextxy(270, 150, "C R E D I T S");
    for (int i = 0; i <= 3; i++) {
        outtextxy(260, 155 + i, "_______________");
    }
    delay(600);
    outtextxy(150, 200, " #Suvojit Manna:Concept & Design,Core Programing");
    outtextxy(160, 205, "_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ");
    delay(600);
    outtextxy(165, 250, " #Prangshu Shyam:Graphical Assisstance");
    outtextxy(180, 255, "_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ");
    delay(600);
    outtextxy(200, 300, " #Sourav Kundu:Final Compilation");
    outtextxy(210, 305, "_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ");
    getch();
    return 0;
}
Esempio n. 25
0
void Tree::Stvol(const Point* begin, const Point* end, const int& color)
{
    if(begin->Range(end) < size/6.2) // !!!
    {
        Divis(begin, end, color);
        setcolor(color);
        return;
    }

    Point middle(begin, end, 1-Fi);

    Point* p1 = new Point(begin, begin->Range(end)/55, begin->AngleX(end)+M_PI_2);
    Point* p2 = new Point(begin, begin->Range(end)/55, begin->AngleX(end)-M_PI_2);

    if(middle.Range(&sun) > center.Range(&sun))
    {
        setcolor(color1);
        setfillstyle(1, color1);
    }
    else
    {
        setcolor(color2);
        setfillstyle(1, color2);
    }

    int* mass = new int[6];

    mass[0] = p1->GetX();
    mass[1] = p1->GetY();

    mass[2] = p2->GetX();
    mass[3] = p2->GetY();

    mass[4] = end->GetX();
    mass[5] = end->GetY();

    fillpoly(3, mass);

    delete[] mass;
    delete p2;
    delete p1;

    Stvol(&middle, end, color);

    int krnd = (RND() < 0.5) ? -1 : 1;

    // ranznos vetki 1
    double* temp1 = new double((begin->Range(end) < size/16) ?
                               0 : (1/Fi)*random(16*(int)(begin->Range(end)/size))/begin->Range(end));

    middle.Position(begin, end, 1 - Fi + krnd * *temp1);

    delete temp1;

    // zadanie vetki 1
    double angle = M_PI_2*(random(80)+10)/100 + M_PI_2;
    Point away(&middle, middle.Range(end), angle);

    Stvol(&middle, &away, color);

    // ranznos vetki 2
    double* temp2 = new double((begin->Range(end) < size/16) ?
                               0 : (1/Fi)*random(16*(int)(begin->Range(end)/size))/begin->Range(end));

    middle.Position(begin, end, 1 - Fi - krnd * *temp2);

    delete temp2;

    // zadanie vetki 1
    angle = M_PI_2*(random(80)+10)/100 - M_PI_2;
    away.Position(&middle, middle.Range(end), -angle);

    Stvol(&middle, &away, color);
}
Esempio n. 26
0
void main() {

int gdriver=DETECT,gmode,n,poly[20],i=0;
float xi,yi,xf,yf,polyy[20];

printf("Coordinates of rectangular clip window :\nxmin,ymin             :");
scanf("%f%f", &xmin, &ymin);
printf("xmax,ymax             :");
scanf("%f%f",&xmax,&ymax);
printf("\n\nPolygon to be clipped :\nNumber of sides       :");
scanf("%d",&n);
printf("Enter the coordinates :");
for(i=0;i < 2*n;i++)
	scanf("%f",&polyy[i]);

polyy[i]=polyy[0];
polyy[i+1]=polyy[1];

for(i=0;i < 2*n+2;i++)
	poly[i]=round(polyy[i]);

initgraph(&gdriver,&gmode,NULL);
setcolor(RED);
rectangle(xmin,ymax,xmax,ymin);
printf("\t\tUNCLIPPED POLYGON");
setcolor(WHITE);
fillpoly(n,poly);
getch();
cleardevice();

k=0;
for(i=0;i < 2*n;i+=2)
	clipl(polyy[i],polyy[i+1],polyy[i+2],polyy[i+3]);
n=k/2;

for(i=0;i < k;i++)
	polyy[i]=arr[i];
polyy[i]=polyy[0];
polyy[i+1]=polyy[1];
k=0;

for(i=0;i < 2*n;i+=2)
	clipt(polyy[i],polyy[i+1],polyy[i+2],polyy[i+3]);
n=k/2;

for(i=0;i < k;i++)
	polyy[i]=arr[i];
polyy[i]=polyy[0];
polyy[i+1]=polyy[1];
k=0;

for(i=0;i < 2*n;i+=2)
	clipr(polyy[i],polyy[i+1],polyy[i+2],polyy[i+3]);
n=k/2;

for(i=0;i < k;i++)
	polyy[i]=arr[i];
polyy[i]=polyy[0];
polyy[i+1]=polyy[1];
k=0;

for(i=0;i < 2*n;i+=2)
	clipb(polyy[i],polyy[i+1],polyy[i+2],polyy[i+3]);

for(i=0;i < k;i++)
	poly[i]=round(arr[i]);
if(k)
	fillpoly(k/2,poly);

setcolor(RED);
rectangle(xmin,ymax,xmax,ymin);
printf("\tCLIPPED POLYGON");
getch();
closegraph();
}
Esempio n. 27
0
 // Вывод четырехугольника
  void ShowSq( int p1,int p2,int p3,int p4 ){
		int Square[8] =
		  { XC(W[p1-1]), YC(W[p1-1]), XC(W[p2-1]), YC(W[p2-1]),
				XC(W[p3-1]), YC(W[p3-1]), XC(W[p4-1]), YC(W[p4-1]) };
		fillpoly(sizeof(Square)/sizeof(pointtype),Square);
  };
Esempio n. 28
0
int options(void)
{
	int key,
		buton = 1,
		h,
		v,
		end=0;
	int poly[10]={100,100,300,100,300,300,100,300,100,100};
/*		on=0; */

	optionplates();
	defbutton(220,450,"Previous");

	/* while exit not requested */
	do {
		key = checkinput();
		h = rat.horiz;
		v = rat.verti;

		if((rat.buttons == LBUTTON && key == PRESS) && (platehit(0,h,v)))
		{
		/* This option should toggle printing of file on and off.
			If on, file will be printed when the program that was created
			is saved.
		*/
			ratoff();
			setcolor(CCSLWHITE);
			setfillstyle(SOLID_FILL,CCSLLTBLUE);
			fillpoly(5,poly);
			raton();
			getch();
			ratoff();
			setcolor(CCSLDKBLUE);
			setfillstyle(SOLID_FILL,CCSLDKBLUE);
			fillpoly(5,poly);
			raton();
		}
		if((rat.buttons == LBUTTON && key == PRESS) && (platehit(1,h,v)))
		{
		/* new */
		}
		if((rat.buttons == LBUTTON && key == PRESS) && (platehit(2,h,v)))
		{
		/* load */
		}
		if((rat.buttons == LBUTTON && key == PRESS) && (platehit(3,h,v)))
		{
		/* save */
		}
		if((rat.buttons == LBUTTON && key == PRESS) && (platehit(4,h,v)))
		{
		/* write */
		}
		if((rat.buttons == LBUTTON && key == PRESS) && (platehit(5,h,v)))
		{
		/* save */
		}
		if((rat.buttons == LBUTTON && key == PRESS) && (platehit(6,h,v)))
		{
		/* change type from graphics (default) to text and vice versa */
			ratoff();
			setcolor(CCSLWHITE);
			setfillstyle(SOLID_FILL,CCSLLTBLUE);
			fillpoly(5,poly);
			raton();
			getch();
			ratoff();
			setcolor(CCSLDKBLUE);
			setfillstyle(SOLID_FILL,CCSLDKBLUE);
			fillpoly(5,poly);
			raton();
		}
		if((rat.buttons == RBUTTON && key == HELD) && (checkhit(1,h,v)))
		{
			if(buton)
			{
				buttonoff(1);
				buton = 0;
			}
			else
			{
				buttonon(1);
				buton = 1;
			}
		}
		if((rat.buttons == CBUTTON && key == RELEASE) && (checkhit(1,h,v)))
		{
			if(buton)
			{
				buttonoff(1);
				buton = 0;
			}
			else
			{
				buttonon(1);
				buton = 1;
			}
		}
		if((rat.buttons == LBUTTON && key == PRESS) && (checkhit(2,h,v)))
		{
			key = ESC;
			end = 1;
		}
	} while(!(((rat.buttons == LBUTTON && key == PRESS) || (key == ENTER))
			&& checkhit(0,h,v) || key == ESC));

	clearplates();
	remove_button(2);

	if(end)
		return(0);
	else
		return(1);
}
Esempio n. 29
0
int main () {

 initwindow(800, 600, "Ex 02");
 
 if (pg == 1) pg = 2; else pg = 1;
 
 setbkcolor(2); 
 setactivepage(pg);
 cleardevice();
 
 
 setfillstyle(1, BLUE);
 bar(360, 0, 440, 600);

 setfillstyle(1, BLUE);
 bar(360, 0, 440, 600);


 setcolor(BLUE);
 bar(440, 150, 580, 200);
 
 setfillstyle(1, BLUE);
 poly[0] = 580;
 poly[1] = 150;
 poly[2] = 580;
 poly[3] = 200;
 poly[4] = 680;
 poly[5] = 150;
 poly[6] = 680;
 poly[7] = 100;
 poly[8] = 580;
 poly[9] = 150;
 fillpoly(5, poly);
 
 setcolor(BLUE);
 bar(680, 100, 800, 150);
 
 setcolor(BLUE);
 bar(240, 300, 360, 350);
 
 setfillstyle(1, BLUE);
 poly[0] = 0;
 poly[1] = 250;
 poly[2] = 120;
 poly[3] = 300;
 poly[4] = 240;
 poly[5] = 350;
 poly[6] = 240;
 poly[7] = 300;
 poly[8] = 0;
 poly[9] = 200;
 fillpoly(5, poly);
 
 setcolor(BLUE);
 bar(150, 290, 200, 600);
 
 setfillstyle(1, BLUE);
 poly[0] = 360;
 poly[1] = 350;
 poly[2] = 360;
 poly[3] = 400;
 poly[4] = 560;
 poly[5] = 450;
 poly[6] = 560;
 poly[7] = 400;
 poly[8] = 360;
 poly[9] = 350;
 fillpoly(5, poly);
 
 setcolor(BLUE);
 bar(560, 400, 600, 450);
 
 setfillstyle(1, BLUE);
 poly[0] = 600;
 poly[1] = 400;
 poly[2] = 600;
 poly[3] = 450;
 poly[4] = 800;
 poly[5] = 600;
 poly[6] = 800;
 poly[7] = 525;
 poly[8] = 600;
 poly[9] = 400;
 fillpoly(5, poly);
  
while (i < 540){
  
 setfillstyle(1, DARKGRAY);
 barco[0] = 400;
 barco[1] = 0 + i;
 barco[2] = 380;
 barco[3] = 20 + i;
 barco[4] = 380;
 barco[5] = 60 + i;
 barco[6] = 400;
 barco[7] = 80 + i;
 barco[8] = 420;
 barco[9] = 60 + i;
 barco[10] = 420;
 barco[11] = 20 + i;
 barco[12] = 400;
 barco[13] = 0 + i;
 fillpoly(7, barco);
 
 i = i + 20;
}
 setvisualpage(pg);
 delay(200);
 

 getch();

}
Esempio n. 30
0
void ojo ()
{ int poly [44];
poly[0]=220;
poly[1]=430;
//2
poly[2]=380;
poly[3]=430;
//3
poly[4]=380;
poly[5]=410;
//4
poly[6]=400;
poly[7]=410;
//5
poly[8]=400;
poly[9]=370;
//6
poly[10]=380;
poly[11]=370;
//7
poly[12]=380;
poly[13]=350;
//8
poly[14]=340;
poly[15]=350;
//9
poly[16]=340;
poly[17]=390;
//10
poly[18]=320;
poly[19]=390;
//11
poly[20]=320;
poly[21]=350;
//12
poly[22]=280;
poly[23]=350;
//13
poly[24]=280;
poly[25]=390;
//14
poly[26]=260;
poly[27]=390;
//15
poly[28]=260;
poly[29]=350;
//16
poly[30]=220;
poly[31]=350;
//17
poly[32]=220;
poly[33]=370;
//18
poly[34]=200;
poly[35]=370;
//19
poly[36]=200;
poly[37]=410;
//20
poly[38]=220;
poly[39]=410;
//21
poly[40]=220;
poly[41]=430;
setcolor(7);
setfillstyle(1,7);
fillpoly (21,poly);
}