aboutsummaryrefslogtreecommitdiffstats
path: root/src/systems/render.cpp
diff options
context:
space:
mode:
authorClyne Sullivan <tullivan99@gmail.com>2017-10-20 08:00:57 -0400
committerClyne Sullivan <tullivan99@gmail.com>2017-10-20 08:00:57 -0400
commit563d978b4ba721370441eaaca3f8471ec383deff (patch)
tree268b04a1fdfec2ce92512722ef2d0a8b74e3659a /src/systems/render.cpp
parentd79f4a7f4b5aff5931ef86edd2537ef5e3620fd4 (diff)
arrow rotation and actual pausing
Diffstat (limited to 'src/systems/render.cpp')
-rw-r--r--src/systems/render.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/systems/render.cpp b/src/systems/render.cpp
index a25b152..f72832b 100644
--- a/src/systems/render.cpp
+++ b/src/systems/render.cpp
@@ -78,7 +78,9 @@ void RenderSystem::render(void)
if (S.first.veltate) {
auto vel = entity.component<Direction>();
- float angle = static_cast<float>(std::atan(vel->y / vel->x)) * 180 / 3.14f;
+ float angle = std::atan(vel->y / vel->x);
+ if (vel->x < 0)
+ angle += 3.14f;
auto toOrigin = glm::translate(glm::mat4(1.0f), glm::vec3(-pos.x, -pos.y, 0.0f));
auto rotation = glm::rotate(glm::mat4(1.0f), angle, glm::vec3(0.0f, 0.0f, 1.0f));
auto toBack = glm::translate(glm::mat4(1.0f), glm::vec3(pos.x, pos.y, 0.0f));