Example #1
0
void 
Game::Draw(BackBuffer& backBuffer)
{
	++m_frameCount;
	backBuffer.SetClearColour(0, 0, 0);
	backBuffer.Clear();

	// Ex006.3: Draw all enemy aliens in container...
	for (int i = 0; i < m_enemyShip.size(); i++) {
		m_enemyShip[i]->Draw(backBuffer);
	}

	// Ex006.4: Draw all bullets in container...
	for (int i = 0; i < m_bullet.size(); i++) {
		m_bullet[i]->Draw(backBuffer);
	}

	// Draw the explosions
	for (int i = 0; i < m_explosion.size(); i++) {
		m_explosion[i]->Draw(backBuffer);
	}

	// Draw the particle within the emitter // encapsulate this!
	if (m_pEmitter->IsEmitting()) {
		m_pEmitter->Draw(backBuffer);
	}


	// Ex006.2: Draw the player ship...
	m_playerShip->Draw(backBuffer);

	backBuffer.Present();
}
Example #2
0
void 
Game::Draw(BackBuffer& backBuffer)
{
	++m_frameCount;

	backBuffer.SetClearColour(0,0,0);
	backBuffer.Clear();
	bg->Draw(*m_pBackBuffer);
	
	// Draw all enemy aliens in container...
	std::vector<Enemy*>::iterator enemyIterator;
	for(enemyIterator = m_EnemyVector.begin();
		enemyIterator != m_EnemyVector.end();
		++enemyIterator)
	{
		(*enemyIterator)->Draw(backBuffer);
	}
	//draw platfomrs 
	std::vector<Platform*>::iterator platIterator;
	for (platIterator = m_PlatVector.begin();
	platIterator != m_PlatVector.end();
		++platIterator)
	{
		(*platIterator)->Draw(backBuffer);
	}

	// Draw all bullets in container...
	std::vector<Bullet*>::iterator bulletIterator;
	for(bulletIterator = m_BulletVector.begin();
		bulletIterator != m_BulletVector.end();
		++bulletIterator)
	{
		(*bulletIterator)->Draw(backBuffer);
	}
	

		
	

		
	// Draw the player ship...
	m_pPlayer->Draw(*m_pBackBuffer);
	
	//Draw explosions
	std::vector<Explosion*>::iterator ExplosionIterator;
	for (ExplosionIterator = Explosions.begin(); ExplosionIterator != Explosions.end(); ++ExplosionIterator)
	{
		(*ExplosionIterator)->Draw(backBuffer);
	}
	

	backBuffer.Present();
}