summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMajin Sniper <majinsniper@gmx.de>2009-03-19 18:58:11 +0100
committerJared Adams <jaxad0127@gmail.com>2009-03-19 12:20:56 -0600
commitdbf402a235d142b44c1936c305f6b3f4c02890bc (patch)
tree850988a6c0bc211bdca97788517d9dc384f0a983 /src
parent9d75e8647bd8ac0dc1fd0a6b96b8d68929eeed0e (diff)
downloadmana-dbf402a235d142b44c1936c305f6b3f4c02890bc.tar.gz
mana-dbf402a235d142b44c1936c305f6b3f4c02890bc.tar.bz2
mana-dbf402a235d142b44c1936c305f6b3f4c02890bc.tar.xz
mana-dbf402a235d142b44c1936c305f6b3f4c02890bc.zip
Port Progressbar to TextRenderer
Diffstat (limited to 'src')
-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