From e0f353be4c21f38978bef83e9651ef9eda886da4 Mon Sep 17 00:00:00 2001 From: Andy Date: Wed, 26 Oct 2016 08:43:43 -0400 Subject: Stuff is solid --- src/player.cpp | 3 +++ src/window.cpp | 2 +- src/world.cpp | 11 +++++++++++ 3 files changed, 15 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/player.cpp b/src/player.cpp index 8808a69..59274b3 100644 --- a/src/player.cpp +++ b/src/player.cpp @@ -19,6 +19,9 @@ void PlayerSystem::create(void) sprite->addSpriteSegment(SpriteData("assets/cat.png", vec2(0, 0)), vec2(0, 0)); + vec2 dim = player.component().get()->getSpriteSize(); + float cdat[2] = {dim.x, dim.y}; + player.assign(cdat[0], cdat[1]); } void PlayerSystem::configure(entityx::EventManager &ev) diff --git a/src/window.cpp b/src/window.cpp index 69c383c..4c73b8b 100644 --- a/src/window.cpp +++ b/src/window.cpp @@ -71,9 +71,9 @@ void WindowSystem::configure(entityx::EventManager &ev) void WindowSystem::receive(const WindowResizeEvent &wre) { - game::SCREEN_WIDTH = wre.x; game::SCREEN_HEIGHT = wre.y; + glViewport(0, 0, wre.x, wre.y); SDL_SetWindowSize(window, wre.x, wre.y); } diff --git a/src/world.cpp b/src/world.cpp index d7639c2..365345d 100644 --- a/src/world.cpp +++ b/src/world.cpp @@ -359,6 +359,17 @@ void WorldSystem::load(const std::string& file) vec2(0, 0)); } else if (tname == "Portal") { entity.assign(wxml->StrAttribute("inside")); + } else if (tname == "Solid") { + vec2 dim; + + if (abcd->Attribute("value") != nullptr) { + dim = str2coord(abcd->StrAttribute("value")); + } else { + dim = entity.component().get()->getSpriteSize(); + } + + float cdat[2] = {dim.x, dim.y}; + entity.assign(cdat[0], cdat[1]); } abcd = abcd->NextSiblingElement(); -- cgit v1.2.3