-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGameStatusViewGC.cpp
More file actions
64 lines (52 loc) · 2.07 KB
/
GameStatusViewGC.cpp
File metadata and controls
64 lines (52 loc) · 2.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#include "GameStatusViewGC.h"
#include "GameManager.h"
GameStatusViewGC::GameStatusViewGC()
{
}
GameStatusViewGC::~GameStatusViewGC()
{
}
void GameStatusViewGC::render(Container* c, Uint32 time) {
int auxScore = static_cast<GameManager*>(c)->getScore();
int auxWinner = static_cast<GameManager*>(c)->getWinner();
int auxLives = static_cast<GameManager*>(c)->getLives();
bool auxRunning = static_cast<GameManager*>(c)->getRunning();
bool auxGameOver = static_cast<GameManager*>(c)->getGameOver();
//Todos los mensajes
Texture msgGameOver(c->getGame()->getRenderer(),
"Game Over! The winner is Asteorids!",
*(c->getGame()->getServiceLocator()->getFonts()->getFont(
Resources::ARIAL24)), { COLOR(0x0022ffff) });
Texture msgGameWin(c->getGame()->getRenderer(),
"Game Over! The winner is Fighter!",
*(c->getGame()->getServiceLocator()->getFonts()->getFont(
Resources::ARIAL24)), { COLOR(0x0022ffff) });
Texture msgContinue(c->getGame()->getRenderer(),
"“Press ENTER to Continue",
*(c->getGame()->getServiceLocator()->getFonts()->getFont(
Resources::ARIAL24)), { COLOR(0x0022ffff) });
Texture msgNewGame(c->getGame()->getRenderer(),
"“Press ENTER to Start a New Game“",
*(c->getGame()->getServiceLocator()->getFonts()->getFont(
Resources::ARIAL24)), { COLOR(0x0022ffff) });
if (!auxRunning) {
if (auxWinner != 0) {
if (auxWinner == 1) {
msgGameWin.render(c->getGame()->getRenderer(),
c->getGame()->getWindowWidth() / 2 - msgGameWin.getWidth() / 2, c->getGame()->getWindowHeight() - 150);
}
else {
msgGameOver.render(c->getGame()->getRenderer(),
c->getGame()->getWindowWidth() / 2 - msgGameOver.getWidth() / 2, c->getGame()->getWindowHeight() - 150);
}
}
if (auxGameOver) { //Nueva partida
msgNewGame.render(c->getGame()->getRenderer(),
c->getGame()->getWindowWidth() / 2 - msgNewGame.getWidth() / 2, c->getGame()->getWindowHeight() - 50);
}
else {
msgContinue.render(c->getGame()->getRenderer(),
c->getGame()->getWindowWidth() / 2 - msgContinue.getWidth() / 2, c->getGame()->getWindowHeight() - 50);
}
}
}