summaryrefslogtreecommitdiff
path: root/src/gui/ministatus.cpp
diff options
context:
space:
mode:
authorJared Adams <jaxad0127@gmail.com>2009-07-24 14:19:21 -0600
committerJared Adams <jaxad0127@gmail.com>2009-07-24 14:19:21 -0600
commitea6f492198a03cffc3be47df000fa16dfc3b262f (patch)
tree01ba3216ecbfa0bf1520211a940d689a8874baba /src/gui/ministatus.cpp
parent6f9ca0023ce77eb74d199a3c2e04e7d2b9d07494 (diff)
downloadmana-ea6f492198a03cffc3be47df000fa16dfc3b262f.tar.gz
mana-ea6f492198a03cffc3be47df000fa16dfc3b262f.tar.bz2
mana-ea6f492198a03cffc3be47df000fa16dfc3b262f.tar.xz
mana-ea6f492198a03cffc3be47df000fa16dfc3b262f.zip
Remove an ifdef in StatusWindow and update MP more
Also make MiniStatus only update the bars when needed (called by StatusWindow).
Diffstat (limited to 'src/gui/ministatus.cpp')
-rw-r--r--src/gui/ministatus.cpp54
1 files changed, 31 insertions, 23 deletions
diff --git a/src/gui/ministatus.cpp b/src/gui/ministatus.cpp
index ab5560da..4cb0e1ac 100644
--- a/src/gui/ministatus.cpp
+++ b/src/gui/ministatus.cpp
@@ -33,6 +33,8 @@
#include "utils/stringutils.h"
+extern volatile int tick_time;
+
MiniStatusWindow::MiniStatusWindow():
Popup("MiniStatus")
{
@@ -75,13 +77,37 @@ void MiniStatusWindow::eraseIcon(int index)
mIcons.erase(mIcons.begin() + index);
}
-extern volatile int tick_time;
+void MiniStatusWindow::drawIcons(Graphics *graphics)
+{
+ // Draw icons
+ int icon_x = mXpBar->getX() + mXpBar->getWidth() + 4;
+ for (unsigned int i = 0; i < mIcons.size(); i++) {
+ if (mIcons[i]) {
+ mIcons[i]->draw(graphics, icon_x, 3);
+ icon_x += 2 + mIcons[i]->getWidth();
+ }
+ }
+}
+
+void MiniStatusWindow::update(int id)
+{
+ if (id == StatusWindow::HP)
+ {
+ StatusWindow::updateHPBar(mHpBar);
+ }
+ else if (id == StatusWindow::MP)
+ {
+ StatusWindow::updateMPBar(mMpBar);
+ }
+ else if (id == StatusWindow::EXP)
+ {
+ StatusWindow::updateXPBar(mXpBar);
+ }
+}
-void MiniStatusWindow::update()
+void MiniStatusWindow::logic()
{
- StatusWindow::updateHPBar(mHpBar);
- StatusWindow::updateMPBar(mMpBar);
- StatusWindow::updateXPBar(mXpBar);
+ Popup::logic();
// Displays the number of monsters to next lvl
// (disabled for now but interesting idea)
@@ -100,21 +126,3 @@ void MiniStatusWindow::update()
if (mIcons[i])
mIcons[i]->update(tick_time * 10);
}
-
-void MiniStatusWindow::draw(gcn::Graphics *graphics)
-{
- update();
- drawChildren(graphics);
-}
-
-void MiniStatusWindow::drawIcons(Graphics *graphics)
-{
- // Draw icons
- int icon_x = mXpBar->getX() + mXpBar->getWidth() + 4;
- for (unsigned int i = 0; i < mIcons.size(); i++) {
- if (mIcons[i]) {
- mIcons[i]->draw(graphics, icon_x, 3);
- icon_x += 2 + mIcons[i]->getWidth();
- }
- }
-}