diff options
author | Andrei Karas <akaras@inbox.ru> | 2012-12-26 21:00:43 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2012-12-27 23:15:04 +0300 |
commit | 58ddd6adb93ea973e7081bfdd4e87460a1b67cae (patch) | |
tree | 66c24878d835b89c3d4cd3b3f6e9efe3c51955be /src | |
parent | 0abab7e8e92329b0cd8ec23807a1d3102d8ec136 (diff) | |
download | manaverse-58ddd6adb93ea973e7081bfdd4e87460a1b67cae.tar.gz manaverse-58ddd6adb93ea973e7081bfdd4e87460a1b67cae.tar.bz2 manaverse-58ddd6adb93ea973e7081bfdd4e87460a1b67cae.tar.xz manaverse-58ddd6adb93ea973e7081bfdd4e87460a1b67cae.zip |
Use new outline draw method in progressbar.
Diffstat (limited to 'src')
-rw-r--r-- | src/gui/widgets/progressbar.cpp | 26 | ||||
-rw-r--r-- | src/gui/widgets/progressbar.h | 1 |
2 files changed, 14 insertions, 13 deletions
diff --git a/src/gui/widgets/progressbar.cpp b/src/gui/widgets/progressbar.cpp index f97572904..0bed7d5d6 100644 --- a/src/gui/widgets/progressbar.cpp +++ b/src/gui/widgets/progressbar.cpp @@ -25,7 +25,6 @@ #include "client.h" #include "configuration.h" #include "graphicsvertexes.h" -#include "textrenderer.h" #include "gui/gui.h" #include "gui/sdlfont.h" @@ -53,12 +52,14 @@ ProgressBar::ProgressBar(const Widget2 *const widget, float progress, mVertexes(new ImageCollection), mRedraw(true), mPadding(2), - mFillPadding(3) + mFillPadding(3), + mOutlineColor(getThemeColor(Theme::OUTLINE)) { // The progress value is directly set at load time: if (mProgress > 1.0f || mProgress < 0.0f) mProgress = 1.0f; + mForegroundColor = getThemeColor(Theme::PROGRESS_BAR); mColor = Theme::getProgressColor(color >= 0 ? color : 0, mProgress); mColorToGo = mColor; addWidgetListener(this); @@ -182,9 +183,6 @@ void ProgressBar::render(Graphics *graphics) if (!mSkin) return; - gcn::Font *const oldFont = graphics->getFont(); - const gcn::Color oldColor = graphics->getColor(); - if (openGLMode != 2) { if (mRedraw || graphics->getRedraw()) @@ -222,17 +220,19 @@ void ProgressBar::render(Graphics *graphics) // The label if (!mText.empty()) { + const gcn::Color oldColor = graphics->getColor(); + + gcn::Font *const font = gui->getFont(); const int textX = mDimension.width / 2; - const int textY = (mDimension.height - boldFont->getHeight()) / 2; + const int textY = (mDimension.height - font->getHeight()) / 2; - TextRenderer::renderText(graphics, mText, textX, textY, - gcn::Graphics::CENTER, - getThemeColor(Theme::PROGRESS_BAR), - gui->getFont(), true, false); - } + graphics->setColor(mForegroundColor); + graphics->setColor2(mOutlineColor); + font->drawString(graphics, mText, textX + - font->getWidth(mText) / 2, textY); - graphics->setFont(oldFont); - graphics->setColor(oldColor); + graphics->setColor(oldColor); + } } void ProgressBar::widgetResized(const gcn::Event &event A_UNUSED) diff --git a/src/gui/widgets/progressbar.h b/src/gui/widgets/progressbar.h index fe03ac7e1..f541ea3df 100644 --- a/src/gui/widgets/progressbar.h +++ b/src/gui/widgets/progressbar.h @@ -153,6 +153,7 @@ class ProgressBar final : public gcn::Widget, bool mRedraw; unsigned int mPadding; unsigned int mFillPadding; + gcn::Color mOutlineColor; static int mInstances; static float mAlpha; |