summaryrefslogtreecommitdiffstats
path: root/src/control
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/control
parent4fa246628bd9e5911ae998162f0bdc724cc739d2 (diff)
downloadrpgedit-c64ead08a36fccc36a42b3e74362aa423cfb62ed.tar
rpgedit-c64ead08a36fccc36a42b3e74362aa423cfb62ed.zip
Replace all CoffeeScript code by TypeScript
Diffstat (limited to 'src/control')
-rw-r--r--src/control/MapContext.coffee29
-rw-r--r--src/control/MapContext.ts34
2 files changed, 34 insertions, 29 deletions
diff --git a/src/control/MapContext.coffee b/src/control/MapContext.coffee
deleted file mode 100644
index df6efec..0000000
--- a/src/control/MapContext.coffee
+++ /dev/null
@@ -1,29 +0,0 @@
-'use strict'
-
-
-Direction = require '../model/Direction'
-Entity = require '../model/Entity'
-EntityPosition = require '../model/EntityPosition'
-Position = require '../model/Position'
-
-MapView = require '../view/MapView'
-
-
-class MapContext
- constructor: (@map) ->
- @entities = {}
-
- @playerEntity = new EntityPosition(
- new Entity('square'),
- new Position(8, 8),
- Direction.EAST)
-
- @addEntity(@playerEntity)
-
- @mavView = new MapView @map, @entities
-
- addEntity: (entity) =>
- @entities[entity.position.asString()] = entity
-
-
-module.exports = MapContext
diff --git a/src/control/MapContext.ts b/src/control/MapContext.ts
new file mode 100644
index 0000000..4bc75c7
--- /dev/null
+++ b/src/control/MapContext.ts
@@ -0,0 +1,34 @@
+'use strict';
+
+
+import Direction from '../model/Direction';
+import Entity from '../model/Entity';
+import EntityPosition from '../model/EntityPosition';
+import MapData from '../model/MapData';
+import Position from '../model/Position';
+
+import MapView from '../view/MapView';
+
+
+export default class MapContext {
+ view: MapView;
+
+ entities: {[key: string]: EntityPosition} = {};
+ playerEntity: EntityPosition;
+
+ constructor(public map: MapData) {
+ this.playerEntity = new EntityPosition(
+ new Entity('square'),
+ new Position(8, 8),
+ Direction.East
+ );
+
+ this.addEntity(this.playerEntity);
+
+ this.view = new MapView(map, this.entities);
+ }
+
+ addEntity(entity: EntityPosition) {
+ this.entities[entity.position.asString()] = entity;
+ }
+}