summaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/progressbar.cpp22
-rw-r--r--src/gui/progressbar.h2
2 files changed, 10 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);
}
}
diff --git a/src/gui/progressbar.h b/src/gui/progressbar.h
index 5526589c..aa36e02b 100644
--- a/src/gui/progressbar.h
+++ b/src/gui/progressbar.h
@@ -112,6 +112,8 @@ class ProgressBar : public gcn::Widget
static ImageRect mBorder;
static int mInstances;
static float mAlpha;
+
+ static const gcn::Color TEXT_COLOR;
};
#endif