diff options
author | Majin Sniper <majinsniper@gmx.de> | 2009-03-19 18:58:11 +0100 |
---|---|---|
committer | Jared Adams <jaxad0127@gmail.com> | 2009-03-19 12:20:56 -0600 |
commit | dbf402a235d142b44c1936c305f6b3f4c02890bc (patch) | |
tree | 850988a6c0bc211bdca97788517d9dc384f0a983 /src/gui/progressbar.cpp | |
parent | 9d75e8647bd8ac0dc1fd0a6b96b8d68929eeed0e (diff) | |
download | mana-dbf402a235d142b44c1936c305f6b3f4c02890bc.tar.gz mana-dbf402a235d142b44c1936c305f6b3f4c02890bc.tar.bz2 mana-dbf402a235d142b44c1936c305f6b3f4c02890bc.tar.xz mana-dbf402a235d142b44c1936c305f6b3f4c02890bc.zip |
Port Progressbar to TextRenderer
Diffstat (limited to 'src/gui/progressbar.cpp')
-rw-r--r-- | src/gui/progressbar.cpp | 22 |
1 files changed, 8 insertions, 14 deletions
diff --git a/src/gui/progressbar.cpp b/src/gui/progressbar.cpp index 019bf371..f0acfecf 100644 --- a/src/gui/progressbar.cpp +++ b/src/gui/progressbar.cpp @@ -23,6 +23,7 @@ #include "gui.h" #include "progressbar.h" +#include "textrenderer.h" #include "../configuration.h" #include "../graphics.h" @@ -34,6 +35,8 @@ ImageRect ProgressBar::mBorder; int ProgressBar::mInstances = 0; float ProgressBar::mAlpha = config.getValue("guialpha", 0.8); +const gcn::Color ProgressBar::TEXT_COLOR = gcn::Color(255, 255, 255); + ProgressBar::ProgressBar(float progress, unsigned int width, unsigned int height, Uint8 red, Uint8 green, Uint8 blue): @@ -129,21 +132,12 @@ void ProgressBar::draw(gcn::Graphics *graphics) if (!mText.empty()) { gcn::Font *f = boldFont; - 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); + int textX = getWidth() / 2; + int textY = (getHeight() - f->getHeight()) / 2; - graphics->setColor(gcn::Color(0, 0, 0)); + TextRenderer::renderText(graphics, mText, textX, textY, + gcn::Graphics::CENTER, &TEXT_COLOR, f, true, + false); } } |