summaryrefslogtreecommitdiff
path: root/src/gui/widgets/window.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2012-12-27 14:42:15 +0300
committerAndrei Karas <akaras@inbox.ru>2012-12-27 23:15:05 +0300
commit60add2c149c9c61bfbede5ae92cfe216927aca8a (patch)
tree9ded097faa108eb07b9ca1c8ce4490882e238a44 /src/gui/widgets/window.cpp
parent2babe1d6491f5231b0e97349ccb198b92bb90ba9 (diff)
downloadplus-60add2c149c9c61bfbede5ae92cfe216927aca8a.tar.gz
plus-60add2c149c9c61bfbede5ae92cfe216927aca8a.tar.bz2
plus-60add2c149c9c61bfbede5ae92cfe216927aca8a.tar.xz
plus-60add2c149c9c61bfbede5ae92cfe216927aca8a.zip
Improve a bit draw speed in other controls.
Diffstat (limited to 'src/gui/widgets/window.cpp')
-rw-r--r--src/gui/widgets/window.cpp18
1 files changed, 16 insertions, 2 deletions
diff --git a/src/gui/widgets/window.cpp b/src/gui/widgets/window.cpp
index 52042f019..ffeac0cb1 100644
--- a/src/gui/widgets/window.cpp
+++ b/src/gui/widgets/window.cpp
@@ -36,6 +36,7 @@
#include <guichan/exception.hpp>
#include <guichan/focushandler.hpp>
+#include <guichan/font.hpp>
#include "debug.h"
@@ -267,8 +268,21 @@ void Window::draw(gcn::Graphics *graphics)
{
g->setColor(mForegroundColor);
g->setFont(mCaptionFont);
- g->drawText(getCaption(), mCaptionOffsetX, mCaptionOffsetY,
- static_cast<gcn::Graphics::Alignment>(mCaptionAlign));
+ int x;
+ switch (static_cast<gcn::Graphics::Alignment>(mCaptionAlign))
+ {
+ case Graphics::LEFT:
+ default:
+ x = mCaptionOffsetX;
+ break;
+ case Graphics::CENTER:
+ x = mCaptionOffsetX - mCaptionFont->getWidth(mCaption) / 2;
+ break;
+ case Graphics::RIGHT:
+ x = mCaptionOffsetX - mCaptionFont->getWidth(mCaption);
+ break;
+ }
+ mCaptionFont->drawString(g, mCaption, x, mCaptionOffsetY);
}
if (update)