Fixup movePixels a little bit

Thanks to @dalkon for dis.
This commit is contained in:
Ahmed Samy 2013-12-12 16:21:22 +02:00
parent 57c432d3ea
commit c54015a60d
1 changed files with 12 additions and 33 deletions

View File

@ -566,43 +566,22 @@ Position MapView::getPosition(const Point& point, const Size& mapSize)
void MapView::move(int x, int y) void MapView::move(int x, int y)
{ {
if(m_moveOffset.x + x > 32) {
if(m_moveOffset.x + x > 64)
m_customCameraPosition.x += 2;
else
m_customCameraPosition.x += 1;
m_moveOffset.x = x;
requestVisibleTilesCacheUpdate();
} else if(m_moveOffset.x - x < -32) {
if(m_moveOffset.x - x < -64)
m_customCameraPosition.x -= 2;
else
m_customCameraPosition.x -= 1;
m_moveOffset.x = x;
requestVisibleTilesCacheUpdate();
} else
m_moveOffset.x += x; m_moveOffset.x += x;
if(m_moveOffset.y + y > 32) {
if(m_moveOffset.y + y > 64)
m_customCameraPosition.y += 2;
else
m_customCameraPosition.y += 1;
m_moveOffset.y = y;
requestVisibleTilesCacheUpdate();
} else if(m_moveOffset.y - y < -32) {
if(m_moveOffset.y - y < -64)
m_customCameraPosition.y -= 2;
else
m_customCameraPosition.y -= 1;
m_moveOffset.y = y;
requestVisibleTilesCacheUpdate();
} else
m_moveOffset.y += y; m_moveOffset.y += y;
int32_t tmp = m_moveOffset.x / 32;
if(tmp != 0) {
m_customCameraPosition.x += tmp;
m_moveOffset.x %= 32;
requestVisibleTilesCacheUpdate();
}
tmp = m_moveOffset.y / 32;
if(tmp != 0) {
m_customCameraPosition.y += tmp;
m_moveOffset.y %= 32;
requestVisibleTilesCacheUpdate();
}
} }
Rect MapView::calcFramebufferSource(const Size& destSize) Rect MapView::calcFramebufferSource(const Size& destSize)