summaryrefslogtreecommitdiff
path: root/src
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
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')
-rw-r--r--src/gui/skill.cpp27
-rw-r--r--src/gui/skill.h6
-rw-r--r--src/localplayer.cpp28
3 files changed, 41 insertions, 20 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;
diff --git a/src/localplayer.cpp b/src/localplayer.cpp
index 7d734a2c..dbcb1d42 100644
--- a/src/localplayer.cpp
+++ b/src/localplayer.cpp
@@ -425,20 +425,20 @@ const struct LocalPlayer::SkillInfo& LocalPlayer::getSkillInfo(int skill)
{
static const SkillInfo skills[CHAR_SKILL_NB + 1] =
{
- { _("Unarmed"), "graphics/gui/unarmed.png" }, // CHAR_SKILL_WEAPON_NONE
- { _("Knife"), "graphics/gui/knife.png" }, // CHAR_SKILL_WEAPON_KNIFE
- { _("Sword"), "graphics/gui/sword.png" }, // CHAR_SKILL_WEAPON_SWORD
- { _("Polearm"), "graphics/gui/polearm.png" }, // CHAR_SKILL_WEAPON_POLEARM
- { _("Staff"), "graphics/gui/staff.png" }, // CHAR_SKILL_WEAPON_STAFF
- { _("Whip"), "graphics/gui/whip.png" }, // CHAR_SKILL_WEAPON_WHIP
- { _("Bow"), "graphics/gui/bow.png" }, // CHAR_SKILL_WEAPON_BOW
- { _("Shooting"), "graphics/gui/shooting.png" }, // CHAR_SKILL_WEAPON_SHOOTING
- { _("Mace"), "graphics/gui/mace.png" }, // CHAR_SKILL_WEAPON_MACE
- { _("Axe"), "graphics/gui/axe.png" }, // CHAR_SKILL_WEAPON_AXE
- { _("Thrown"), "graphics/gui/thrown.png" }, // CHAR_SKILL_WEAPON_THROWN
- { _("Magic"), "graphics/gui/magic.png " }, // CHAR_SKILL_MAGIC_IAMJUSTAPLACEHOLDER
- { _("Craft"), "graphics/gui/craft.png" }, // CHAR_SKILL_CRAFT_IAMJUSTAPLACEHOLDER
- { _("Unknown Skill"), "graphics/gui/unknown-item.png" }
+ { _("Unarmed"), "graphics/images/unarmed.png" }, // CHAR_SKILL_WEAPON_NONE
+ { _("Knife"), "graphics/images/knife.png" }, // CHAR_SKILL_WEAPON_KNIFE
+ { _("Sword"), "graphics/images/sword.png" }, // CHAR_SKILL_WEAPON_SWORD
+ { _("Polearm"), "graphics/images/polearm.png" }, // CHAR_SKILL_WEAPON_POLEARM
+ { _("Staff"), "graphics/images/staff.png" }, // CHAR_SKILL_WEAPON_STAFF
+ { _("Whip"), "graphics/images/whip.png" }, // CHAR_SKILL_WEAPON_WHIP
+ { _("Bow"), "graphics/images/bow.png" }, // CHAR_SKILL_WEAPON_BOW
+ { _("Shooting"), "graphics/images/shooting.png" }, // CHAR_SKILL_WEAPON_SHOOTING
+ { _("Mace"), "graphics/images/mace.png" }, // CHAR_SKILL_WEAPON_MACE
+ { _("Axe"), "graphics/images/axe.png" }, // CHAR_SKILL_WEAPON_AXE
+ { _("Thrown"), "graphics/images/thrown.png" }, // CHAR_SKILL_WEAPON_THROWN
+ { _("Magic"), "graphics/images/magic.png" }, // CHAR_SKILL_MAGIC_IAMJUSTAPLACEHOLDER
+ { _("Craft"), "graphics/images/craft.png" }, // CHAR_SKILL_CRAFT_IAMJUSTAPLACEHOLDER
+ { _("Unknown Skill"), "graphics/images/unknown.png" }
};
if ((skill < 0) || (skill > CHAR_SKILL_NB))