summaryrefslogtreecommitdiff
path: root/src/gui/progressbar.cpp
diff options
context:
space:
mode:
authorBjørn Lindeijer <bjorn@lindeijer.nl>2009-01-25 21:30:47 +0100
committerIra Rice <irarice@gmail.com>2009-01-25 17:35:59 -0700
commit537d390ae65e9b8a2701c04baa22962f7db0f093 (patch)
tree10a14a57ca6d61e4660cf68c15ea68652d81bc41 /src/gui/progressbar.cpp
parentedd500dd27bb648840abfe1cecb0767d7b2ba3ae (diff)
downloadmana-client-537d390ae65e9b8a2701c04baa22962f7db0f093.tar.gz
mana-client-537d390ae65e9b8a2701c04baa22962f7db0f093.tar.bz2
mana-client-537d390ae65e9b8a2701c04baa22962f7db0f093.tar.xz
mana-client-537d390ae65e9b8a2701c04baa22962f7db0f093.zip
Made the labels on the progress bars more readable
Diffstat (limited to 'src/gui/progressbar.cpp')
-rw-r--r--src/gui/progressbar.cpp24
1 files changed, 22 insertions, 2 deletions
diff --git a/src/gui/progressbar.cpp b/src/gui/progressbar.cpp
index 5ce01b35..ecc0017d 100644
--- a/src/gui/progressbar.cpp
+++ b/src/gui/progressbar.cpp
@@ -19,6 +19,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
+#include "gui.h"
#include "progressbar.h"
#include "../graphics.h"
@@ -26,6 +27,8 @@
#include "../resources/image.h"
#include "../resources/resourcemanager.h"
+#include <guichan/font.hpp>
+
ImageRect ProgressBar::mBorder;
int ProgressBar::mInstances = 0;
@@ -94,13 +97,30 @@ void ProgressBar::draw(gcn::Graphics *graphics)
drawImageRect(0, 0, getWidth(), getHeight(), mBorder);
// The bar
- if (mProgress > 0)
- {
+ if (mProgress > 0) {
graphics->setColor(gcn::Color(mRed, mGreen, mBlue, 200));
graphics->fillRectangle(gcn::Rectangle(4, 4,
(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;
+
+ 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);
+ }
}
void ProgressBar::setProgress(float progress)