diff options
author | Andrei Karas <akaras@inbox.ru> | 2012-12-27 14:42:15 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2012-12-27 23:15:05 +0300 |
commit | 60add2c149c9c61bfbede5ae92cfe216927aca8a (patch) | |
tree | 9ded097faa108eb07b9ca1c8ce4490882e238a44 /src/gui/viewport.cpp | |
parent | 2babe1d6491f5231b0e97349ccb198b92bb90ba9 (diff) | |
download | mv-60add2c149c9c61bfbede5ae92cfe216927aca8a.tar.gz mv-60add2c149c9c61bfbede5ae92cfe216927aca8a.tar.bz2 mv-60add2c149c9c61bfbede5ae92cfe216927aca8a.tar.xz mv-60add2c149c9c61bfbede5ae92cfe216927aca8a.zip |
Improve a bit draw speed in other controls.
Diffstat (limited to 'src/gui/viewport.cpp')
-rw-r--r-- | src/gui/viewport.cpp | 16 |
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); } } } |