summaryrefslogtreecommitdiffstats
path: root/src/control
diff options
context:
space:
mode:
Diffstat (limited to 'src/control')
-rw-r--r--src/control/MapContext.coffee29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/control/MapContext.coffee b/src/control/MapContext.coffee
new file mode 100644
index 0000000..df6efec
--- /dev/null
+++ b/src/control/MapContext.coffee
@@ -0,0 +1,29 @@
+'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