Exemplo n.º 1
0
Arquivo: anim.cpp Projeto: llevar/uoft
void display(void) {
  
  glLoadIdentity();
  glClearColor(0.0f,0.0f,0.0f,1.0f);   //set the background colour 
  // OK, now clear the screen with the background colour 
  glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
  
	
	/* Place the camera in various positions in the secene */
	
	if(curTime >= 0 && curTime <= 3){ 
		gluLookAt(-12,5,30,0,5,0,0,1,0);
	}
	else if(curTime > 3 && curTime <= 6){
		gluLookAt(-12,5, 10, 0, 7, 0, 0, 1, 0);
	}
	else if(curTime > 6 && curTime <= 10.75){
		gluLookAt(0, 5, 30, 0, 5, 0, 0, 1, 0);
	}
	else if(curTime > 10.75 && curTime <= 11.5){
		gluLookAt(-12, 7, -8, 0, 4, -2, 0, 1, 0);
	
	}
	else if(curTime > 11.5 && curTime <= 12){
	
		gluLookAt(11, 25, -30, -2,5, 0, 0, 1, 0);
	}
	else {
		gluLookAt(-12,5, 10, 0, 7, 0, 0, 1, 0);
	}	
	
	drawWalls();
	drawColumnSet();
	drawStairs();
	drawCube();
	drawSphere();
	drawPlatform();
	drawPyramid();
 	
	glPushMatrix();
	drawMan();
 	glPopMatrix();
	
	
	drawHammer();
	glFlush();

  glutSwapBuffers();

  if (recording) {
    int frame = (int)(curTime / tStep + 0.5);
    save_image(frame);
  }      
}
Exemplo n.º 2
0
void draw(char *buffer) {
	int i;
	switch (state) {
		case END:
		case PLAYING:
			drawSpriteBG(spriteBG, buffer);
		
			drawScoreValue(score, 695, 17, 0, 3, buffer);
		
			drawHighScores(highScores, 368, 85, 0, 1, buffer);
			
			for (i = 0; i < NUM_PCS; i++)
				drawCScreen(cscreens[i], buffer);
				
			drawButton(helpButton, buffer);
			drawButton(exitButton, buffer);
			
			break;
		case SCORE:
			drawSpriteBG(scoreBoard, buffer);
			
			drawScoreValue(score, 150, 200, 15, 10, buffer);
			
			if (highScore) {
				drawString("Name:", 40, 415, 15, 5, buffer);
				drawString(score->name, 250, 415, 15, 5, buffer);
			} else {
				drawString("You FAIL!", 40, 415, 15, 7, buffer);
			}
			break;
		case HELP:
			drawSpriteBG(helpBoard, buffer);
			break;
		default:
			break;
	}
	
	drawHammer(hammer, buffer);
}