-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathHUDModel.cpp
More file actions
56 lines (36 loc) · 706 Bytes
/
HUDModel.cpp
File metadata and controls
56 lines (36 loc) · 706 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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#include "HUDModel.h"
#include <iostream>
HUDModel HUDModel::s_xInstance;
HUDModel::HUDModel() {
m_iScore = 0;
m_fHPFactor = 1.0f;
}
HUDModel* HUDModel::instance() {
return &s_xInstance;
}
void HUDModel::reset() {
m_iScore = 0;
m_fHPFactor = 1.0f;
sendUpdate();
}
void HUDModel::incrementScore() {
setScore(m_iScore + 1);
}
void HUDModel::setScore(unsigned int score) {
m_iScore = score;
sendUpdate();
}
unsigned int HUDModel::getScore() {
return m_iScore;
}
void HUDModel::setHPFactor(float factor) {
m_fHPFactor = factor;
sendUpdate();
}
float HUDModel::getHPFactor() {
return m_fHPFactor;
}
void HUDModel::sendUpdate() {
Event e(Event::HUD_UPDATE);
dispatchEvent(e);
}