-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCScoreManager.cpp
More file actions
41 lines (33 loc) · 830 Bytes
/
Copy pathCScoreManager.cpp
File metadata and controls
41 lines (33 loc) · 830 Bytes
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
#include "CApplication.h"
#include "CScoreManager.h"
extern CApplication Game;
CScoreManager::CScoreManager()
: m_Points(0)
, m_BestPoints(0)
{
m_Score.setFont((*Game.m_Font));
m_Score.setCharacterSize(25);
m_Score.setPosition(5, 5);
m_Best.setFont((*Game.m_Font));
m_Best.setCharacterSize(25);
this->update();
}
CScoreManager::~CScoreManager()
{
}
void CScoreManager::update() {
m_Score.setString("Score: " + std::to_string(m_Points));
m_Best.setString("Best Score: " + std::to_string(m_BestPoints));
m_Best.setPosition(m_Score.getGlobalBounds().width + m_Score.getCharacterSize(), 5);
if(m_Points == 50) {
Game.Game_createEnvironment("level_2");
}
}
void CScoreManager::reset() {
m_Points = 0;
this->update();
}
void CScoreManager::draw() {
Game.m_Window->draw(m_Score);
Game.m_Window->draw(m_Best);
}