Esempio n. 1
0
void drawHUD(ViewCamera& currentView, PlayerController* player, GameWorld* world, GameRenderer* render)
{
	if(player && player->getCharacter()) {
		drawMap(currentView, player, world, render);
		drawPlayerInfo(player, world, render);
	}
}
Esempio n. 2
0
void Overlay::drawGameOver(std::vector<Player *> players, int playerId, bool haswon) {
	//init glut overlay
	initdraw();

	//first player to get camera size
	Player * playerone = players[0];
	
	
	//Draw overlay red is lose otherwise green
	//glColor3f(!haswon, haswon, 0);
	
	glEnable(GL_BLEND);
	glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
	glColor4f(!haswon, haswon, 0, (GLfloat)0.55);

	//space between objects
	int margin = 200;


	//drawBackground:
	glBegin(GL_QUADS);
	glVertex2f((GLfloat)margin, (GLfloat)playerone->getCamera()->height - margin);
	glVertex2f((GLfloat)margin, (GLfloat)margin);
	glVertex2f((GLfloat)playerone->getCamera()->width - margin, (GLfloat)margin);
	glVertex2f((GLfloat)playerone->getCamera()->width - margin, (GLfloat)playerone->getCamera()->height - margin);
	glEnd();

	margin += 25;

	//draw players
	for (int i = 0; i < players.size(); i++) {
		int x0 = margin;
		int y0 = margin + (i*125);
		int x1 = playerone->getCamera()->width - margin;
		int y1 = margin + 100 + (i * 125);
		bool isCurrentPlayer = false;

		//highlight if current player
		if (i == playerId) {
			isCurrentPlayer = true;
		}

		//draw player information
		drawPlayerInfo(players[i], x0, y0, x1, y1, isCurrentPlayer);

	}



	glutdrawstring("Game Over " ,  playerone->getCamera()->width / 2 - 75, 100, GLUT_BITMAP_TIMES_ROMAN_24);

	//reset settings:
	stopDrawing();
}