v0.4.2a: fixed issues with tilemap culling

This commit is contained in:
Evan Debenham 2016-09-11 02:45:43 -04:00
parent 3e65ce6a1d
commit a8f98f2d83

View File

@ -227,10 +227,10 @@ public class Tilemap extends Visual {
camW = (int)Math.ceil(c.width/cellW); camW = (int)Math.ceil(c.width/cellW);
camH = (int)Math.ceil(c.height/cellH); camH = (int)Math.ceil(c.height/cellH);
if (camX > mapWidth if (camX >= mapWidth
|| camY > mapHeight || camY >= mapHeight
|| camW + camW < 0 || camW + camW <= 0
|| camH + camH < 0) || camH + camH <= 0)
return; return;
//determines the top-left visible tile, the bottom-right one, and the buffer length //determines the top-left visible tile, the bottom-right one, and the buffer length
@ -248,10 +248,10 @@ public class Tilemap extends Visual {
length = bufferPositions[bottomRight] - bufferPositions[topLeft] + 1; length = bufferPositions[bottomRight] - bufferPositions[topLeft] + 1;
} }
if (camX > mapWidth if (camX >= mapWidth
|| camY > mapHeight || camY >= mapHeight
|| camW + camW < 0 || camW + camW <= 0
|| camH + camH < 0) || camH + camH <= 0)
return; return;
NoosaScript script = NoosaScriptNoLighting.get(); NoosaScript script = NoosaScriptNoLighting.get();