Ejemplo n.º 1
0
void GameActivity::render()
{
	
	glClear(GL_COLOR_BUFFER_BIT);
	
	glLoadIdentity();									
	// Use the negated camera position as a translation; effectively we move the world and the camera so that the camera is at 0,0,0
	glTranslated(-camX, -camY, 0.0);

	// Render the  background
	
		drawTiles();
	
	
	//hero.boundingBox.draw();
	hero.draw(playerTextureID);
	
	//drawing Collectables
	for each (Collectable  c in collectables)
	{
		if (c.type == Collectable::Type::GUN)
		{
			c.draw(2);
		}
		else
		{
			c.draw(1);
		}
	}
	
	//drawing each player bullet  
	for (int i = 0; i < hero.bullets.size(); i++)
	{
		//hero.bullets[i].boundingBox.draw();
		hero.bullets[i].draw(bullet1ID,0.1);
	}
	//drawing each enemy in the vector
	for (int i = 0; i < enemies.size(); i++)
	{
		//enemies[i].boundingBox.draw();
		enemies[i].draw();
	}
	if (boss_flag==true)
	{
		
		boss.draw();
	}
	for (int i = 0; i < enemies.size(); i++)
	{
		for (int j = 0; j < enemies[i].bullets.size(); j++)
		{
			//enemies[i].bullets[j].boundingBox.draw();
			enemies[i].bullets[j].draw(bullet2ID, 0.3);
		}
	}
	renderHUD();
	glFlush();

}
Ejemplo n.º 2
0
void display( )
{
	switch( DisplayMode )
	{
	case GAME:
	{
		glLightfv(GL_LIGHT0, GL_POSITION, LightPos);
		drawLightPosition();
		//drawCoordinateSystem();

		// Note that drawing order has consequences for 'transparancy'
		background->draw();
		for (int i = 0; i < numberOfRidges; i++)
		{
			mountains[i].draw();
		}
		groundfloor->draw();
		
		if (toggleBoss)
			boss.draw();

		glDisable(GL_DEPTH_TEST);
		for (auto &projectile : projectiles) {
			projectile.draw();
		}
		glEnable(GL_DEPTH_TEST);

        character.draw();
		for (auto &enemy : enemies) {
			enemy.draw();
		}
		break;
	}
    case MESH:
    {
        glEnable(GL_LIGHTING);
        glPushMatrix();
		//David:
        //glRotatef(-90.0f, 0.0f, 0.0f, 1.0f);
        //glRotatef(-90.0f, 0.0f, 1.0f, 0.0f);
		//hoofd
		//glRotatef(90.0f, 0.0f, 0.0f, 1.0f);
		//glRotatef(-90.0f, 1.0f, 0.0f, 0.0f);
        meshes[meshIndex].drawSmooth();
        glPopMatrix();
        glDisable(GL_LIGHTING);
        break;
    }
	default:
		break;
	}
}