From bc6d79b088154e2fca56b9c18ee5ea0bf17875f8 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Fri, 26 Oct 2018 21:59:46 +0200 Subject: model: add mutable MapState (empty for now) --- src/model/MapData.ts | 25 ------------------------- src/model/data/MapData.ts | 25 +++++++++++++++++++++++++ src/model/state/MapState.ts | 6 ++++++ 3 files changed, 31 insertions(+), 25 deletions(-) delete mode 100644 src/model/MapData.ts create mode 100644 src/model/data/MapData.ts create mode 100644 src/model/state/MapState.ts (limited to 'src/model') diff --git a/src/model/MapData.ts b/src/model/MapData.ts deleted file mode 100644 index c8db35c..0000000 --- a/src/model/MapData.ts +++ /dev/null @@ -1,25 +0,0 @@ -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; - 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; - } -} 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; + 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; + } +} diff --git a/src/model/state/MapState.ts b/src/model/state/MapState.ts new file mode 100644 index 0000000..2931dfb --- /dev/null +++ b/src/model/state/MapState.ts @@ -0,0 +1,6 @@ +import MapData from '../data/MapData'; + +export default class MapState { + public constructor(public readonly data: MapData) { + } +} -- cgit v1.2.3