Esempio n. 1
0
///////////////////FUNCION DESTRUIDO///////////////////////////////
void destruido()
{
    int i=0;
    clearviewport();
    for(i=0; i<100; i++)
    {

        setcolor(random(16)+1);
        settextstyle(1,0,10);
        outtextxy(50,0,"HAS SIDO INVADIDO");
        outtextxy(50,100,"INVADIDO");
        circle(xbuena,350-i,i);
        setactivepage(1-pagina);
        setvisualpage(pagina);
        pagina=1-pagina;
        delay(10);
        if(kbhit())break;
    }
    clearviewport();
    setcolor(random(16)+1);
    settextstyle(1,0,3);
    outtextxy(50,0,"¨DESEAS CONTINUAR(S/N)?");
    setactivepage(1-pagina);
    setvisualpage(pagina);
    pagina=1-pagina;
    continuar=getch();
    if(continuar=='s'||continuar=='S')
    {
        tecla='p';
        cuentanavebuena=3;
    }

}
Esempio n. 2
0
int main( )
{
    const int COLUMNS = 8;
    const int ROWS = 16;

    int x, y;        // x and y pixel locations
    int row, column; // Row and column number
    int box_width;   // Width of a color box in pixels
    int box_height;  // Height of a color box in pixels
    int color;       // Color number, now ranging from 0 to 127

    // Initialize the graphics window and set the box size.
    initwindow(400,300);
    box_width = getmaxx( ) / COLUMNS;
    box_height = getmaxy( ) / ROWS;

    // Draw some items on pages 1 and 0:
    setactivepage(1);
    line(0, 0, getmaxx( ), getmaxy( ));
    outtextxy(100, 100, "This is page #1.");
    outtextxy(100, 120, "Press a key to end the program.");
    setactivepage(0);
    line(getmaxx( ), 0, 0, getmaxy( ));
    outtextxy(100, 100, "This is page #0.");
    outtextxy(100, 120, "Press a key to see page #1.");

    // Get the user to press a key to move to page 1:
    getch( );
    setvisualpage(1);
    getch( );

}
Esempio n. 3
0
void main(void)
{
  int i=0;
  initgraph(&gd,&gm,"");
  while(!kbhit())
  {
    if((i%2)==1)
    {
      setvisualpage(1);
      setactivepage(0);
      clearviewport();
      face1->mood=0;
      drawface();
      delay(1000);
    }
    else
    {
       setvisualpage(0);
       setactivepage(1);
       clearviewport();
       face1->mood=1;
       drawface();
       delay(300);
    }
    i++;
  }
  getch();
  closegraph();
}
Esempio n. 4
0
void ShowRotation(Basis_3& xyz_basis,void drawfunc(void),int swappages){
 Basis_3  rot(1,0,0,
              0,1,0,
              0,0,1);
 float alf;
 int page=0,ind,cont=0;
 char h;
 if(swappages){
  setactivepage(page);
  setvisualpage(page);
 }
 cleardevice();
 drawfunc();

 do{
  while(kbhit())h=getch();
  switch(h){
   case 'x':
    ind=1;
    break;
   case 'X':
    ind=-1;
    break;
   case 'y':
    ind=2;
    break;
   case 'Y':
    ind=-2;
    break;
   case 'z':
    ind=3;
    break;
   case 'Z':
    ind=-3;
    break;
   case ' ':
    cont=1-cont;
    h=0;
    break;
   default:
    ind=0;
  }
  if(ind){
   if(ind<0){
    ind=-ind;
    ind--;
    alf=-0.1; //-rot[ind].angle;
   }
   else { alf=0.1;--ind;} //rot[--ind].angle;
   xyz_basis=RotateBasis(xyz_basis,rot.vec[ind],alf);
   if(swappages)setactivepage(page=1-page);
   cleardevice();
   drawfunc();
   if(swappages)setvisualpage(page);
   ind=0;
   if(!cont)h=0;
  }
 }while(h!=27);
}
Esempio n. 5
0
void atualizaTela(){
	static int pg = 1;
	setvisualpage(pg);									//Pagina mostrada ao usuário	
	if (pg == 1) pg = 2; else pg = 1;					//Logica para trocar de pagina
	setactivepage(pg);									//Pagina ativa
	cleardevice();										//Limpa tela
}
Esempio n. 6
0
int main () 
{
 initwindow(800, 600, "Ex 02");
	while (!kbhit())
	{	
		if (pg == 1) pg = 2; else pg = 1;
		setactivepage(pg);		//pagina ativa
		cleardevice();			//limpa tela
		desenhaCampo();
		if(i <= 510){			//desenha fundo
			desenhaBarco(); 	//desenha barco
		}else{
			viraBarco();
			if(vira == 0){			 //desenha barco na horizontal
			 j++;
			 if(barco[6] == 800){
			 	vira = 1;
			 }
			}else{
			 j--;
			 if(barco[0] == 0){
			 	vira = 0;
			 }
			}
		}			
		setvisualpage(pg);		//pagina mostrada ao usuário
	}
	
 getch();
}
Esempio n. 7
0
void main(void) {
  int gd = CUSTOM, gm = CUSTOM_MODE(1024,768);
  int page = 0;
  g_mousestate curState;
  g_mousestate oldState;
  int scrolling = 0;
  
  initgraph(&gd, &gm, "");
  
  initParticles(particles);
  
  while(!anykeypressed()) {
    getmousestate(&curState);
    if((curState.buttons & MOUSE_LEFTBUTTON) == 0) {
      scrolling = 0;
    } else {
      if(scrolling == 0) {
        scrolling = 1;
        getmousestate(&oldState);
      } else {
        orgX -= -curState.x + oldState.x;
        orgY += -curState.y + oldState.y;
        oldState = curState;
      }
    }
    updateParticles(particles, particles2);
	setactivepage(1 - page);
    clearviewport();
	drawParticles(particles);
	setvisualpage(1 - page);
    page = 1 - page;
	delay(4);
  }
  closegraph();
}
Esempio n. 8
0
void canvas_begin_draw( void ) {
	drawing = true;
	setactivepage( canvas_inactive_page() );

	cleardevice();
	setbkcolor(WHITE);

	return;
}
Esempio n. 9
0
void tienda()
{
    int i, xi, pag = 1,
        huesos,
        pos = 0; // Posicion del indicador.
    char tecla;
    String aux;

    obtenerDatos(&huesos, &i);
    setvisualpage(pag);
    while(tecla!=27)
    {
        setactivepage(pag=!pag);
        setfillstyle(1, COLOR(79, 182, 225));
        bar(0,0, WIDTH, HEIGHT);
        dibujaHuesos(huesos);
        setfillstyle(1, 0x00f);
        for(i=0, xi=WIDTH/3; i<NSKINS; i++, xi+=PIXEL_TAM*25)
            if(pos==i)
                bar(xi, 450+PIXEL_TAM*25, xi+PIXEL_TAM*20, 460+PIXEL_TAM*25);

        if(kbhit())
            switch(tecla = getch())
            {
                case 13:
                    compra(pos+1);
                    obtenerDatos(&huesos, &i);
                    break;
                case 77:
                    if(pos!=2)
                        pos++;
                    break;
                case 75:
                    if(pos!=0)
                        pos--;
                    break;
            }

        setbkcolor(0x0066F4);
        setfillstyle(1, 0x0066F4);
        setcolor(0x003988);
        settextstyle(2, HORIZ_DIR, 8);
        for(i=0, xi=WIDTH/3; i<NSKINS; i++, xi+=PIXEL_TAM*25)
        {
            sprintf(aux, "dino%d.%d.txt", i+1,pag);
            dibujaSprite(aux, xi, 450);
            sprintf(aux, "$ %d", 300*i);
            if(i)
                outtextxy(xi, 460+PIXEL_TAM*25, aux);
        }
        setvisualpage(pag);
        delay(80);
    }

    iniciaEntorno();
}
Esempio n. 10
0
void obj_figura::muda()
{
  if (ctela.pagina_atual == 0)
  {
    setvisualpage(1);
    ctela.pagina_atual = 1;
    setactivepage(0);
    cleardevice();
    setactivepage(1);
  }
  else
    {
      setvisualpage(0);
      ctela.pagina_atual = 0;
      setactivepage(1);
      cleardevice();
      setactivepage(0);
    }
}
Esempio n. 11
0
char obj_figura::exibe()
{
  if (!carquivo_definido)
    return FALSO;
  else
   {
     if (ctela.pagina_atual == 0)
       setactivepage(1);
     else
       setactivepage(0);

     if (!cbuffer_definido)
     {
       cbuffer = (estrutura_circular*) malloc(sizeof(estrutura_circular) * cnumero_de_nos);
       cbuffer_definido = VERDADEIRO;

       rewind(carquivo);
       fread(cbuffer, sizeof(estrutura_circular), cnumero_de_nos, carquivo);
     }

     for (unsigned int cont = 0; cont < cnumero_de_nos; cont++)
     {
       tipo_xy x1, y1, x2, y2;
       converte(cbuffer[cont].angulo1 + cangulo, cbuffer[cont].raio1 * craio, &x1, &y1, cx, cy);
       converte(cbuffer[cont].angulo2 + cangulo, cbuffer[cont].raio2 * craio, &x2, &y2, cx, cy);
       cor(cbuffer[cont].cor);
       line(x1, y1, x2, y2);
     }

     if (ctela.pagina_atual == 0)
       setactivepage(0);
     else
       setactivepage(1);

     return VERDADEIRO;
   }
}
Esempio n. 12
0
pacova::pacova():pagina_atual(0)
{
  cout << "Utilit�rio de Tela Pacova 1.0\n";

  char erro = inicializa_modo_grafico();

  if (erro)
  {
    cout << "Erro ao inicializar modo Gr�fico: " << grapherrormsg(erro) << "\n";
    cout << "Pressione qualquer tecla para finalizar...";
    bip();
    pause();
  }

  setactivepage(0);
  setvisualpage(0);
}
Esempio n. 13
0
////////////////////FUNCION PRESENTACION///////////////////////////
void presentacion()
{
    int xuno=10,yuno=0,i=0;
    fflush(stdin);
    putimage(xuno,120,mala,COPY_PUT);
    for(i=0; i<100; i++)
    {
        setcolor(random(16));

        line(xuno,yuno,xuno,yuno+i);
        delay(20);

    }
    for(i=0; i<100; i++)
    {
        setcolor(random(16));

        circle(xuno,120,i);
        delay(10);

    }
    while(!kbhit())
    {
        clearviewport();
        mover_estrellas();
        setcolor(random(16));
        settextstyle(3,0,5);
        outtextxy(10,40,"INVADERS 2002");
        setcolor(random(16));
        outtextxy(10,80,"PULSA UNA TECLA...");
        setcolor(random(16));
        settextstyle(3,0,2);
        outtextxy(100,160,"CONTROLES");
        setcolor(random(16));
        outtextxy(100,200,"(<-)=IZQUIERDA");
        outtextxy(100,240,"(->)=DERECHA");
        outtextxy(100,280,"(ESPACIO)=DISPARO");
        outtextxy(100,320,"(ENTER)=ESCUDO");
        if(kbhit())break;
        setactivepage(1-pagina);
        setvisualpage(pagina);
        pagina=1-pagina;
    }


}
Esempio n. 14
0
void name_enter(long sc,int level)
{
	void load_record();
	char str[11] = "";
	int i,cur_page=0,count=0,lastindex;
	clock_t cur = clock();
	char *s[46]={"A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","0","1","2","3","4","5","6","7","8","9","0","1","2","3","4","5","6","7","8","9"};
	setfillstyle(0,WHITE);
	settextstyle(8,0,5);
	while(1)
    {
    	setvisualpage(cur_page);
    	cur_page=-cur_page+1;
    	setactivepage(cur_page);
	    cleardevice();
	    readimagefile(".\\img\\background3.jpg",0,0,getmaxx(),getmaxy());
		readimagefile(".\\img\\name.gif",getmaxx()/2-50,getmaxy()/2-50,getmaxx()/2+50,getmaxy()/2);
		outtextxy(getmaxx()/7,getmaxy()/2, "ENTER:");
	    i=button();
	    if(i<46)
	    {	
	    	if(strlen(str) < 10)
	   			strcat(str,s[i]);
	    }
	    else if(i==46)
	    {
	    	lastindex = strlen(str);
	    	if(lastindex >= 1)
	    		str[lastindex - 1] = '\0';
	    }
	    else if(i==47)
	    {
	    	save_record(str,sc,level);
	    	cal_record();
	    	break;
	    }
	    cur = clock();
	    outtextxy(getmaxx()/3,getmaxy()/2,str);
	    delay(80);
    }

}
Esempio n. 15
0
  void SetPages( int P1,int P2 ){
		setactivepage(P1);
		setvisualpage(P2);
  };
