YAGE  0.02
Yet Another Game Engine
camera2d.hpp
1 /* ----------------------------------------------------------------------------
2  * camera2d.hpp
3  *
4  * Copyright (c) 2017 Yann Herklotz Grave <ymherklotz@gmail.com>
5  * MIT License, see LICENSE file for more details.
6  * ----------------------------------------------------------------------------
7  */
8 
9 #ifndef CAMERA_2D_HPP
10 #define CAMERA_2D_HPP
11 
12 #include "glslprogram.hpp"
13 
14 #include <glm/glm.hpp>
15 #include <glm/gtc/matrix_transform.hpp>
16 
17 namespace yage {
18 
19 class Camera2D {
20 private:
21  bool matrix_needs_update_ = true;
22  float scale_ = 1;
23  glm::vec2 position_;
24  glm::mat4 camera_matrix_;
25  glm::mat4 ortho_matrix_;
26 
27 public:
28  Camera2D(int screen_width = 1280, int screen_height = 720);
29 
30  // update camera location
31  void update(GlslProgram& program);
32  // camera movement
33  void move(const glm::vec2& direction);
34 };
35 
36 } // yage
37 
38 #endif
Definition: camera2d.hpp:17