summaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2012-02-29 03:50:47 +0300
committerAndrei Karas <akaras@inbox.ru>2012-02-29 03:50:47 +0300
commite60a9be8c43b2cf0352053366b64f788fdf17318 (patch)
tree22183f2f32295c2de7236a1d1c9acbc6069ce38c /src/gui
parenta73e3c92a07d9739df4a709e4b3694366199982b (diff)
downloadmanaverse-e60a9be8c43b2cf0352053366b64f788fdf17318.tar.gz
manaverse-e60a9be8c43b2cf0352053366b64f788fdf17318.tar.bz2
manaverse-e60a9be8c43b2cf0352053366b64f788fdf17318.tar.xz
manaverse-e60a9be8c43b2cf0352053366b64f788fdf17318.zip
Fix drawing big minimaps.
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/minimap.cpp18
1 files changed, 8 insertions, 10 deletions
diff --git a/src/gui/minimap.cpp b/src/gui/minimap.cpp
index 74da37341..5a1e66c25 100644
--- a/src/gui/minimap.cpp
+++ b/src/gui/minimap.cpp
@@ -229,13 +229,11 @@ void Minimap::draw(gcn::Graphics *graphics)
mMapImage->mBounds.h > a.height)
{
const Vector &p = player_node->getPosition();
- mMapOriginX = ((a.width) / 2) - static_cast<int>((p.x
- + viewport->getCameraRelativeX()) * static_cast<int>(
- mWidthProportion)) / 32;
+ mMapOriginX = ((a.width) / 2) - (static_cast<float>(p.x
+ + viewport->getCameraRelativeX()) * mWidthProportion) / 32;
- mMapOriginY = ((a.height) / 2) - static_cast<int>((p.y
- + viewport->getCameraRelativeX()) * static_cast<int>(
- mHeightProportion)) / 32;
+ mMapOriginY = ((a.height) / 2) - (static_cast<float>(p.y
+ + viewport->getCameraRelativeX()) * mHeightProportion) / 32;
const int minOriginX = a.width - mMapImage->mBounds.w;
const int minOriginY = a.height - mMapImage->mBounds.h;
@@ -314,9 +312,9 @@ void Minimap::draw(gcn::Graphics *graphics)
const Vector &pos = being->getPosition();
graphics->fillRectangle(gcn::Rectangle(
- static_cast<int>(pos.x * mWidthProportion) / 32
+ static_cast<float>(pos.x * mWidthProportion) / 32
+ mMapOriginX - offsetWidth,
- static_cast<int>(pos.y * mHeightProportion) / 32
+ static_cast<float>(pos.y * mHeightProportion) / 32
+ mMapOriginY - offsetHeight,
dotSize, dotSize));
}
@@ -367,10 +365,10 @@ void Minimap::draw(gcn::Graphics *graphics)
const Vector &pos = player_node->getPosition();
// logger->log("width:" + toString(graph->getWidth()));
- int x = static_cast<int>((pos.x - (graph->getWidth() / 2)
+ int x = static_cast<float>((pos.x - (graph->getWidth() / 2)
+ viewport->getCameraRelativeX())
* mWidthProportion) / 32 + mMapOriginX;
- int y = static_cast<int>((pos.y - (graph->getHeight() / 2)
+ int y = static_cast<float>((pos.y - (graph->getHeight() / 2)
+ viewport->getCameraRelativeY())
* mHeightProportion) / 32 + mMapOriginY;