Esempio n. 16
0
void runSimulation(char *fileName){
	WorldBoundaryType worldBoundary; //duplicated in GridWorld
   DevBoundaryType deviceBoundary; //duplicated in GridWorld
	bool ANIMATE_MOUSE_FLAG=false;
	bool validCellSelected=false;
	static BOOL page=false;
	int mX, mY;
	float worldX, worldY;
	worldX=0.0f;
	worldY=0.0f;
	
	int action=-1;
	//-----------------------
	CellPosition p;
	int rowSelected, colSelected;
	//-----------------------
   rowSelected=-1;
	colSelected=-1;
	
	int mouseRadius=1;
		
	srand(time(NULL));  // Seed the random number generator
			
	//Initialise the world boundaries
   grid_world.initSystemOfCoordinates();
	grid_world.loadMapAndDisplay(fileName);
	grid_world.initialiseMapConnections();
	
	//----------------------------------------------------------------
	//LPA*
	lpa_star = new LpaStar(grid_world.getGridWorldRows(), grid_world.getGridWorldCols());
	vertex start = grid_world.getStartVertex();
	vertex goal = grid_world.getGoalVertex();
	
	cout << "(start.col = " << start.col << ", start.row = " << start.row << ")" << endl;
	cout << "(goal.col = " << goal.col << ", goal.row = " << goal.row << ")" << endl;
	
	lpa_star->initialise(start.col, start.row, goal.col, goal.row);
	
	//lpa_star->copyMazeToDisplayMap(grid_world);
	//copyMazeToDisplayMap(grid_world, lpa_star);
	copyDisplayMapToMaze(grid_world, lpa_star);
	//----------------------------------------------------------------
		
	worldBoundary = grid_world.getWorldBoundary();
	deviceBoundary = grid_world.getDeviceBoundary();
	GRIDWORLD_ROWS = grid_world.getGridWorldRows();
	GRIDWORLD_COLS = grid_world.getGridWorldCols();
	
	//setvisualpage(page);
	
	// keep running the program until the ESC key is pressed   
	while((GetAsyncKeyState(VK_ESCAPE)) == 0 ) {
			 setactivepage(page);
			 cleardevice();
	
		    action = getKey(); 
		
		    if(SHOW_MAP_DETAILS) 
				 grid_world.displayMapWithDetails();
			 else
			    grid_world.displayMap();
			 
			 switch(action){
				case 1: //Block selected cell
				 		if( rowSelected != -1 && colSelected != -1){
							grid_world.setMapTypeValue(rowSelected-1, colSelected-1, '1');
							grid_world.initialiseMapConnections(); 
							
							rowSelected=-1;
							colSelected=-1;
						}
						action = -1;
						break;
				
				case 105: 
					   grid_world.displayMapWithKeyDetails();
						break;
				
				case 106: 
					  
					   //~ algorithmSelection = ASTAR_ALGORITHM;
						break;
				
				case 107: 
					  
					   //~ algorithmSelection = LPASTAR_ALGORITHM;
						break;
				
				case 108: 
					  
					   //~ algorithmSelection = DSTAR_ALGORITHM;
						break;
				
				case 15:
					 
					   if( rowSelected != -1 && colSelected != -1){
							grid_world.displayVertexConnections(colSelected-1, rowSelected-1);
						   //cout << "display connections" << endl;
						   rowSelected=-1;
						   colSelected=-1;
					   } else {
							cout << "invalid new START vertex, please select a new START vertex first." << endl;
							break;
						}
						//--------------------------------------------
					   action = -1;
					    break;
						
				case 16:
					 
					   if(grid_world.isGridMapInitialised()){
							grid_world.displayMapConnections();
						   //cout << "display connections" << endl;
						   //~ rowSelected=-1;
						   //~ colSelected=-1;
					   } else {
							cout << "map has not been initialised yet." << endl;
							break;
						}
						//--------------------------------------------
					   action = -1;
					    break;		
				
				case 6: //set cell as new START vertex 
				   {
					   //--------------------------------------------
				      // retrieve current START vertex
				      vertex s = 	grid_world.getStartVertex();
				      if( (s.row != -1) && (s.col != -1) ){
							//set current START VERTEX to an ordinary TRAVERSABLE CELL
							grid_world.setMapTypeValue(s.row, s.col, '0'); 
							grid_world.initialiseMapConnections(); 
							//ok, proceed
						} else {
							cout << "invalid START vertex" << endl;
							break;
						}
				      //--------------------------------------------
						//set selected cell as the NEW START VERTEX
					   if( rowSelected != -1 && colSelected != -1){
						   grid_world.setMapTypeValue(rowSelected-1, colSelected-1, '6');
						   s.row = rowSelected-1;
							s.col = colSelected-1;
							grid_world.setStartVertex(s);
							
						   rowSelected=-1;
						   colSelected=-1;
					   } else {
							cout << "invalid new START vertex, please select a new START vertex first." << endl;
							break;
						}
						//--------------------------------------------
					   action = -1;
						break;
					}
				
				case 7: //set cell as new GOAL vertex 
				   {
					   //--------------------------------------------
				      // retrieve current GOAL vertex
				      vertex s = 	grid_world.getGoalVertex();
				      if( (s.row != -1) && (s.col != -1) ){
							//set current GOAL VERTEX to an ordinary TRAVERSABLE CELL
							grid_world.setMapTypeValue(s.row, s.col, '0'); 
							
							//ok, proceed
						} else {
							cout << "invalid GOAL vertex" << endl;
							action = -1;
							break;
						}
				      //--------------------------------------------
						//set selected cell as the NEW GOAL VERTEX
					   if( rowSelected != -1 && colSelected != -1){
						   grid_world.setMapTypeValue(rowSelected-1, colSelected-1, '7');
						   s.row = rowSelected-1;
							s.col = colSelected-1;
							grid_world.setGoalVertex(s);
							grid_world.initialiseMapConnections(); 
							
						   rowSelected=-1;
						   colSelected=-1;
					   } else {
							cout << "invalid new GOAL vertex, please select a new GOAL vertex first." << endl;
							action = -1;
							break;
						}
						//--------------------------------------------
					   action = -1;
						break;
					}
							
            case 109:					
					   copyDisplayMapToMaze(grid_world, lpa_star);
				      cout << "copied display map to algorithm's maze" << endl;
				      action = -1;
				      break;
				
				case 110:					
					   lpa_star->updateHValues();
					   copyMazeToDisplayMap(grid_world, lpa_star);
				      cout << "copied algorithm's maze to display map" << endl;
				      action = -1;
				      break;
				
				case 9: //display g-values only
					   grid_world.displayMapWithSelectedDetails(true, false, false, false);  //(bool display_g, bool display_rhs, bool display_h, bool display_key) 
				      action = -1;
						break;
            case 10: //display h-values only
					   grid_world.displayMapWithSelectedDetails(false, false, true, false);  //(bool display_g, bool display_rhs, bool display_h, bool display_key) 
				 		action = -1;
				      break;
				case 11: //display key-values only
					   lpa_star->updateAllKeyValues();
				      copyMazeToDisplayMap(grid_world, lpa_star);
					   grid_world.displayMapWithSelectedDetails(false, false, false, true);  //(bool display_g, bool display_rhs, bool display_h, bool display_key) 
						action = -1;
				      break;
				
				case 12: //make cell Traversable
			 
					 if( rowSelected != -1 && colSelected != -1){
						 grid_world.setMapTypeValue(rowSelected-1, colSelected-1, '0');
						 
						 rowSelected=-1;
						 colSelected=-1;
					 }
					 action = -1;
					 break; 
					 
				case 14: 
					   grid_world.displayMapWithPositionDetails();
						action = -1;
				      break;	 
					 
				 //~ default: //Display grid without details
					   //~ grid_world.displayMap();
						  
				  
				 
		    };
		
	   //----------------------------------------------------------------------------------------------------------------	  
		// Mouse handling
		//
			 if(mousedown()){
						 				
				ANIMATE_MOUSE_FLAG=true;
				 			 
				mX = mousecurrentx();
				mY = mousecurrenty();
				 
				//if the goal selected is within the playing field boundaries
				if(mX >= grid_world.getFieldX1() && mX <= grid_world.getGridMaxX() && mY >= grid_world.getFieldY1() && mY <= grid_world.getGridMaxY()){
					
					    circle(mX, mY, 3);
					    validCellSelected = true;
  	            
				} else {
					validCellSelected = false;
				}
			 } //end of mousedown()
			 //------------------------------------------------------------------------------------------------------------------
			 /////////////////////////////////////////////////////////////////////////////
			 						 
			 if(ANIMATE_MOUSE_FLAG){
					
				  //draw Cross-hair to mark Goal	    
				  setcolor(RED);
				  circle(mX, mY, 20);
				  line(mX,mY-20,mX,mY+20);
				  line(mX-20,mY,mX+20,mY);
				  //end of draw Cross-hair 
			 
				  // special effect to display concentric circles locating the target
					setcolor(YELLOW);
					
					if(mouseRadius < 40) {
						mouseRadius += 1;
					}
					circle(mX, mY, mouseRadius);
					//Sleep(50);
									
					if(mouseRadius >= 40) {
						ANIMATE_MOUSE_FLAG=false;
						mouseRadius=0;
					}
					//end of special effect
			  }

			 
			 /////////////////////////////////////////////////////////////////////////////
			  char info[80]; 
			  float wX, wY;
			  
			  wX = xWorld(worldBoundary,deviceBoundary,mX);
			  wY = yWorld(worldBoundary,deviceBoundary,mY);
			  sprintf(info,"x: %d, y: %d",mX, mY); 
			  drawInformationPanel(grid_world.getFieldX2(), grid_world.getFieldY1() + textheight("H")*2, info);
			  
			 
			  sprintf(info,"wX: %3.0f, wY: %3.0f",wX, wY); 
			  drawInformationPanel(grid_world.getFieldX2(),grid_world.getFieldY1() + textheight("H")*5, info);
			 ///////////////////////////////////////////////////////////////////////////// 
			 
			  //~ CellPosition p;
			  //~ int rowSelected, colSelected;
			  
			  if(validCellSelected) {
				  p=grid_world.getCellPosition_markCell(mX, mY);
				  rowSelected = p.row;
				  colSelected = p.col;
				  
				  sprintf(info,"row: %d, col: %d",rowSelected, colSelected); 
			     drawInformationPanel(grid_world.getFieldX2(),grid_world.getFieldY1() + textheight("H")*6, info);
				  
			  }
			  setvisualpage(page);
			  page = !page;  //switch to another page
	}
}
Esempio n. 17
0
void MelhorProvaVVM(int old, int nnew)
   {
   register int     i, ncol, nlin,
		       escala, y0,
			   y1, y2;
   int             y_ini0, y_ini1;
   int                        cor;
   int               janelaAtiva;

   float    far              *apt;
   float    far           *aptaux;
   register float  flux, sum_flux;
   float                   sum[4];

   char                     *p_ch;
   char                  setaE[2],
			 setaD[2];




   setaE[0] = 27;
   setaD[0] = 26;
   setaE[1] = setaD[1] = '\0';

#ifndef MODO_VGA_640X480_HIG
   setactivepage(1);
   setvisualpage(1);
#else   MODO_VGA_640X480_HIG
   LimpaTela();
#endif  MODO_VGA_640X480_HIG

   setviewport ( 0, 0, MAXX, MAXY, 1 );
   clearviewport ();

   cor = getcolor();
   setcolor (bea_color[12]);
   CriaJanelaGrafica(   MANOB1,
			0,
			0,
			(int) ((MAXX * 49L)/100),
			(int) ((MAXY * 90L)/100),
			0, "MANOBRA %02d", old   );

   clearviewport();

   CriaJanelaGrafica(   MANOB2,
			(int) ((MAXX * 51L)/100),
			0,
			MAXX,
			(int) ((MAXY * 90L)/100),
			0,
			"MANOBRA %02d", nnew     );

   clearviewport();
   setcolor (cor);

   AtivaJanelaGrafica(MANOB1,0);
   setcolor ( bea_color[14] );

   getviewsettings (&vp);

   DesenhaEixos( DELTA_X(2), DELTA_X(96),
		 DELTA_Y(4), DELTA_Y(98),
		 DELTA_X(6), DELTA_Y(22),
		 DELTA_X(22),DELTA_Y(14) );

   sum_flux         =         0.0;
   escala           = DELTA_Y(14);
   coluna           = DELTA_X( 8);
   y0 = y_ini0      = DELTA_Y(76);
   y2 = y1 = y_ini1 = DELTA_Y(92);

   apt              =    inicVVM2;
   aptaux           = inicVVM2Int;
   sum[0] = sum[1]  =
   sum[2] = sum[3]  =         0.0;


   ScalaVVMBetter();


   for (   i = 0;
	   (*apt != FIM_1) &&
	   (apt < inicVVM2 + NUMMAXPONTOSINF);
	   apt++, i++    )
      {
      flux      = *aptaux; aptaux++;

#ifdef VVM_ALCAP_
      sum_flux += flux / SampleRatio;

      sum[0] = (.01 * sum_flux) + (.19 * sum[1]) +
	       (.30 *   sum[2]) + (.50 * sum[3]);

      sum[3] = sum[2];
      sum[2] = sum[1];
      sum[1] = sum[0];
#else  VVM_ALCAP_
      sum_flux = sum_flux;
      flux = flux;
      y_ini1 = y_ini1;
      y0 = y0;
      y1 = y1;
      y2 = y2;
#endif  VVM_ALCAP_

      ncol = (int) ( (((long) i) * DELTA_X(88))/2400 + DELTA_X( 8) );

      if ( ncol != coluna )
	 {
	 cor = getcolor();

	 /* -------------------------- */
	 /* Tracado do Volume Expirado */
	 /* -------------------------- */
	 nlin = (int) ((y_ini0 - (((long) escala ) * (*apt))/10));

	 moveto(coluna, y0);
	 lineto( coluna, nlin );
	 y0 = nlin;

#ifdef VVM_ALCAP_
	 setcolor (bea_color[ 7]);

	 /* ----------------------------- */
	 /* Tracado do Volume (Invertido) */
	 /* ----------------------------- */
	 nlin = (int) ((y_ini1 + (((long) escala ) * (sum_flux))/2));

	 moveto(coluna, y1);
	 lineto( coluna, nlin );
	 y1 = nlin;

	 setcolor (bea_color[11]);

	 /* -------------------------------------------------- */
	 /* Tracado Valor Medio filtrado do Volume (Invertido) */
	 /* -------------------------------------------------- */
	 nlin = (int) ((y_ini1 + (((long) escala ) * (sum[0]))/2));
	 moveto(coluna, y2);
	 lineto( coluna, nlin );
	 y2 = nlin;
#endif VVM_ALCAP_

	 setcolor (cor);

	 coluna = ncol;
	 }

      }

   outtextxy(DELTA_X(10) , DELTA_Y(10),
	     "Param  Teor    Calc      %");

   cor = getcolor ();

   setcolor (bea_color[15]);

   gprintf(  DELTA_X(10), DELTA_Y(11) + CharH,
	     "VVM    %6.2f  %6.2f  %4.0f",
	     VentVolMaxteorico,
	     VentVolMax2,
	     (VentVolMaxpercen2 + 0.5)  );

#ifdef VVM_ALCAP_
   gprintf  (DELTA_X(10), DELTA_Y(12) + 2 * CharH,
	     "ALCAP    --   %7.2f    - ",
	     VolAlcaponado2);
#endif VVM_ALCAP_



   /* -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= */


   setcolor (cor);

   AtivaJanelaGrafica(MANOB2,0);
   setcolor ( bea_color[14] );

   getviewsettings (&vp);

   DesenhaEixos( DELTA_X(2), DELTA_X(96),
		 DELTA_Y(4), DELTA_Y(98),
		 DELTA_X(6), DELTA_Y(22),
		 DELTA_X(22),DELTA_Y(14) );

   sum_flux         =         0.0;
   escala           = DELTA_Y(14);
   coluna           = DELTA_X( 8);
   y0 = y_ini0      = DELTA_Y(76);
   y2 = y1 = y_ini1 = DELTA_Y(92);

   apt              =    inicVVM1;
   aptaux           = inicVVM1Int;
   sum[0] = sum[1]  =
   sum[2] = sum[3]  =         0.0;


   ScalaVVMBetter();


   for (   i = 0;
	   (*apt != FIM_1) &&
	   (apt < inicVVM1 + NUMMAXPONTOSINF);
	   apt++, i++    )
      {
      flux      = *aptaux; aptaux++;
#ifdef VVM_ALCAP_
      sum_flux += flux / SampleRatio;

      sum[0] = (.01 * sum_flux) + (.19 * sum[1]) +
	       (.30 *   sum[2]) + (.50 * sum[3]);

      sum[3] = sum[2];
      sum[2] = sum[1];
      sum[1] = sum[0];
#endif VVM_ALCAP_

      ncol = (int) ( (((long) i) * DELTA_X(88))/2400 + DELTA_X( 8) );

      if ( ncol != coluna )
	 {
	 cor = getcolor();

	 /* -------------------------- */
	 /* Tracado do Volume Expirado */
	 /* -------------------------- */
	 nlin = (int) ((y_ini0 - (((long) escala ) * (*apt))/10));

	 moveto(coluna, y0);
	 lineto( coluna, nlin );
	 y0 = nlin;

#ifdef VVM_ALCAP_
	 setcolor (bea_color[ 7]);

	 /* ----------------------------- */
	 /* Tracado do Volume (Invertido) */
	 /* ----------------------------- */
	 nlin = (int) ((y_ini1 + (((long) escala ) * (sum_flux))/2));

	 moveto(coluna, y1);
	 lineto( coluna, nlin );
	 y1 = nlin;

	 setcolor (bea_color[11]);

	 /* -------------------------------------------------- */
	 /* Tracado Valor Medio filtrado do Volume (Invertido) */
	 /* -------------------------------------------------- */
	 nlin = (int) ((y_ini1 + (((long) escala ) * (sum[0]))/2));
	 moveto(coluna, y2);
	 lineto( coluna, nlin );
	 y2 = nlin;
#endif VVM_ALCAP_

	 setcolor (cor);

	 coluna = ncol;
	 }

      }

   outtextxy(DELTA_X(10) , DELTA_Y(10),
	     "Param  Teor    Calc      %");

   cor = getcolor ();

   setcolor (bea_color[15]);

   gprintf(  DELTA_X(10) , DELTA_Y(11) + CharH,
	     "VVM    %6.2f  %6.2f  %4.0f",
	     VentVolMaxteorico,
	     VentVolMax,
	     (VentVolMaxpercent + 0.5)  );

#ifdef VVM_ALCAP_
   gprintf  (DELTA_X(10), DELTA_Y(12) + 2 * CharH,
	     "ALCAP    --   %7.2f    - ",
	     VolAlcaponado);
#endif VVM_ALCAP_

   setcolor (cor);

   DesativaJanelaGrafica(MANOB2);

   cor = getcolor();
   setcolor (bea_color[12]);

   p_ch = "ESCOLHA DA MELHOR MANOBRA (%1s %1s)";

   gprintf((MAXX - textwidth(p_ch))/2,
	   (int) ((MAXY * 95L)/100),
	   p_ch,
	   setaE,
	   setaD);

   AtivaJanelaGrafica(MANOB1,0);
   setcolor ( bea_color[14] );
   janelaAtiva = 0;
   do {
      LimpaBufferTeclado();
      sc.c = LeTeclado();
      if (sc.ch[0] == 0)
	 if (sc.ch[1]==75 || sc.ch[1]==77)
	    {
	    DesativaJanelaGrafica(janelaAtiva);
	    janelaAtiva = (janelaAtiva + 1) % 2;
	    AtivaJanelaGrafica(janelaAtiva,0);
	    setcolor ( bea_color[14] );
	    }
      } while(sc.ch[0] != ENTER);

   setcolor (cor);

   DesativaJanelaGrafica(janelaAtiva);

   if (janelaAtiva == 0)
      {
      inicVVM1 = inicVVM2;
      inicVVM1Int = inicVVM2Int;
      VentVolMax = VentVolMax2;
      VentVolMaxpercent = VentVolMaxpercen2  ;
      VolAlcaponado = VolAlcaponado2;
      }
   else    ManobVVMAtiva = nnew;

#ifndef MODO_VGA_640X480_HIG
   setactivepage(0);
   setvisualpage(0);
#endif  MODO_VGA_640X480_HIG
   }        /* MelhorProvaVVM */
