Tilemap: Fix map viewport calculation
Calculation was completely off as it didn't take into account the imposed viewport origin. All in all, similar fixes as the previous ones to TilemapVX.
This commit is contained in:
parent
dd7545fcf2
commit
30465691ae
3 changed files with 27 additions and 49 deletions
|
@ -186,9 +186,7 @@ struct TilemapVXPrivate : public ViewportElement, TileAtlasVX::Reader
|
|||
const Vec2i combOrigin = origin + sceneGeo.orig;
|
||||
const Vec2i geoSize = sceneGeo.rect.size();
|
||||
|
||||
/* Round the combined origin (which is in pixels) down to the nearest
|
||||
* top left tile boundary, by masking off the lower 5 bits (2^5 = 32) */
|
||||
newMvp.setPos((combOrigin & ~(32-1)) / 32);
|
||||
newMvp.setPos(getTilePos(combOrigin));
|
||||
|
||||
/* Ensure that the size is big enough to cover the whole viewport,
|
||||
* and add one tile row/column as a buffer for scrolling */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue