YAGE  v0.3.1
Yet Another Game Engine
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
camera2d.h
Go to the documentation of this file.
1 /* ----------------------------------------------------------------------------
2  * camera2d.h
3  *
4  * Copyright (c) 2017 Yann Herklotz Grave <ymherklotz@gmail.com>
5  * MIT License, see LICENSE file for more details.
6  * ----------------------------------------------------------------------------
7  */
8 
9 /* ----------------------------------------------------------------------------
10  * camera2d.h
11  *
12  * Copyright (c) 2017 Yann Herklotz Grave <ymherklotz@gmail.com>
13  * MIT License, see LICENSE file for more details.
14  * ----------------------------------------------------------------------------
15  */
16 
17 #ifndef YAGE_CAMERA2D_H
18 #define YAGE_CAMERA2D_H
19 
20 #include "glslprogram.h"
21 
22 #include <glm/glm.hpp>
23 #include <glm/gtc/matrix_transform.hpp>
24 
25 namespace yage
26 {
27 
28 class Camera2D
29 {
30 private:
31  bool update_matrix_ = true;
32  float scale_ = 1;
33  glm::vec2 position_;
34  glm::mat4 camera_matrix_;
35  glm::mat4 ortho_matrix_;
36 
37 public:
38  Camera2D(int screen_width = 1280, int screen_height = 720);
39 
40  void update(GlslProgram &program);
41  void move(const glm::vec2 &direction);
42 };
43 
44 } // namespace yage
45 
46 #endif
glm::mat4 ortho_matrix_
Definition: camera2d.h:35
float scale_
Definition: camera2d.h:32
glm::mat4 camera_matrix_
Definition: camera2d.h:34
void update(GlslProgram &program)
Definition: camera2d.cpp:23
Definition: glslprogram.h:19
bool update_matrix_
Definition: camera2d.h:31
glm::vec2 position_
Definition: camera2d.h:33
Definition: camera2d.h:28
void move(const glm::vec2 &direction)
Definition: camera2d.cpp:39
Camera2D(int screen_width=1280, int screen_height=720)
Definition: camera2d.cpp:16