Yet Another Game Engine
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
camera.h
Go to the documentation of this file.
1 
10 #pragma once
11 
12 #include <glm/glm.hpp>
13 
14 namespace yage
15 {
16 
17 class Shader;
18 
19 class Camera
20 {
21 private:
22  bool update_matrix_ = true;
23  float scale_ = 1;
24  glm::vec2 position_;
25  glm::mat4 camera_matrix_;
26  glm::mat4 ortho_matrix_;
27 
28 public:
29  Camera(int screen_width = 1280, int screen_height = 720);
30 
31  void update(Shader &program);
32  void move(const glm::vec2 &direction);
33  void zoom(float factor);
34 };
35 
36 } // namespace yage
Definition: camera.h:19
void zoom(float factor)
Zooms the camera by an incremental amount.
Definition: camera.cpp:79
Camera(int screen_width=1280, int screen_height=720)
Creates a camera that looks onto the scene.
Definition: camera.cpp:28
Definition: shader.h:20
void move(const glm::vec2 &direction)
Moves the camera using a two-dimensional displacement vector to describe the movement.
Definition: camera.cpp:67
void update(Shader &program)
Updates the camera matrix value in the shader program that is passed to it.
Definition: camera.cpp:45