summaryrefslogtreecommitdiffstats
path: root/src/control
diff options
context:
space:
mode:
Diffstat (limited to 'src/control')
-rw-r--r--src/control/MapContext.cpp8
-rw-r--r--src/control/MapContext.hpp2
2 files changed, 4 insertions, 6 deletions
diff --git a/src/control/MapContext.cpp b/src/control/MapContext.cpp
index acad969..8900298 100644
--- a/src/control/MapContext.cpp
+++ b/src/control/MapContext.cpp
@@ -35,9 +35,7 @@ MapContext::MapContext(EventBus *eventBus0, InputHandler *inputHandler0, const s
: eventBus(eventBus0), inputHandler(inputHandler0), map(map0) {
view = std::unique_ptr<View::MapView>(new View::MapView(window, map.getTileset()));
- map.getEntities().emplace_back("square");
- playerEntity = &map.getEntities().back();
- playerEntity->moveTo(&map, Model::Position{8, 8});
+ playerEntity = map.addEntity("square", Model::Position{8, 8});
view->updateEntities(map.getEntities());
@@ -50,12 +48,12 @@ MapContext::MapContext(EventBus *eventBus0, InputHandler *inputHandler0, const s
}
void MapContext::movePlayer(Model::Direction dir, uint64_t time) {
- if (!playerEntity->move(&map, dir, time, time+250))
+ if (!map.moveEntity(playerEntity, dir, time, time+250))
return;
eventBus->enqueue(
[=] {
- playerEntity->finishTransition(&map);
+ map.finishEntityTransition(playerEntity);
movePlayerContinue(time+250);
},
time+250
diff --git a/src/control/MapContext.hpp b/src/control/MapContext.hpp
index a60bdfc..d9c34f3 100644
--- a/src/control/MapContext.hpp
+++ b/src/control/MapContext.hpp
@@ -54,7 +54,7 @@ private:
void keyPressed(uint16_t key, uint64_t time);
Model::Position getViewPosition(uint64_t time) {
- return playerEntity->getPosition(time);
+ return map.getEntityPosition(playerEntity, time);
}
public: