aboutsummaryrefslogtreecommitdiffstats
path: root/yage/core/camera2d.cpp
diff options
context:
space:
mode:
authorYann Herklotz <ymherklotz@gmail.com>2017-12-23 01:37:09 +0000
committerYann Herklotz <ymherklotz@gmail.com>2017-12-23 01:40:47 +0000
commitddd26ed83d3ac0335562f762ced273a1d62bd959 (patch)
treea697de87564846e784fd1256d71c94270d8ec51d /yage/core/camera2d.cpp
parent0ac42fb77773e15b13f1ede01dd1efd920a8fb9b (diff)
downloadYAGE-ddd26ed83d3ac0335562f762ced273a1d62bd959.tar.gz
YAGE-ddd26ed83d3ac0335562f762ced273a1d62bd959.zip
[Style] Updated style in files.
Diffstat (limited to 'yage/core/camera2d.cpp')
-rw-r--r--yage/core/camera2d.cpp46
1 files changed, 0 insertions, 46 deletions
diff --git a/yage/core/camera2d.cpp b/yage/core/camera2d.cpp
deleted file mode 100644
index 463dd0d2..00000000
--- a/yage/core/camera2d.cpp
+++ /dev/null
@@ -1,46 +0,0 @@
-/** ---------------------------------------------------------------------------
- * @file: camera2d.cpp
- *
- * Copyright (c) 2017 Yann Herklotz Grave <ymherklotz@gmail.com>
- * MIT License, see LICENSE file for more details.
- * ----------------------------------------------------------------------------
- */
-
-#include "camera2d.h"
-#include "glslprogram.h"
-
-#include <glad/glad.h>
-
-namespace yage
-{
-
-Camera::Camera(int screen_width, int screen_height)
- : position_(0.f, 0.f), camera_matrix_(1.f),
- ortho_matrix_(
- glm::ortho(0.f, (float)screen_width, 0.f, (float)screen_height))
-{
-}
-
-void Camera::update(GlslProgram &program)
-{
- if (update_matrix_) {
- glm::vec3 translate(-position_.x, -position_.y, 0.f);
- glm::vec3 scale(scale_, scale_, 0.f);
-
- camera_matrix_ = glm::translate(ortho_matrix_, translate);
- camera_matrix_ = glm::scale(glm::mat4(1.f), scale) * camera_matrix_;
-
- update_matrix_ = false;
- }
-
- GLint matrix_location = program.getUniformLocation("P");
- glUniformMatrix4fv(matrix_location, 1, GL_FALSE, &(camera_matrix_[0][0]));
-}
-
-void Camera::move(const glm::vec2 &direction)
-{
- position_ += direction;
- update_matrix_ = true;
-}
-
-} // namespace yage