summaryrefslogtreecommitdiff
path: root/src/gui/ministatus.cpp
diff options
context:
space:
mode:
authorFate <fate-tmw@googlemail.com>2008-12-07 04:00:55 -0700
committerFate <fate-tmw@googlemail.com>2008-12-07 04:00:55 -0700
commit3fcd6a549fc825f4185a6dc248922e02988caed5 (patch)
tree2def3534088760ec3d06860eb0af936ec1e66b5b /src/gui/ministatus.cpp
parent68923d079602d8a8b7f35e1b56032e03e323ea09 (diff)
downloadmana-3fcd6a549fc825f4185a6dc248922e02988caed5.tar.gz
mana-3fcd6a549fc825f4185a6dc248922e02988caed5.tar.bz2
mana-3fcd6a549fc825f4185a6dc248922e02988caed5.tar.xz
mana-3fcd6a549fc825f4185a6dc248922e02988caed5.zip
Added client-side status change handlers (text, icon, particle effect, audio).
Diffstat (limited to 'src/gui/ministatus.cpp')
-rw-r--r--src/gui/ministatus.cpp41
1 files changed, 39 insertions, 2 deletions
diff --git a/src/gui/ministatus.cpp b/src/gui/ministatus.cpp
index baae14a7..436c90cd 100644
--- a/src/gui/ministatus.cpp
+++ b/src/gui/ministatus.cpp
@@ -79,6 +79,26 @@ MiniStatusWindow::MiniStatusWindow():
loadWindowState();
}
+void
+MiniStatusWindow::setIcon(int index, AnimatedSprite *sprite)
+{
+ if (index >= (int) mIcons.size())
+ mIcons.resize(index + 1, NULL);
+
+ if (mIcons[index])
+ delete mIcons[index];
+
+ mIcons[index] = sprite;
+}
+
+void
+MiniStatusWindow::eraseIcon(int index)
+{
+ mIcons.erase(mIcons.begin() + index);
+}
+
+extern volatile int tick_time;
+
void MiniStatusWindow::update()
{
// HP Bar coloration
@@ -128,10 +148,27 @@ void MiniStatusWindow::update()
*/
mXpLabel->setCaption(updatedText.str());
+
+ for (unsigned int i = 0; i < mIcons.size(); i++)
+ if (mIcons[i])
+ mIcons[i]->update(tick_time * 10);
+
}
-void MiniStatusWindow::draw(gcn::Graphics *graphics)
+void MiniStatusWindow::draw(gcn::Graphics *gcn_graphics)
{
update();
- drawChildren(graphics);
+ drawChildren(gcn_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();
+ }
}