diff options
author | Jared Adams <jaxad0127@gmail.com> | 2009-07-13 11:14:39 -0600 |
---|---|---|
committer | Jared Adams <jaxad0127@gmail.com> | 2009-07-13 11:14:39 -0600 |
commit | c0bfb778b38e0212d645c3c03d88969b8abf4423 (patch) | |
tree | b389fe5c4b904509b2ac996886887fa5d05ccb1e /src | |
parent | 05257eec9413ac954a50f94a69e2f44c1c3d340f (diff) | |
download | mana-c0bfb778b38e0212d645c3c03d88969b8abf4423.tar.gz mana-c0bfb778b38e0212d645c3c03d88969b8abf4423.tar.bz2 mana-c0bfb778b38e0212d645c3c03d88969b8abf4423.tar.xz mana-c0bfb778b38e0212d645c3c03d88969b8abf4423.zip |
Adjust skill displays
Experiience progress bars and increase buttons are now only visible if
they're applicable.
Diffstat (limited to 'src')
-rw-r--r-- | src/gui/skilldialog.cpp | 51 |
1 files changed, 42 insertions, 9 deletions
diff --git a/src/gui/skilldialog.cpp b/src/gui/skilldialog.cpp index fee40349..8ed6b097 100644 --- a/src/gui/skilldialog.cpp +++ b/src/gui/skilldialog.cpp @@ -287,9 +287,26 @@ void SkillEntry::widgetResized(const gcn::Event &event) { gcn::Rectangle size = getChildrenArea(); - mLevelLabel->setPosition(size.width - mLevelLabel->getWidth(), 0); - mProgress->setWidth(size.width - mIncrease->getWidth() - 39); - mIncrease->setPosition(getWidth() - mIncrease->getWidth() - 2, 13); + if (mProgress->isVisible() && mIncrease->isVisible()) + { + mLevelLabel->setPosition(size.width - mLevelLabel->getWidth() + - mIncrease->getWidth() - 4, 0); + mProgress->setWidth(size.width - mIncrease->getWidth() - 39); + mIncrease->setPosition(getWidth() - mIncrease->getWidth() - 2, 6); + } + else if (mProgress->isVisible()) + { + mLevelLabel->setPosition(size.width - mLevelLabel->getWidth(), 0); + mProgress->setWidth(size.width - 39); + } + else if (mIncrease->isVisible()) + { + mLevelLabel->setPosition(size.width - mLevelLabel->getWidth() + - mIncrease->getWidth() - 4, 0); + mIncrease->setPosition(getWidth() - mIncrease->getWidth() - 2, 6); + } + else + mLevelLabel->setPosition(size.width - mLevelLabel->getWidth(), 0); } void SkillEntry::update() @@ -321,14 +338,30 @@ void SkillEntry::update() std::string sExp (toString(exp.first) + " / " + toString(exp.second)); mLevelLabel->adjustSize(); - mProgress->setText(sExp); - // More intense red as exp grows - int color = 150 - (int)(150 * ((float) exp.first / exp.second)); - mProgress->setColor(244, color, color); - mProgress->setProgress((float) exp.first / exp.second); + if (exp.second) + { + mProgress->setVisible(true); + mProgress->setText(sExp); + + // More intense red as exp grows + int color = 150 - (int)(150 * ((float) exp.first / exp.second)); + mProgress->setColor(244, color, color); + mProgress->setProgress((float) exp.first / exp.second); + } + else + mProgress->setVisible(false); - mIncrease->setEnabled(mInfo->modifiable && player_node->getSkillPoints()); + if (mInfo->modifiable) + { + mIncrease->setVisible(true); + mIncrease->setEnabled(player_node->getSkillPoints()); + } + else + { + mIncrease->setVisible(false); + mIncrease->setEnabled(false); + } widgetResized(NULL); } |