summaryrefslogtreecommitdiff
path: root/src/gui/viewport.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/viewport.cpp
parent2babe1d6491f5231b0e97349ccb198b92bb90ba9 (diff)
downloadmanaplus-60add2c149c9c61bfbede5ae92cfe216927aca8a.tar.gz
manaplus-60add2c149c9c61bfbede5ae92cfe216927aca8a.tar.bz2
manaplus-60add2c149c9c61bfbede5ae92cfe216927aca8a.tar.xz
manaplus-60add2c149c9c61bfbede5ae92cfe216927aca8a.zip
Improve a bit draw speed in other controls.
Diffstat (limited to 'src/gui/viewport.cpp')
-rw-r--r--src/gui/viewport.cpp16
1 files changed, 11 insertions, 5 deletions
diff --git a/src/gui/viewport.cpp b/src/gui/viewport.cpp
index df5fe4353..ada563b8d 100644
--- a/src/gui/viewport.cpp
+++ b/src/gui/viewport.cpp
@@ -49,6 +49,8 @@
#include "resources/resourcemanager.h"
+#include <guichan/font.hpp>
+
#include "debug.h"
extern volatile int tick_time;
@@ -358,6 +360,8 @@ void Viewport::_drawPath(Graphics *const graphics, const Path &path,
{
graphics->setColor(color);
+ gcn::Font *const font = getFont();
+
#ifdef MANASERV_SUPPORT
if (Net::getNetworkType() != ServerInfo::MANASERV)
#endif
@@ -372,8 +376,9 @@ void Viewport::_drawPath(Graphics *const graphics, const Path &path,
graphics->fillRectangle(gcn::Rectangle(squareX, squareY, 8, 8));
if (mMap)
{
- graphics->drawText(toString(cnt),
- squareX + 4, squareY + 12, gcn::Graphics::CENTER);
+ const std::string str = toString(cnt);
+ font->drawString(graphics, str, squareX + 4
+ - font->getWidth(str) / 2, squareY + 12);
}
cnt ++;
}
@@ -391,9 +396,10 @@ void Viewport::_drawPath(Graphics *const graphics, const Path &path,
8, 8));
if (mMap)
{
- graphics->drawText(
- toString(mMap->getMetaTile(i->x / 32, i->y / 32)->Gcost),
- squareX + 4, squareY + 12, gcn::Graphics::CENTER);
+ const std::string str = toString(mMap->getMetaTile(
+ i->x / 32, i->y / 32)->Gcost);
+ font->drawString(graphics, str,
+ squareX + 4 - font->getWidth(text) / 2, squareY + 12);
}
}
}