summaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
authorPhilipp Sehmisch <crush@themanaworld.org>2009-07-03 22:17:18 +0200
committerPhilipp Sehmisch <crush@themanaworld.org>2009-07-03 22:28:02 +0200
commit346d68307553c18777df4c49f9b3fe57955c5c0d (patch)
treed27d3fff4f5a366f597ae83d3fb62e2dbd4d69bf /src/gui
parente0de8a124bf94b79d9d64e5406b21e8598a05d56 (diff)
downloadmana-346d68307553c18777df4c49f9b3fe57955c5c0d.tar.gz
mana-346d68307553c18777df4c49f9b3fe57955c5c0d.tar.bz2
mana-346d68307553c18777df4c49f9b3fe57955c5c0d.tar.xz
mana-346d68307553c18777df4c49f9b3fe57955c5c0d.zip
Implemented display of spell recharge information from server in the magic gui (very, very hackish)
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/magic.cpp39
-rw-r--r--src/gui/magic.h13
2 files changed, 42 insertions, 10 deletions
diff --git a/src/gui/magic.cpp b/src/gui/magic.cpp
index 0906566b..c47faa18 100644
--- a/src/gui/magic.cpp
+++ b/src/gui/magic.cpp
@@ -36,17 +36,19 @@ MagicDialog::MagicDialog():
setSaveVisible(true);
setDefaultSize(255, 30, 175, 225);
- gcn::Button *spellButton1 = new Button(_("Cast Test Spell 1"), "spell_1", this);
- gcn::Button *spellButton2 = new Button(_("Cast Test Spell 2"), "spell_2", this);
- gcn::Button *spellButton3 = new Button(_("Cast Test Spell 3"), "spell_3", this);
+ mSpellButtons.resize(4);
- spellButton1->setPosition(10, 30);
- spellButton2->setPosition(10, 60);
- spellButton3->setPosition(10, 90);
+ mSpellButtons[1] = new Button(_("Spell 1"), "spell_1", this);
+ mSpellButtons[2] = new Button(_("Spell 2"), "spell_2", this);
+ mSpellButtons[3] = new Button(_("Spell 3"), "spell_3", this);
- add(spellButton1);
- add(spellButton2);
- add(spellButton3);
+ mSpellButtons[1]->setPosition(10, 60);
+ mSpellButtons[2]->setPosition(10, 90);
+ mSpellButtons[3]->setPosition(10, 120);
+
+ add(mSpellButtons[1]);
+ add(mSpellButtons[2]);
+ add(mSpellButtons[3]);
update();
@@ -87,4 +89,23 @@ void MagicDialog::draw(gcn::Graphics *g)
void MagicDialog::update()
{
+ std::map<int, Special> specials = player_node->getSpecialStatus();
+
+ for (size_t i = 1; i < mSpellButtons.size(); i++)
+ {
+ if (specials.find(i) != specials.end())
+ {
+ std::stringstream s;
+ s <<
+ "Spell" <<
+ i <<
+ " (" <<
+ specials[i].currentMana <<
+ "/" <<
+ specials[i].neededMana <<
+ ")";
+ mSpellButtons[i]->setCaption(s.str());
+ mSpellButtons[i]->adjustSize();
+ }
+ }
}
diff --git a/src/gui/magic.h b/src/gui/magic.h
index 734ad799..44a1a6fc 100644
--- a/src/gui/magic.h
+++ b/src/gui/magic.h
@@ -22,6 +22,8 @@
#ifndef MAGIC_H
#define MAGIC_H
+#include <vector>
+
#include "gui/widgets/window.h"
#include "guichanfwd.h"
@@ -29,7 +31,13 @@
#include <guichan/actionlistener.hpp>
/**
- * The skill dialog.
+ * The magic interface.
+ *
+ * This window is hacked together quickly to test the spell
+ * recharge netcode.
+ * It does in no way represent how the interface is going to
+ * look in the final version. Optimization / cleanup is
+ * pointless, as it will be redesigned from scratch.
*
* \ingroup Interface
*/
@@ -54,6 +62,9 @@ class MagicDialog : public Window, public gcn::ActionListener
* Draw this window.
*/
void draw(gcn::Graphics *g);
+
+ private:
+ std::vector<gcn::Button *> mSpellButtons;
};
extern MagicDialog *magicDialog;