示例#1
0
 // Инициализация данных фигуры
  void InitData( int Ind ){
		int i,j,Xasp,Yasp;
		getaspectratio(&Xasp,&Yasp);
		DimSpace  = DS[Ind];
		DimNods   = DN[Ind];
		DimLoops  = DL[Ind];
		DimPlanes = DP[Ind];
		for (i=0;i<MaxDimSpace;i++)
		  for (j=0;j<MaxDimNods;j++)
				W[i][j]=0;
		for (j=0;j<DimSpace;j++)
		  for (i=0;i<DimNods;i++)
				switch (Ind){
				  case 0: W[i][j]=T3[i][j]; break;
				  case 1: W[i][j]=C3[i][j]; break;
				  case 2: W[i][j]=O3[i][j]; break;
				  case 3: W[i][j]=T4[i][j]; break;
				  case 4: W[i][j]=O4[i][j]; break;
				  case 5: W[i][j]=L4[i][j]; break;
				  case 6: W[i][j]=C4[i][j]; break;
				  case 7: W[i][j]=C5[i][j]; break;
				  case 8: W[i][j]=C6[i][j]; break;
				  case 9: W[i][j]=I3[i][j]; break;
				};
		Dx=Disp[Ind]; Dy=Dx;
		Dy=((float)Xasp*Disp[Ind])/Yasp;
		for(i=0;i<4;i++) Rotate_Comp(XT[Ind][i],YT[Ind][i],RT[Ind][i]);
		LoopsLen(Ind);
  };
示例#2
0
void Initialize(void)
{
  int xasp, yasp;			/* Used to read the aspect ratio*/

  int driver = DETECT; 		/* Request auto-detection	*/
  int mode;
	initgraph( &driver, &mode,"e:\\tc\\bgi");
  ErrorCode = graphresult();		/* Read result of initialization*/
  if( ErrorCode != grOk ){		/* Error occured during init	*/
	printf(" Graphics System Error: %s\n", grapherrormsg( ErrorCode ) );
	exit( 1 );
  }

	getpalette( &palette );		/* Read the palette from board	*/
  MaxColors = getmaxcolor() + 1;	/* Read maximum number of colors*/

  MaxXX = getmaxx();
  MaxYY = getmaxy();			/* Read size of screen		*/

  getaspectratio( &xasp, &yasp );	/* read the hardware aspect	*/
  AspectRatio = (double)xasp / (double)yasp; /* Get correction factor	*/

}
示例#3
0
void drawface()
{
   char ch='x';
   int x,y,color,r,imgsize,dif;

   x=face1->position.x=320;
   y=face1->position.y=180;
   face1->radius=150;
   color=15;
   r=face1->radius;

   setbkcolor(0);
   getaspectratio(&xasp,&yasp);
   setcolor(8);
   circle(x,y,face1->radius);

   setfillstyle(1,color);
   floodfill(x,y,getcolor());

   draweyes(face1);
   drawhair(face1);
   drawmouth(face1);
   drawnose(face1);
}
示例#4
0
int main() {
	int unidad = 0,modo,k,x,y,tx,ty;
	char s[10],s1[10],*titulo;

	initgraph (&unidad,&modo,"c:\\bc\\bgi");
	if (graphresult() != 0) {
		cout << "Error al tratar de pasar al modo grafico\n";
		getch();
		return 1;
	}
	setcolor (YELLOW);
	getaspectratio (&x,&y);
	tx = x;
	ty = y;
	itoa (x,s,10);
	itoa (y,s1,10);
	k = strlen (s) + strlen (" ") + strlen (s1) + 1;
	titulo = new char [k];
	strcpy (titulo,s);
	strcat (titulo," ");
	strcat (titulo,s1);
	outtextxy (0,10,titulo);
	delete titulo;
	gcvt ( (double)y / x,5,s);
	outtextxy (200,10,s);
	circle (200,200,100);

	setcolor (WHITE);
	setaspectratio (tx / 2,ty);
	getaspectratio (&x,&y);
	itoa (x,s,10);
	itoa (y,s1,10);
	k = strlen (s) + strlen (" ") + strlen (s1) + 1;
	titulo = new char [k];
	strcpy (titulo,s);
	strcat (titulo," ");
	strcat (titulo,s1);
	outtextxy (0,20,titulo);
	delete titulo;
	gcvt ( (double)y / x,5,s);
	outtextxy (200,20,s);
	circle (200,200,100);

	setcolor (RED);
	setaspectratio (tx,ty / 2);
	getaspectratio (&x,&y);
	
	itoa (x,s,10);
	itoa (y,s1,10);
	k = strlen (s) + strlen (" ") + strlen (s1) + 1;
	titulo = new char [k];
	strcpy (titulo,s);
	strcat (titulo," ");
	strcat (titulo,s1);
	outtextxy (0,30,titulo);
	delete titulo;
	gcvt ( (double)y / x,5,s);
	outtextxy (200,30,s);
	circle (200,200,100);
	getch();
	closegraph();
	return 0;
}