From dbf402a235d142b44c1936c305f6b3f4c02890bc Mon Sep 17 00:00:00 2001 From: Majin Sniper Date: Thu, 19 Mar 2009 18:58:11 +0100 Subject: Port Progressbar to TextRenderer --- src/gui/progressbar.cpp | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) (limited to 'src/gui/progressbar.cpp') 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); } } -- cgit v1.2.3-70-g09d2