Exemplo n.º 1
0
//=======================================================================
// Ship
//=======================================================================
void Ship(int locX, int fPosY, float rotation)
{
	glLoadIdentity();

	glTranslatef(WIDTH/2, HEIGHT/2, 0);
	glRotatef(rotation, 0, 0, 1);
	
	if(!GameOver)
	{
		if(DEBUG)
			DebugShip(locX, fPosY);
		else		
			texManager.DrawTextured(0, 0, 64, 64, Player_Ship_Texture);
	}
	else
	{
		texManager.DrawTextured(0, 0, 512, 512, explosionTex);
		GameState = GAMEOVER;
	}
}
Exemplo n.º 2
0
	void Render(float dt)
	{
		for(unsigned int i=0; i<entities.size(); i++)
		{
			glLoadIdentity();

			Entity* e = entities[i];
			
			switch(e->type)
			{
				case BULLET:
				{
					e->position += e->direction * Speed/10 * e->type * dt;

					glBegin(GL_POINTS);
					glVertex2f(e->position.x, e->position.y);
					glEnd();
				}
				break;

				case ENEMY:
				{
					Enemy* enemy = static_cast<Enemy*>(e);

					enemy->position += enemy->direction * enemySpeed/10 * dt;

					//Debug
					//cout << enemy->position.x << " , " << enemy->position.y << endl;

					if(enemy->dying)
					{
						texManager.DrawTextured(enemy->position.x, enemy->position.y, 60.0f, 60.0f, explosionTex);
					}
					else
					{
						glTranslatef(enemy->position.x, enemy->position.y, 0);
						glRotatef(enemy->dirAngle, 0 ,0, 1);
						if(enemy->level == 1)
						glScalef(.5,.5,0);
						

						if(DEBUG)
						{
							glColor3f(1,0,0);
							DebugShip(0, 0);
						}
						else
						{
							if(enemy->level == 1)
								texManager.DrawTextured(0, 0, 60.0f, 60.0f, enemyTexI);
							else
								texManager.DrawTextured(0, 0, 60.0f, 60.0f, enemyTexII);
						}
					}
				}
				break;

			}

		}
	}