From aadcecf2022ec13d15da5d816567779740a37da7 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Wed, 24 Sep 2014 15:22:09 +0200 Subject: Keep mutable entity list in the MapContext only --- src/control/MapContext.hpp | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'src/control/MapContext.hpp') 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 map; - uint64_t totalTicks = 0; + std::vector> 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 &map0); + MapContext(EventBus *eventBus0, InputHandler *inputHandler0, View::MapView *view0, const std::shared_ptr &map0); - Model::Position getViewPosition(uint64_t time) { - return map->getPlayerEntity()->getPosition(time); + void render(uint64_t time) { + view->render(entities, getViewPosition(time), time); } }; -- cgit v1.2.3