Esempio n. 18
0
void main()
  {

  /* Cube definition */

  int rx=100;           /* X radius */
  int ry=20;            /* Y radius */
  int xc=320;           /* X center */
  int yc=200;           /* Y center */
  int height=100;       /* Height of cube */
  int diff=(yc+height); /* Used by drawing code */

  /* Code variables */

  int page=0;           /* Points to current drawing page */
  int points;           /* Loop counter */
  float stp=M_PI_2;     /* PI divided by 2 */
  float t;              /* Loop counter */

  int x[4]={0,0,0,0};   /* Array to hold X coords of lines */
  int y[4]={0,0,0,0};   /* Array to hold Y coords of lines */
  int graphmode=VGAMED; /* Resolution of graphics screen */
  int graphdriver=VGA;  /* Mode of graphics */

  initgraph(&graphdriver,&graphmode,""); /* Set video mode */

  setgraphmode(graphmode); /* Set resolution to 640 x 350 x 16 color mode */

  setcolor(15);
  setfillstyle(SOLID_FILL,0); /* Solid to blank out screen */

  while (!kbhit())
    {
    for (t=0;t<stp;t=t+.01)
      {
      setvisualpage(page);
      setactivepage(1-page);
      bar(0,0,640,350); /* Clear off old stuff */

      for (points=0;points<4;points=points+1)
	{

	x[points]=xc+sin(t+(stp*points))*rx; /* Compute four points in a circle */
	y[points]=yc+cos(t+(stp*points))*ry; /* and put into coordinate arrays */

	/* Draw sides */

	line(x[points],y[points],x[points],diff-y[points]);

	}/* Next points */

      /* Draw bottom */

      moveto(x[0],y[0]);
      lineto(x[1],y[1]);
      lineto(x[2],y[2]);
      lineto(x[3],y[3]);
      lineto(x[0],y[0]);

      /* Draw top */

      moveto(x[0],diff-y[0]);
      lineto(x[1],diff-y[1]);
      lineto(x[2],diff-y[2]);
      lineto(x[3],diff-y[3]);
      lineto(x[0],diff-y[0]);

      page=1-page; /* Switch to a new page */

      }/* Next t */

    }/* Loop until someone presses a key... */

  closegraph();/* Reset all of the graphic stuff to old values */

  }/* End of Main() */
