aboutsummaryrefslogtreecommitdiffstats
path: root/main.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'main.cpp')
-rw-r--r--main.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/main.cpp b/main.cpp
index 4b579b2..7a4f0ca 100644
--- a/main.cpp
+++ b/main.cpp
@@ -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)