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 
9 #pragma once
10 
11 #include <glm/glm.hpp>
12 
13 namespace yage
14 {
15 
16 class Shader;
17 
18 class Camera
19 {
20 private:
21  bool update_matrix_ = true;
22  float scale_ = 1;
23  glm::vec2 position_;
24  glm::mat4 camera_matrix_;
25  glm::mat4 ortho_matrix_;
26 
27 public:
28  Camera(int screen_width = 1280, int screen_height = 720);
29 
30  void update(Shader &program);
31  void move(const glm::vec2 &direction);
32  void zoom(float factor);
33 };
34 
35 } // namespace yage
Definition: camera.h:18
void zoom(float factor)
Zooms the camera by an incremental amount.
Definition: camera.cpp:78
Camera(int screen_width=1280, int screen_height=720)
Creates a camera that looks onto the scene.
Definition: camera.cpp:27
Definition: shader.h:19
void move(const glm::vec2 &direction)
Moves the camera using a two-dimensional displacement vector to describe the movement.
Definition: camera.cpp:66
void update(Shader &program)
Updates the camera matrix value in the shader program that is passed to it.
Definition: camera.cpp:44