Exemple #1
0
int Game::Draw(){
	ClearScreen();
	glLoadIdentity();
	camera->Update();

	//描画処理
	switch(phase){
	case MENU:
		DrawMenu();
		break;
	case PLAY:
		DrawPlay();
		break;
	case RESULT:
		DrawResult();
		break;
	}

	SwapScreen();
	return 0;
}
Exemple #2
0
// ************************************************************************** //
// ****************************** Manipulators ****************************** //
// ************************************************************************** //
void Decepticon :: Draw()
{
	glPushMatrix();
		glTranslatef(0, transform_position, 0);
		glRotatef(-bend_angle, -1, 0, 0);

		glPushMatrix();
			glTranslatef(0, -torso_length, 0);
			DrawBody();												// draw body
			glPushMatrix();
				glTranslatef(0, 10, 20);
				glPushMatrix();
					glTranslatef(0, 10, -20);
					if (display_mode == GL_POLYGON)
					{
						GLfloat mat_ambient[] = {1.0, 0.0, 1.0, 1.0};
						GLfloat mat_diffuse[] = {1.0, 0.0, 1.0, 1.0};
						glMaterialfv(GL_FRONT, GL_AMBIENT, mat_ambient);
						glMaterialfv(GL_FRONT, GL_DIFFUSE, mat_diffuse);

						glutSolidTeapot(15);

						mat_ambient[0] = 0.0;
						mat_ambient[1] = 0.0;
						mat_ambient[2] = 1.0;
						mat_diffuse[0] = 0.0;
						mat_diffuse[1] = 0.0;
						mat_diffuse[2] = 0.8;
						glMaterialfv(GL_FRONT, GL_AMBIENT, mat_ambient);
						glMaterialfv(GL_FRONT, GL_DIFFUSE, mat_diffuse);
					}  // if statement
				glPopMatrix();
				glRotatef(window_angle, 1, 0, 0);
				DrawWindow();											// draw window
			glPopMatrix();
			glPushMatrix();
				glTranslatef(50, 47.5, 15);
				glRotatef(left_shoulder_forward_angle, -1, 0, 0);
				glRotatef(left_shoulder_outward_angle, 0, 0, 1);
				glTranslatef(0, 0, left_shoulder_back);
				glRotatef(left_shoulder_rotate, 0, 1, 0);
				DrawShoulder();											// draw left shoulder
				glPushMatrix();
					glTranslatef(0, 10, 0);
					glRotatef(left_shoulder_twist_angle, 0, 1, 0);
					DrawUpperArm();										// draw left upper arm
					glPushMatrix();
						glTranslatef(9, -40, 0);
						glRotatef(left_elbow_forward_angle, -1, 0, 0);
						glTranslatef(0, left_lower_arm_retract, 0);
						DrawLowerArm();									// draw left lower arm
					glPopMatrix();
				glPopMatrix();
			glPopMatrix();
			glPushMatrix();
				glTranslatef(-50, 47.5, 15);
				glScalef(-1, 1, 1);
				glRotatef(right_shoulder_forward_angle, 1, 0, 0);
				glRotatef(right_shoulder_outward_angle, 0, 0, 1);
				glTranslatef(0, 0, right_shoulder_back);
				glRotatef(right_shoulder_rotate, 0, 1, 0);
				DrawShoulder();											// draw right shoulder
				glPushMatrix();
					glTranslatef(0, 10, 0);
					glRotatef(right_shoulder_twist_angle, 0, 1, 0);
					DrawUpperArm();										// draw right upper arm
					glPushMatrix();
						glTranslatef(9, -40, 0);
						glRotatef(right_elbow_forward_angle, 1, 0, 0);
						glTranslatef(0, right_lower_arm_retract, 0);
						DrawLowerArm();									// draw right lower arm
					glPopMatrix();
				glPopMatrix();
			glPopMatrix();
			glTranslatef(0, torso_length, 0);
			DrawTorso();												// draw torso
			glPushMatrix();
				glTranslatef(0, -15, 0);
				glRotatef(bend_angle, -1, 0, 0);
				glRotatef(hips_angle, -1, 0, 0);
				DrawHips();												// draw hips
				glPushMatrix();
					glTranslatef(0, -12.5, 15);
					DrawRewind();
					DrawFastForward();
					DrawPlay();
					DrawStop();
					DrawPause();
					glPushMatrix();
						glTranslatef(22.5, -5, -15);
						glTranslatef(0, left_leg_drop, 0);
						glRotatef(left_leg_twist_angle, 0, 1, 0);
						glRotatef(left_leg_forward_angle, -1, 0, 0);
						glRotatef(left_leg_outward_angle, 0, 0, 1);
						glTranslatef(0, left_upper_leg_length, 0);
						DrawUpperLeg();									// draw left upper leg
						glPushMatrix();
							glTranslatef(0, -65, 0);
							glTranslatef(0, left_lower_leg_length, 0);
							glRotatef(left_knee_angle, 1, 0, 0);
							DrawLowerLeg();								// draw left lower leg
							glTranslatef(0, -70, 5);
							glRotatef(left_foot_angle, 1, 0, 0);
							glTranslatef(0, 0, left_foot_retract);
							DrawFoot();									// draw left foot
						glPopMatrix();
					glPopMatrix();
					glPushMatrix();
						glTranslatef(-22.5, -5, -15);
						glTranslatef(0, right_leg_drop, 0);
						glRotatef(right_leg_twist_angle, 0, -1, 0);
						glRotatef(right_leg_forward_angle, -1, 0, 0);
						glRotatef(right_leg_outward_angle, 0, 0, -1);
						glTranslatef(0, right_upper_leg_length, 0);
						DrawUpperLeg();									// draw right upper leg
						glPushMatrix();
							glTranslatef(0, -65, 0);
							glScalef(-1, 1, 1);
							glTranslatef(0, right_lower_leg_length, 0);
							glRotatef(right_knee_angle, 1, 0, 0);
							DrawLowerLeg();								// draw right lower leg
							glTranslatef(0, -70, 5);
							glRotatef(right_foot_angle, 1, 0, 0);
							glTranslatef(0, 0, right_foot_retract);
							DrawFoot();									// draw right foot
						glPopMatrix();
					glPopMatrix();
				glPopMatrix();
			glPopMatrix();
		glPopMatrix();

	glPopMatrix();
}  // DrawSoundwave