aboutsummaryrefslogtreecommitdiff
path: root/src/BarDisplay.cpp
diff options
context:
space:
mode:
authorSamu Laaksonen <laaksonen.sj@gmail.com>2012-09-28 22:36:58 +0300
committerSamu Laaksonen <laaksonen.sj@gmail.com>2012-09-28 22:36:58 +0300
commit1cf5a427a829b22abea7027b18a130a01da3ed6a (patch)
tree9076e816e052bb35e52890a13562844090312be5 /src/BarDisplay.cpp
parent685fe05def77b039221edf06c74af74915d536c5 (diff)
downloadprism-1cf5a427a829b22abea7027b18a130a01da3ed6a.tar.gz
prism-1cf5a427a829b22abea7027b18a130a01da3ed6a.zip
Rename commit
Renamed some files according the project name Added base directory structure for resources Changed more fitting parallax scrolled background to menus - added 3 new layers as resources Changed more cheerful buttons to menus Added base classes to build HUD later on Added one new test level that is size of 800*480 with tilesize of 32*32
Diffstat (limited to 'src/BarDisplay.cpp')
-rw-r--r--src/BarDisplay.cpp58
1 files changed, 58 insertions, 0 deletions
diff --git a/src/BarDisplay.cpp b/src/BarDisplay.cpp
new file mode 100644
index 0000000..edab1c9
--- /dev/null
+++ b/src/BarDisplay.cpp
@@ -0,0 +1,58 @@
+#include "BarDisplay.h"
+
+BarDisplay::BarDisplay(QGraphicsItem* parent) :
+ QGraphicsItem(parent)
+{
+ 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
+}
+
+QRectF BarDisplay::boundingRect() const
+{
+ return QRectF();
+}
+
+void BarDisplay::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
+{
+}