summaryrefslogtreecommitdiffstats
path: root/src/view
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2018-10-31 00:18:29 +0100
committerMatthias Schiffer <mschiffer@universe-factory.net>2018-10-31 00:27:34 +0100
commit70a616b4a7a4a07b3bb41f0b906ad81ef93f96dc (patch)
treecfdbc6b61277a3c6b76702a250b17368c26746be /src/view
parent63c8b70e43b5123ee3afbd60aaa16305d7198c1d (diff)
downloadrpgedit-70a616b4a7a4a07b3bb41f0b906ad81ef93f96dc.tar
rpgedit-70a616b4a7a4a07b3bb41f0b906ad81ef93f96dc.zip
view/MapView: add support for multiple layers and holes
Diffstat (limited to 'src/view')
-rw-r--r--src/view/MapView.ts6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/view/MapView.ts b/src/view/MapView.ts
index 5c30f20..f6736e2 100644
--- a/src/view/MapView.ts
+++ b/src/view/MapView.ts
@@ -20,7 +20,8 @@ export default class MapView {
for (let x = 0; x < map.data.width; x++)
for (let y = 0; y < map.data.height; y++)
- this.addTile(vertexData, textureData, x, y, map.data.layers[0][y][x]);
+ for (const layer of map.data.layers)
+ this.addTile(vertexData, textureData, x, y, layer[y][x]);
const gl = r.getContext();
@@ -64,6 +65,9 @@ export default class MapView {
}
private addTile(vertexData: number[], textureData: number[], x: number, y: number, tile: string) {
+ if (tile === ' ')
+ return;
+
const tilePos = this.tileMap.tiles.get(tile);
if (!tilePos)
throw new Error('invalid tile specifier in map data');