aboutsummaryrefslogtreecommitdiffstats
path: root/src/camera2d.cpp
diff options
context:
space:
mode:
authorYann Herklotz <ymherklotz@gmail.com>2017-06-21 13:15:59 +0100
committerYann Herklotz <ymherklotz@gmail.com>2017-06-21 13:15:59 +0100
commit4e8c07d3fd949287fc2361284a5a7704e642396e (patch)
tree18d7e5c2d41cedb00a29ac303637102c7d4b157d /src/camera2d.cpp
parentf3e75c7f821675740736b46094382d55c7e6ee5c (diff)
downloadYAGE-4e8c07d3fd949287fc2361284a5a7704e642396e.tar.gz
YAGE-4e8c07d3fd949287fc2361284a5a7704e642396e.zip
Correcting indentation and removed vector2d.cpp
Diffstat (limited to 'src/camera2d.cpp')
-rw-r--r--src/camera2d.cpp30
1 files changed, 15 insertions, 15 deletions
diff --git a/src/camera2d.cpp b/src/camera2d.cpp
index 041870ed..81e8d971 100644
--- a/src/camera2d.cpp
+++ b/src/camera2d.cpp
@@ -6,9 +6,9 @@ namespace yage
{
Camera2D::Camera2D(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))
+ position_(0.f, 0.f),
+ camera_matrix_(1.f),
+ ortho_matrix_(glm::ortho(0.f, (float)screen_width, 0.f, (float)screen_height))
{}
Camera2D::~Camera2D()
@@ -16,25 +16,25 @@ Camera2D::~Camera2D()
void Camera2D::update(GlslProgram &program)
{
- if(matrix_needs_update_)
- {
- glm::vec3 translate(-position_.x, -position_.y, 0.f);
- glm::vec3 scale(scale_, scale_, 0.f);
+ if(matrix_needs_update_)
+ {
+ 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_;
+ camera_matrix_=glm::translate(ortho_matrix_, translate);
+ camera_matrix_=glm::scale(glm::mat4(1.f), scale)*camera_matrix_;
- matrix_needs_update_=false;
- }
+ matrix_needs_update_=false;
+ }
- GLint matrix_location = program.getUniformLocation("P");
- glUniformMatrix4fv(matrix_location, 1, GL_FALSE, &(camera_matrix_[0][0]));
+ GLint matrix_location = program.getUniformLocation("P");
+ glUniformMatrix4fv(matrix_location, 1, GL_FALSE, &(camera_matrix_[0][0]));
}
void Camera2D::move(const glm::vec2 &direction)
{
- position_+=direction;
- matrix_needs_update_=true;
+ position_+=direction;
+ matrix_needs_update_=true;
}
} // yage