summaryrefslogtreecommitdiffstats
path: root/src/model/data
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2018-10-26 21:59:46 +0200
committerMatthias Schiffer <mschiffer@universe-factory.net>2018-10-26 21:59:46 +0200
commitbc6d79b088154e2fca56b9c18ee5ea0bf17875f8 (patch)
tree680f5b4ea26a874fa4f52f178681ef234688480f /src/model/data
parentebc56db63c054702ad910987aa666d7cfb52d5cc (diff)
downloadrpgedit-bc6d79b088154e2fca56b9c18ee5ea0bf17875f8.tar
rpgedit-bc6d79b088154e2fca56b9c18ee5ea0bf17875f8.zip
model: add mutable MapState (empty for now)
Diffstat (limited to 'src/model/data')
-rw-r--r--src/model/data/MapData.ts25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/model/data/MapData.ts b/src/model/data/MapData.ts
new file mode 100644
index 0000000..0f14f50
--- /dev/null
+++ b/src/model/data/MapData.ts
@@ -0,0 +1,25 @@
+import {mapFromObject} from '../../util';
+
+interface Input {
+ readonly tiles: {[key: string]: string};
+ readonly collision: string[];
+ readonly layers: string[][][];
+}
+
+export default class MapData {
+ public readonly tiles: Map<string, string>;
+ public readonly collision: string[];
+ public readonly layers: string[][][];
+
+ public readonly width: number;
+ public readonly height: number;
+
+ constructor(data: Input) {
+ this.tiles = mapFromObject(data.tiles);
+ this.collision = data.collision;
+ this.layers = data.layers;
+
+ this.height = this.collision.length;
+ this.width = this.collision[0].length;
+ }
+}