summaryrefslogtreecommitdiff
path: root/src/gui/progressbar.cpp
diff options
context:
space:
mode:
authorMajin Sniper <majinsniper@gmx.de>2009-03-19 18:58:11 +0100
committerIra Rice <irarice@gmail.com>2009-03-19 13:12:43 -0600
commit0221ab5dc5236e9e35fe6c832a52020551dafa85 (patch)
treeb46a255479924b90fbd9e48ea23baf49e47d22ef /src/gui/progressbar.cpp
parent6f0d88e781c8b1a75858c769b3641aa8cd477314 (diff)
downloadmana-0221ab5dc5236e9e35fe6c832a52020551dafa85.tar.gz
mana-0221ab5dc5236e9e35fe6c832a52020551dafa85.tar.bz2
mana-0221ab5dc5236e9e35fe6c832a52020551dafa85.tar.xz
mana-0221ab5dc5236e9e35fe6c832a52020551dafa85.zip
Port Progressbar to TextRenderer
Diffstat (limited to 'src/gui/progressbar.cpp')
-rw-r--r--src/gui/progressbar.cpp31
1 files changed, 8 insertions, 23 deletions
diff --git a/src/gui/progressbar.cpp b/src/gui/progressbar.cpp
index 025e0ec5..1f21df79 100644
--- a/src/gui/progressbar.cpp
+++ b/src/gui/progressbar.cpp
@@ -25,6 +25,7 @@
#include "gui.h"
#include "palette.h"
#include "progressbar.h"
+#include "textrenderer.h"
#include "../configuration.h"
#include "../graphics.h"
@@ -120,38 +121,22 @@ void ProgressBar::draw(gcn::Graphics *graphics)
// The bar
if (mProgress > 0)
{
-
graphics->setColor(gcn::Color(mRed, mGreen, mBlue, alpha));
graphics->fillRectangle(gcn::Rectangle(4, 4,
- (int) (mProgress * (getWidth() - 8)),
- getHeight() - 8));
+ (int) (mProgress * (getWidth() - 8)),
+ getHeight() - 8));
}
// The label
if (!mText.empty())
{
- gcn::Font *f = boldFont;
const int textX = getWidth() / 2;
- const int textY = (getHeight() - f->getHeight()) / 2;
-
- gcn::Color tempColor = guiPalette->getColor(Palette::OUTLINE);
-
- graphics->setFont(f);
-
- graphics->setColor(gcn::Color((int) tempColor.r, (int) tempColor.g,
- (int) tempColor.b, alpha));
- 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);
-
- tempColor = guiPalette->getColor(Palette::PROGRESS_BAR);
-
- graphics->setColor(gcn::Color((int) tempColor.r, (int) tempColor.g,
- (int) tempColor.b, alpha));
- graphics->drawText(mText, textX, textY, gcn::Graphics::CENTER);
+ const int textY = (getHeight() - boldFont->getHeight()) / 2;
- graphics->setColor(guiPalette->getColor(Palette::TEXT));
+ TextRenderer::renderText(graphics, mText, textX, textY,
+ gcn::Graphics::CENTER,
+ guiPalette->getColor(Palette::PROGRESS_BAR,
+ alpha), boldFont, true, false);
}
}