summaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
authorRoderic Morris <roderic@ccs.neu.edu>2008-06-27 15:31:13 +0000
committerRoderic Morris <roderic@ccs.neu.edu>2008-06-27 15:31:13 +0000
commit59c17d5f465ddcf1956e8cdf1aae1dbda0a1431f (patch)
tree3ce2242579a30fc7d453bfc8fa16c1b8142ad80a /src/gui
parenta34a4692200eaf5b3ec8a7de75699a46aefd8b98 (diff)
downloadmana-59c17d5f465ddcf1956e8cdf1aae1dbda0a1431f.tar.gz
mana-59c17d5f465ddcf1956e8cdf1aae1dbda0a1431f.tar.bz2
mana-59c17d5f465ddcf1956e8cdf1aae1dbda0a1431f.tar.xz
mana-59c17d5f465ddcf1956e8cdf1aae1dbda0a1431f.zip
add icons to the skill dialog
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/skill.cpp27
-rw-r--r--src/gui/skill.h6
2 files changed, 27 insertions, 6 deletions
diff --git a/src/gui/skill.cpp b/src/gui/skill.cpp
index 0a3c244a..8c7d6f29 100644
--- a/src/gui/skill.cpp
+++ b/src/gui/skill.cpp
@@ -25,6 +25,7 @@
#include <guichan/widgets/label.hpp>
#include <guichan/widgets/container.hpp>
+#include <guichan/widgets/icon.hpp>
#include "skill.h"
@@ -46,10 +47,10 @@ SkillDialog::SkillDialog():
Window(_("Skills"))
{
setCloseButton(true);
- setDefaultSize(windowContainer->getWidth() - 255, 25, 230, 425);
+ setDefaultSize(windowContainer->getWidth() - 255, 25, 275, 425);
TabbedArea *panel = new TabbedArea();
- panel->setDimension(gcn::Rectangle(5, 5, 225, 420));
+ panel->setDimension(gcn::Rectangle(5, 5, 270, 420));
Skill_Tab* tab;
@@ -105,9 +106,10 @@ void SkillDialog::update()
Skill_Tab::Skill_Tab(std::string type): type(type)
{
setOpaque(false);
- setDimension(gcn::Rectangle(0, 0, 225, 420));
+ setDimension(gcn::Rectangle(0, 0, 270, 420));
int skillNum = getSkillNum();
+ mSkillIcons.resize(skillNum);
mSkillNameLabels.resize(skillNum);
mSkillLevelLabels.resize(skillNum);
mSkillExpLabels.resize(skillNum);
@@ -116,16 +118,20 @@ Skill_Tab::Skill_Tab(std::string type): type(type)
// Set the initial positions of the skill information
for (int a=0; a < skillNum; a++)
{
+ mSkillIcons.at(a) = getIcon(a);
+ mSkillIcons.at(a)->setPosition(1, a*32);
+ add(mSkillIcons.at(a));
+
mSkillNameLabels.at(a) = new gcn::Label("");
- mSkillNameLabels.at(a)->setPosition(1, a*32 );
+ mSkillNameLabels.at(a)->setPosition(35, a*32 );
add(mSkillNameLabels.at(a));
mSkillProgress.at(a) = new ProgressBar(0.0f, 200, 20, 150, 150, 150);
- mSkillProgress.at(a)->setPosition(1, a*32 + 13);
+ mSkillProgress.at(a)->setPosition(35, a*32 + 13);
add(mSkillProgress.at(a));
mSkillExpLabels.at(a) = new gcn::Label("");
- mSkillExpLabels.at(a)->setPosition(10, a*32 + 16);
+ mSkillExpLabels.at(a)->setPosition(45, a*32 + 16);
add(mSkillExpLabels.at(a));
mSkillLevelLabels.at(a) = new gcn::Label("");
@@ -181,6 +187,13 @@ int Skill_Tab::getSkillBegin()
else return skillBegin;
}
+gcn::Icon* Skill_Tab::getIcon(int index)
+{
+ int skillBegin = getSkillBegin();
+ std::string icon = LocalPlayer::getSkillInfo(index + skillBegin).icon;
+ return new gcn::Icon(icon);
+}
+
void Skill_Tab::updateSkill(int index)
{
int skillBegin = getSkillBegin();
@@ -198,6 +211,7 @@ void Skill_Tab::updateSkill(int index)
mSkillExpLabels.at(index)->setVisible(false);
mSkillLevelLabels.at(index)->setVisible(false);
mSkillNameLabels.at(index)->setVisible(false);
+ mSkillIcons.at(index)->setVisible(false);
}
else
{
@@ -205,6 +219,7 @@ void Skill_Tab::updateSkill(int index)
mSkillExpLabels.at(index)->setVisible(true);
mSkillLevelLabels.at(index)->setVisible(true);
mSkillNameLabels.at(index)->setVisible(true);
+ mSkillIcons.at(index)->setVisible(true);
std::string skillLevel("Lvl: " + toString(baseLevel));
if (effLevel < baseLevel)
{
diff --git a/src/gui/skill.h b/src/gui/skill.h
index 99011e75..b3a9e126 100644
--- a/src/gui/skill.h
+++ b/src/gui/skill.h
@@ -79,6 +79,12 @@ class Skill_Tab : public GCContainer, public gcn::ActionListener
*/
int getSkillBegin();
+ /**
+ * Get the icon associated with the given index
+ */
+ gcn::Icon* getIcon(int index);
+
+ std::vector<gcn::Icon *> mSkillIcons;
std::vector<gcn::Label *> mSkillNameLabels;
std::vector<gcn::Label *> mSkillLevelLabels;
std::vector<gcn::Label *> mSkillExpLabels;