diff options
author | Bjørn Lindeijer <bjorn@lindeijer.nl> | 2009-01-25 21:30:47 +0100 |
---|---|---|
committer | Bjørn Lindeijer <bjorn@lindeijer.nl> | 2009-01-25 21:30:47 +0100 |
commit | 65da3d5cd5c8cf40abc1e6d31b04eada615fe307 (patch) | |
tree | 70d570f181fddc5cddb7934b4735d2729ca44e11 /src/gui/progressbar.cpp | |
parent | 1610ed4b3bc9ea3328087818da0af3f5852d1ff5 (diff) | |
download | mana-client-65da3d5cd5c8cf40abc1e6d31b04eada615fe307.tar.gz mana-client-65da3d5cd5c8cf40abc1e6d31b04eada615fe307.tar.bz2 mana-client-65da3d5cd5c8cf40abc1e6d31b04eada615fe307.tar.xz mana-client-65da3d5cd5c8cf40abc1e6d31b04eada615fe307.zip |
Made the labels on the progress bars more readable
Diffstat (limited to 'src/gui/progressbar.cpp')
-rw-r--r-- | src/gui/progressbar.cpp | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/src/gui/progressbar.cpp b/src/gui/progressbar.cpp index 5ce01b35..d877bfbc 100644 --- a/src/gui/progressbar.cpp +++ b/src/gui/progressbar.cpp @@ -26,6 +26,8 @@ #include "../resources/image.h" #include "../resources/resourcemanager.h" +#include <guichan/font.hpp> + ImageRect ProgressBar::mBorder; int ProgressBar::mInstances = 0; @@ -94,13 +96,30 @@ void ProgressBar::draw(gcn::Graphics *graphics) drawImageRect(0, 0, getWidth(), getHeight(), mBorder); // The bar - if (mProgress > 0) - { + if (mProgress > 0) { graphics->setColor(gcn::Color(mRed, mGreen, mBlue, 200)); graphics->fillRectangle(gcn::Rectangle(4, 4, (int) (mProgress * (getWidth() - 8)), getHeight() - 8)); } + + // The label + if (!mText.empty()) { + gcn::Font *f = getFont(); + const int textX = getWidth() / 2; + const int textY = (getHeight() - f->getHeight()) / 2; + + graphics->setFont(f); + + graphics->setColor(gcn::Color(0, 0, 0)); + graphics->drawText(mText, textX + 1, textY, gcn::Graphics::CENTER); + graphics->drawText(mText, textX, textY - 1, gcn::Graphics::CENTER); + graphics->drawText(mText, textX, textY + 1, gcn::Graphics::CENTER); + graphics->drawText(mText, textX - 1, textY, gcn::Graphics::CENTER); + + graphics->setColor(gcn::Color(255, 255, 255)); + graphics->drawText(mText, textX, textY, gcn::Graphics::CENTER); + } } void ProgressBar::setProgress(float progress) |