From 7a4bc1d9e6b73471cb2e20d2ab0611a507979f30 Mon Sep 17 00:00:00 2001 From: Clyne Sullivan Date: Thu, 20 Oct 2016 09:23:52 -0400 Subject: ortho follows cat, bobshouse can be opened --- main.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'main.cpp') 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().x;// + player->width / 2; - auto worldWidth = game::engine.getSystem()->getWidth(); + game::entities.each([](entityx::Entity entity, Position &position) { + (void)entity; + offset.x = position.x; + }); - // ortho x snapping + auto worldWidth = game::engine.getSystem()->getWidth(); if (worldWidth < (int)SCREEN_WIDTH) offset.x = 0; else if (offset.x - SCREEN_WIDTH / 2 < worldWidth * -0.5f) -- cgit v1.2.3