summaryrefslogtreecommitdiffstats
path: root/src/model
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2016-01-06 17:10:19 +0100
committerMatthias Schiffer <mschiffer@universe-factory.net>2016-01-06 17:27:45 +0100
commitc64ead08a36fccc36a42b3e74362aa423cfb62ed (patch)
tree5ada42f825b4ed0431f5c0426ab226aa0e7c2512 /src/model
parent4fa246628bd9e5911ae998162f0bdc724cc739d2 (diff)
downloadrpgedit-c64ead08a36fccc36a42b3e74362aa423cfb62ed.tar
rpgedit-c64ead08a36fccc36a42b3e74362aa423cfb62ed.zip
Replace all CoffeeScript code by TypeScript
Diffstat (limited to 'src/model')
-rw-r--r--src/model/Direction.coffee13
-rw-r--r--src/model/Direction.ts13
-rw-r--r--src/model/Entity.coffee8
-rw-r--r--src/model/Entity.ts6
-rw-r--r--src/model/EntityPosition.coffee8
-rw-r--r--src/model/EntityPosition.ts11
-rw-r--r--src/model/MapData.coffee9
-rw-r--r--src/model/MapData.ts20
-rw-r--r--src/model/Position.coffee10
-rw-r--r--src/model/Position.ts10
10 files changed, 60 insertions, 48 deletions
diff --git a/src/model/Direction.coffee b/src/model/Direction.coffee
deleted file mode 100644
index 5c49c80..0000000
--- a/src/model/Direction.coffee
+++ /dev/null
@@ -1,13 +0,0 @@
-'use strict'
-
-
-Direction =
- NORTH: 0
- EAST: 1
- SOUTH: 2
- WEST: 3
-
- reverse: (d) -> (d+2)%4
-
-
-module.exports = Direction
diff --git a/src/model/Direction.ts b/src/model/Direction.ts
new file mode 100644
index 0000000..a0cf45d
--- /dev/null
+++ b/src/model/Direction.ts
@@ -0,0 +1,13 @@
+'use strict';
+
+
+export enum Direction {
+ North,
+ East,
+ South,
+ West
+};
+
+export function reverse(r: Direction): Direction { return (r+2) % 4; }
+
+export default Direction;
diff --git a/src/model/Entity.coffee b/src/model/Entity.coffee
deleted file mode 100644
index 70c81fa..0000000
--- a/src/model/Entity.coffee
+++ /dev/null
@@ -1,8 +0,0 @@
-'use strict'
-
-
-class Entity
- constructor: (@name) ->
-
-
-module.exports = Entity
diff --git a/src/model/Entity.ts b/src/model/Entity.ts
new file mode 100644
index 0000000..b9a52eb
--- /dev/null
+++ b/src/model/Entity.ts
@@ -0,0 +1,6 @@
+'use strict';
+
+
+export default class Entity {
+ constructor(public name: string) {}
+}
diff --git a/src/model/EntityPosition.coffee b/src/model/EntityPosition.coffee
deleted file mode 100644
index aaf9531..0000000
--- a/src/model/EntityPosition.coffee
+++ /dev/null
@@ -1,8 +0,0 @@
-'use strict'
-
-
-class EntityPosition
- constructor: (@entity, @position, @direction) ->
-
-
-module.exports = EntityPosition
diff --git a/src/model/EntityPosition.ts b/src/model/EntityPosition.ts
new file mode 100644
index 0000000..815eceb
--- /dev/null
+++ b/src/model/EntityPosition.ts
@@ -0,0 +1,11 @@
+'use strict';
+
+
+import Direction from '../model/Direction';
+import Entity from './Entity';
+import Position from './Position';
+
+
+export default class EntityPosition {
+ constructor(public entity: Entity, public position: Position, public direction: Direction) {}
+}
diff --git a/src/model/MapData.coffee b/src/model/MapData.coffee
deleted file mode 100644
index 39b2140..0000000
--- a/src/model/MapData.coffee
+++ /dev/null
@@ -1,9 +0,0 @@
-'use strict'
-
-
-class MapData
- constructor: (data) ->
- {@tiles, @collition, @layers} = data
-
-
-module.exports = MapData
diff --git a/src/model/MapData.ts b/src/model/MapData.ts
new file mode 100644
index 0000000..54894c0
--- /dev/null
+++ b/src/model/MapData.ts
@@ -0,0 +1,20 @@
+'use strict';
+
+
+interface Input {
+ tiles: {[key: string]: {file: string}};
+ collision: string[];
+ layers: string[][][];
+}
+
+export default class MapData {
+ tiles: {[key: string]: {file: string}};
+ public collision: string[];
+ public layers: string[][][];
+
+ constructor(data: Input) {
+ this.tiles = data.tiles;
+ this.collision = data.collision;
+ this.layers = data.layers;
+ }
+}
diff --git a/src/model/Position.coffee b/src/model/Position.coffee
deleted file mode 100644
index 08bb999..0000000
--- a/src/model/Position.coffee
+++ /dev/null
@@ -1,10 +0,0 @@
-'use strict'
-
-
-class Position
- constructor: (@x, @y) ->
-
- asString: => "#{@x},#{@y}"
-
-
-module.exports = Position
diff --git a/src/model/Position.ts b/src/model/Position.ts
new file mode 100644
index 0000000..1db37af
--- /dev/null
+++ b/src/model/Position.ts
@@ -0,0 +1,10 @@
+'use strict';
+
+
+export default class Position {
+ constructor(public x: number, public y: number) {}
+
+ asString(): string {
+ return `${this.x},${this.y}`;
+ }
+}