-
Notifications
You must be signed in to change notification settings - Fork 0
/
GameOverScreen.cpp
75 lines (51 loc) · 1.28 KB
/
GameOverScreen.cpp
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
65
66
67
68
69
70
71
72
73
74
75
#include "StdAfx.h"
#include "GameOverScreen.h"
#include "RLKeyboard.h"
using RustyLib::Input::Keyboard;
#include "RLRenderer.h"
using RustyLib::Graphics::Renderer;
#include "RLScreenManager.h"
using RustyLib::Framework::ScreenManagement::ScreenManager;
#include "GameScreen.h"
GameOverScreen::GameOverScreen(void)
{
}
GameOverScreen::~GameOverScreen(void)
{
}
Error GameOverScreen::Initialise(void )
{
return Error::RL_NO_ERROR;
}
Error GameOverScreen::Initialise(const int score)
{
player_score = score;
return Error::RL_NO_ERROR;
}
Error GameOverScreen::Exit(void )
{
return Error::RL_NO_ERROR;
}
void GameOverScreen::Update(const float time_step)
{
if(Keyboard::IsKeyDown(RustyLib::Input::KeyCode::SpaceBar))
{
//Restart again
GameScreen *game_screen = new GameScreen();
ScreenManager::Instance().ChangeScreen(game_screen);
}
}
void GameOverScreen::Render(void )
{
Renderer *r = &Renderer::Instance();
r->SetLineColour(0.0f,255.0f,0.0f);
std::string text = "You Lost Fool!";
r->RenderText(text, 330, 250);
std::ostringstream sstr;
sstr << "Score: " << player_score;
r->RenderText(sstr.str(), 355, 280);
std::string text2 = "Press SPACE to restart.";
r->RenderText(text2, 290, 310);
std::string text3 = "Press ESC to quit.";
r->RenderText(text3, 320, 340);
}