summaryrefslogtreecommitdiffstats
path: root/src/control/MapContext.hpp
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2014-09-24 15:22:09 +0200
committerMatthias Schiffer <mschiffer@universe-factory.net>2014-09-24 15:22:09 +0200
commitaadcecf2022ec13d15da5d816567779740a37da7 (patch)
tree1d1c5c448c69deea35d689d89cfd7abdd754e649 /src/control/MapContext.hpp
parentccf859fe805afe8db3aa694df5d26da7778dfc68 (diff)
downloadrpgedit-aadcecf2022ec13d15da5d816567779740a37da7.tar
rpgedit-aadcecf2022ec13d15da5d816567779740a37da7.zip
Keep mutable entity list in the MapContext only
Diffstat (limited to 'src/control/MapContext.hpp')
-rw-r--r--src/control/MapContext.hpp15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/control/MapContext.hpp b/src/control/MapContext.hpp
index 37a38ea..a9481a6 100644
--- a/src/control/MapContext.hpp
+++ b/src/control/MapContext.hpp
@@ -44,19 +44,26 @@ private:
EventBus *const eventBus;
InputHandler *const inputHandler;
+ View::MapView *const view;
+
std::shared_ptr<const Model::Map> map;
- uint64_t totalTicks = 0;
+ std::vector<std::unique_ptr<Model::Entity>> entities;
+ Model::Entity *playerEntity;
void movePlayer(Model::Direction dir, uint64_t time);
void movePlayerContinue(uint64_t time);
void keyPressed(uint16_t key, uint64_t time);
+ Model::Position getViewPosition(uint64_t time) {
+ return playerEntity->getPosition(time);
+ }
+
public:
- MapContext(EventBus *eventBus0, InputHandler *inputHandler0, const std::shared_ptr<const Model::Map> &map0);
+ MapContext(EventBus *eventBus0, InputHandler *inputHandler0, View::MapView *view0, const std::shared_ptr<const Model::Map> &map0);
- Model::Position getViewPosition(uint64_t time) {
- return map->getPlayerEntity()->getPosition(time);
+ void render(uint64_t time) {
+ view->render(entities, getViewPosition(time), time);
}
};