diff options
Diffstat (limited to 'main.cpp')
-rw-r--r-- | main.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
@@ -266,11 +266,14 @@ void render() { const auto SCREEN_WIDTH = game::SCREEN_WIDTH; const auto SCREEN_HEIGHT = game::SCREEN_HEIGHT; -// offset.x = player->loc.x + player->width / 2; + //offset.x = game::entities.Iterator.begin().component<Position>().x;// + player->width / 2; - auto worldWidth = game::engine.getSystem<WorldSystem>()->getWidth(); + game::entities.each<Position>([](entityx::Entity entity, Position &position) { + (void)entity; + offset.x = position.x; + }); - // ortho x snapping + auto worldWidth = game::engine.getSystem<WorldSystem>()->getWidth(); if (worldWidth < (int)SCREEN_WIDTH) offset.x = 0; else if (offset.x - SCREEN_WIDTH / 2 < worldWidth * -0.5f) |