aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAndy <drumsetmonkey@gmail.com>2016-10-26 08:43:43 -0400
committerAndy <drumsetmonkey@gmail.com>2016-10-26 08:43:43 -0400
commite0f353be4c21f38978bef83e9651ef9eda886da4 (patch)
tree343e10ffab515f8141cd010f9f297575ad79b3a9 /src
parent52de6c2e6c048b84a7665b6fc583b2259bbdd3af (diff)
Stuff is solid
Diffstat (limited to 'src')
-rw-r--r--src/player.cpp3
-rw-r--r--src/window.cpp2
-rw-r--r--src/world.cpp11
3 files changed, 15 insertions, 1 deletions
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<Sprite>().get()->getSpriteSize();
+ float cdat[2] = {dim.x, dim.y};
+ player.assign<Solid>(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<Portal>(wxml->StrAttribute("inside"));
+ } else if (tname == "Solid") {
+ vec2 dim;
+
+ if (abcd->Attribute("value") != nullptr) {
+ dim = str2coord(abcd->StrAttribute("value"));
+ } else {
+ dim = entity.component<Sprite>().get()->getSpriteSize();
+ }
+
+ float cdat[2] = {dim.x, dim.y};
+ entity.assign<Solid>(cdat[0], cdat[1]);
}
abcd = abcd->NextSiblingElement();