diff options
Diffstat (limited to 'src/control/MapContext.hpp')
-rw-r--r-- | src/control/MapContext.hpp | 20 |
1 files changed, 1 insertions, 19 deletions
diff --git a/src/control/MapContext.hpp b/src/control/MapContext.hpp index 4cbf38a..504afc2 100644 --- a/src/control/MapContext.hpp +++ b/src/control/MapContext.hpp @@ -53,25 +53,7 @@ private: public: MapContext(ImageLoader *imageLoader0, const std::shared_ptr<const Model::Map> &map0); - void advance(InputHandler *inputHandler, uint32_t ticks) { - uint64_t totalTicksOld = totalTicks; - totalTicks += ticks; - - uint64_t advanced = totalTicks/100 - totalTicksOld/100; - - if (inputHandler->isKeyPressed(SDL_SCANCODE_UP)) { - map->getPlayerEntity().move(Model::NORTH, advanced); - } - else if (inputHandler->isKeyPressed(SDL_SCANCODE_RIGHT)) { - map->getPlayerEntity().move(Model::EAST, advanced); - } - else if (inputHandler->isKeyPressed(SDL_SCANCODE_DOWN)) { - map->getPlayerEntity().move(Model::SOUTH, advanced); - } - else if (inputHandler->isKeyPressed(SDL_SCANCODE_LEFT)) { - map->getPlayerEntity().move(Model::WEST, advanced); - } - } + void advance(InputHandler *inputHandler, unsigned ticks); std::shared_ptr<View::MapView> initView(const std::shared_ptr<View::Window> &window) { return std::make_shared<View::MapView>(window, map, tiles, entities); |