Esempio n. 19
0
////////////////////////MAIN/////////////////////////////
void main()
{
    //iniciar modo grafico
    modo_grafico();
    randomize();

    //pido memoria para los rectangulos
    //y les paso la coorenadas
    crear_imagenes();
    crear_estrellas();
    while(i<=21)
    {
        res.y=y;
        res.x=x;
        if(i%7==0)
        {
            y+=30;
            x=20;
        }
        else
        {
            x+=50;
        }
        crear_rectangulos(res);
        i++;
    }


    menu();
    presentacion();
    tecla=10;
    while(continuar!='n'&&continuar!='N')
    {
        if(cuentanavebuena<=0)
        {
            tecla=27;
            destruido();
        }
        //mientras la tecla pulsada no se escape
        while(tecla!=27&&cuentanavebuena>0)
        {
            //limpio el buffer
            fflush(stdin);
            //borro pantalla
            clearviewport();
            //pongo la nave buena
            //NaveBuena();
            //dibujo las estrelas
            estrellas();
            mover_estrellas();
            //dibujo los malisimos
            navesola();
            dibujar_rectangulos();
            swmalo=tocadomalo();
            if(swmalo==1)
            {   if(cuentanavebuena>0)cuentanavebuena--;

            }
            if(cuentanavebuena>0)
            {
                NaveBuena();
            }
            if(cuentanavebuena<=0)
            {
                destruido();
                break;

            }
            dibumala();
            puntos();
            vidas();
            contadorescudos();

            //miro si han pulsado una tecla
            if(kbhit())
            {
                tecla=getch();
                if(tecla==13&&topeescudo>0)
                {
                    //escudo();
                    swescudo=1;
                    topeescudo--;
                }
                if(tecla==27)continuar='n';
                if (tecla==0)
                {
                    tecla=getch();
                    switch (tecla)
                    {
                    case 75:
                        xbuena-=10;
                        if (xbuena<10)xbuena=10;
                        break;
                    case 77:
                        xbuena+=10;
                        if (xbuena>600)xbuena=600;
                        break;
                    }
                }

                //si la tecla es espacio
                else if(tecla==32 && contbb<totalbb)
                {
                    //sonido dolby surround
                    sound(8500);
                    delay(100);
                    sound(200);
                    delay(50);
                    nosound();
                    dibujarbb();
                }
            }
            if(cuentaescudo>=100)
            {
                swescudo=0;
                cuentaescudo=0;
            }
            if(swescudo==1)
            {
                escudo();
            }
            //si el conbb es mayor de 0 es que hay disparos en el aire
            if(contbb>0)
            {
                //miro si he matado ha alguien
                quitamala();
                moverbbeliminar();
            }
            //muevo los malisimos

            mover_rectangulos();
            //cambio de pagina de video
            setactivepage(1-pagina);
            setvisualpage(pagina);
            pagina=1-pagina;

        }
    }
    recor();
    //vacio las listas
    while(vaciar_rectangulos())
    {
        //vacio la lista
    }
    while(vaciar_balas_malo())
    {
        //vacio la lista de las balas de los malos
    }
    while(vaciar_balas_bueno())
    {
        //vacio la lista de las balas del bueno
    }
    while(vaciar_estrellas())
    {
        //vacio la lista de las balas del bueno
    }
    closegraph();
}
Esempio n. 20
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. 21
0
///////////////////////////funcion mejor///////////////////////////
void recor()  //mejoris es el vector,mejor es la variable y mejores es la estructura
{
    char nombre[25],let;
    int i=0,encontrado=0,x=10;
    FILE *pf=NULL;
    pf=fopen("d:\\tc\\bin\\mejor.txt","r+b");
    if(pf==NULL)printf("ERROR");
    else
    {

        fread(mejoris,sizeof(struct mejores),10,pf);
        for(i=0; i<10; i++)
        {
            for(x=0; x<9; x++)
            {
                if(mejoris[x].puntos<mejoris[x+1].puntos)
                {
                    mejor.puntos=mejoris[x].puntos;
                    mejoris[x].puntos=mejoris[x+1].puntos;
                    mejoris[x+1].puntos=mejor.puntos;

                }
            }
        }
        setactivepage(0);
        setvisualpage(0);
        clearviewport();
        setcolor(LIGHTBLUE);
        settextstyle(3,0,3);
        outtextxy(200,150,"INTRODUCE TU NOMBRE");
        gets(nombre);
        strcpy(mejor.nombre,nombre);
        mejor.puntos=punto;
        i=9;
        while(i>=0 && encontrado==0)
        {
            if(mejoris[i].puntos<mejor.puntos)
            {
                mejoris[i].puntos=mejor.puntos;
                strcpy(mejoris[i].nombre,mejor.nombre);
                encontrado=1;

            }
            i--;
        }
    }
    fclose(pf);
    pf=fopen("d:\\tc\\bin\\mejor.txt","wb");
    fwrite(mejoris,sizeof(struct mejores),10,pf);
    fclose(pf);
    pf=fopen("d:\\tc\\bin\\mejor.txt","rb");
    //fwrite(mejoris,sizeof(struct mejores),10,pf);
    if(pf==NULL)
    {
        setcolor(RED-BLINK);
        settextstyle(3,0,3);
        outtextxy(200,150,"HARCHIVO NO ENCONTRADO");
    }
    else
    {

        setcolor(BLUE);
        settextstyle(1,0,1);
        i=0;
        fread(&mejor,sizeof(struct mejores),1,pf);
        x=25;
        clearviewport();
        outtextxy(270,10,"LOS MEJORES SON...");
        while(!feof(pf)&i<10)
        {

            if(i==9&&encontrado==1)
            {
                setcolor(YELLOW);
                settextstyle(1,0,1);
                outtextxy(230,x,"<-TU PUNTUACION");
            }
            outtextxy(120,x,mejor.nombre);
            itoa(mejor.puntos,nombre,10);
            outtextxy(200,x,nombre);
            fread(&mejor,sizeof(struct mejores),1,pf);
            i++;
            x+=25;
        }

    }
    //}
    fclose(pf);
    getch();
}
Esempio n. 22
0
void main_page(int *choice)
{
	CAR cp1;
	MAP mp;
	mp.map_xspeed=0;mp.map_yspeed=0;
	cp1.angle=0;cp1.xspeed=0;cp1.yspeed=0;
	double  speed=0;
	double map_speed=0;
	int i=0;                        
	int flag_click_beg=0;    //the three flags are used to judge if the "Start","Finish","Begin" button is pressed
	double distance=0;                //此距离要根据选择路径的函数来实时反馈
	int start_point=-1, finish_point=-1;
	int  center_x;
	int  center_y;
	int flag_judge_finish=0;
	int flag_road_error=0;
	int map_first=0;  //to judge  car  whether it is out of bounds(150,100,400,250)  
	double p_distance[SPOTNUM][SPOTNUM];
	double d[SPOTNUM];
	int path[SPOTNUM];
	POINT point[SPOTNUM];
	STREET all_street[18];
   	LITTLE all_ninebuilding[3];
	LITTLE all_small_door[5];
	LITTLE all_tree[10];
	LITTLE all_mpeople[5];
	LITTLE all_wpeople[5];
	LITTLE all_lake[3];
	LITTLE all_playground[3];
	LITTLE all_bigbuilding[5];
	LITTLE all_house[10];
	LITTLE bicycle[3];
	init_map(all_street,all_tree,all_mpeople,all_wpeople,all_ninebuilding,all_playground,all_small_door,all_lake,all_bigbuilding,all_house,bicycle);
	init_point_info(point,p_distance);
	while(1)
	{
		flag_click_beg=0;
		flag_judge_finish=0;
		InitGra(350);
		setbkcolor(LIGHTGREEN);
		draw_map(all_street,all_tree,all_mpeople,all_wpeople,all_ninebuilding,all_playground,all_small_door,all_lake,all_bigbuilding,all_house,bicycle);
		right_plus();
		 while(!(1==flag_click_beg && start_point>=0 && finish_point>=0))
		{
			switch(*choice)
			{
				case 0:
					search(point,&flag_click_beg,&start_point,&finish_point); 
				     break;
				case 1:
					mouse_ctrl(&flag_click_beg,&start_point,&finish_point);
					break;
				default:
					break;
			}
			cleardevice();
			draw_map(all_street,all_tree,all_mpeople,all_wpeople,all_ninebuilding,all_playground,all_small_door,all_lake,all_bigbuilding,all_house,bicycle);
			mouse_click();
		}
		shortestpath(p_distance,SPOTNUM,d,path,start_point);
		distance=rest_distance(&cp1,point[finish_point]);
		center_x=340-point[start_point].x;
		center_y=170-point[start_point].y;
		second_init_map(&center_x, &center_y,point,all_street,all_tree,all_mpeople,all_wpeople,all_ninebuilding,all_playground,all_small_door,all_lake,all_bigbuilding,all_house,bicycle);
		cp1.x=point[start_point].x;
		cp1.y=point[start_point].y;
	     while(0==flag_judge_finish && 0==flag_road_error)
	    {
			while(0==flag_judge_finish && 0==flag_road_error)     //有没有完成一次导航的标志,如果完成就会跳出大循环
			{
				for(i=0;i<2;i++)
				{
					setactivepage(i);
				     cleardevice();
				     draw_map(all_street,all_tree,all_mpeople,all_wpeople,all_ninebuilding,all_playground,all_small_door,all_lake,all_bigbuilding,all_house,bicycle);
				     drawroutine(start_point, finish_point,point,path); 					//画出最短的路径
					 car_control(&cp1,&speed);
				     map_ctrl(&mp,&cp1,&speed,&map_first,&map_speed,point,all_street,all_tree,all_mpeople,all_wpeople,
					              all_ninebuilding,all_playground,all_small_door,all_lake,all_bigbuilding,all_house,bicycle);
					 distance=rest_distance(&cp1,point[finish_point]);
					 draw_car(&cp1);
				     mouse_click();
					 show_distance(&distance);
				/*======================判断小车所处位置=============================*/
				     judge_pre_car(&cp1,point);
				     change_route(&cp1, point, &start_point, &finish_point,path,&flag_road_error);
				     warning(&map_speed, &speed);
				     setvisualpage(i);
				     delay(15);
			     }
			    flag_judge_finish=judge_finish(&cp1,point[finish_point]);
		    }
	          if(1==flag_judge_finish)
		    {
			     distance=0;
				draw_bar1(494,57,636,78,LIGHTGRAY);
			     dis_hz(495,60,"到达目的地",0,20,YELLOW);
			     guidance_end(150,100);
			     cp1.angle=0;		
			     flag_click_beg=0;
			     speed=0;
			     map_speed=0; 			    //再次进入的时候,还是先判断车速
			     start_point=-1;
				finish_point=-1;
				map_first=0;
		     }
			if(1==flag_road_error)
		    {
				shortestpath(p_distance,SPOTNUM,d,path,start_point);
				draw_bar1(494,57,636,150,LIGHTGRAY);
			     dis_hz(495,60,"路线错误,正在",0,18,LIGHTRED);
				dis_hz(495,80,"为您重新查找……",0,18,LIGHTRED);
			     delay(1000);
			     draw_bar1(494,57,636,150,LIGHTGRAY);
			     flag_road_error=0;
		     }
	     }
	}
}
Esempio n. 23
0
void juego(int vidas)
{
    char tecla;
    Malla cab = NULL, dino, aux;
    int spriteH, // Altura de cualquier sprite
        retraso = 150,
        pagina = 1,
        i, j = 0,
        huesos,
        jungla = 0;
    String nSkin;

    srand(time(NULL));
    spriteH = 592 - PIXEL_TAM*23;
    sprintf(nSkin, "dino%d.0.txt", skin);

	pintaAmbiente(pagina, jungla);
    obtenerDatos(&huesos, &i);
    // Inicia malla
	creaMalla(&cab, &dino);
	setactivepage(pagina);
    setfillstyle(1, COLOR(79, 182, 225));
    bar(0,0, WIDTH, HEIGHT);

	setactivepage(pagina!=pagina);
    setfillstyle(1, COLOR(79, 182, 225));
    bar(0,0, WIDTH, HEIGHT);

    setvisualpage(pagina);
    do
    {
        setactivepage(pagina=!pagina);
        jungla+=jungla<=4?1:-4;
        pintaAmbiente(pagina, jungla);
        delay(retraso);
        pintaEscenario(cab);
        dibujaVidas(vidas);
        dibujaHuesos(huesos);
        if(j>6)
        {
            retraso-=retraso>50?8:0;
            j=0;
            aux=cab;
            for(i=0; i<N-1; i++)
                aux = aux->der;

            for(i=0; i<M-1; i++)
                aux = aux->abajo;

            aux->tipo=rand()%4+1;
        }
        j+=rand()%3;
        setvisualpage(pagina);

        if(kbhit())
        {
            dino = dino->arriba->arriba;
            tecla = getch();
            putimage(0, 400, imagenes[jungla], COPY_PUT);
            pintaEscenario(cab);
            dibujaSprite(nSkin, 100, spriteH);
            delay(retraso);
            dino = dino->abajo->abajo;
        }

        switch(dino->tipo)
        {
            case 1:huesos+=5;break;
            case 2:huesos++; break;
            case 3:vidas--;  break;
            case 4:vidas--;  break;
        }

    }while(vidas>0);

    escribeAjustes(huesos);
    popup();
    getch();
    iniciaEntorno();
    /*for(i=0;i<226; i++)
    {
        //setfillstyle(1, COLOR(0,i,i));
        setcolor(COLOR(79,182,i));
        line(0,i,WIDTH,i);
        delay(1);
    }*/
}