YAGE
Yet Another Game Engine
camera2d.hpp
1 /* ----------------------------------------------------------------------------
2  * camera2d.hpp
3  *
4  * Copyright (c) 2017 Yann Herklotz Grave <ymherklotz@gmail.com> -- MIT License
5  * See file LICENSE 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 
20 class Camera2D
21 {
22 private:
23  bool matrix_needs_update_=true;
24  float scale_=1;
25  glm::vec2 position_;
26  glm::mat4 camera_matrix_;
27  glm::mat4 ortho_matrix_;
28 
29 public:
30  Camera2D(int screen_width=1280, int screen_height=720);
31  virtual ~Camera2D();
32 
33  // update camera location
34  void update(GlslProgram &program);
35  // camera movement
36  void move(const glm::vec2 &direction);
37 };
38 
39 } // yage
40 
41 #endif
Definition: glslprogram.hpp:19
Definition: camera2d.hpp:20
Definition: camera2d.hpp:17