blob: db6136d40c51bc172bed62cd04c0afa79d5c9f36 (
plain)
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
|
#include "BarDisplay.h"
BarDisplay::BarDisplay() :
QPixmap()
{
m_partCount = 4;
m_maxValue = 50;
m_value = 50;
/* TODO:
initialize this item with some kind of rectangle graphics
that supports partitioning, e.g.
[ / / ] or such
*/
}
BarDisplay::~BarDisplay()
{
}
void BarDisplay::collected(int amount)
{
m_value += amount;
if (m_value > m_maxValue)
m_value = m_maxValue;
updateDisplay();
}
void BarDisplay::consumed(int amount)
{
m_value -= amount;
if (m_value < 0)
m_value = 0;
updateDisplay();
}
void BarDisplay::setDisplayColor(QColor col)
{
m_displayColor = col;
}
void BarDisplay::updateDisplay()
{
// TODO: update graphics so user knows he is hit
}
|