summaryrefslogtreecommitdiffstats
path: root/src/control
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2016-01-06 08:52:06 +0100
committerMatthias Schiffer <mschiffer@universe-factory.net>2016-01-06 08:52:06 +0100
commit4fa246628bd9e5911ae998162f0bdc724cc739d2 (patch)
treefade72830f5bc1cc8c76e5a78a8ae65290c37a8b /src/control
parent6ed351b495db9e9b86066a419df43dd959ae94d3 (diff)
downloadrpgedit-4fa246628bd9e5911ae998162f0bdc724cc739d2.tar
rpgedit-4fa246628bd9e5911ae998162f0bdc724cc739d2.zip
Add entity rendering
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