Yet Another Game Engine
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | List of all members
yage::Camera Class Reference

#include <camera.h>

Public Member Functions

 Camera (int screen_width=1280, int screen_height=720)
 Creates a camera that looks onto the scene. More...
 
void update (Shader &program)
 Updates the camera matrix value in the shader program that is passed to it. More...
 
void move (const glm::vec2 &direction)
 Moves the camera using a two-dimensional displacement vector to describe the movement. More...
 
void zoom (float factor)
 Zooms the camera by an incremental amount. More...
 

Constructor & Destructor Documentation

yage::Camera::Camera ( int  screen_width = 1280,
int  screen_height = 720 
)

Creates a camera that looks onto the scene.

The screen width and screen height should be the current size of the window that the camera is being used on so that is functions correctly.

Parameters
screen_widthCurrent screen width of the Window.
screen_heightCurrent screen height of the Window.

Member Function Documentation

void yage::Camera::move ( const glm::vec2 &  direction)

Moves the camera using a two-dimensional displacement vector to describe the movement.

Parameters
directionTwo-dimensional vector to describe the displacement of the camera.
void yage::Camera::update ( Shader program)

Updates the camera matrix value in the shader program that is passed to it.

This must be a parameter P in the shader for this function to work.

Parameters
programShader program to make changes to.
Todo:
Make this function more general to be able to be able to use any parametre in then shader as the camera matrix and not make it dependent on it being P.
void yage::Camera::zoom ( float  factor)

Zooms the camera by an incremental amount.

Parameters
factorFactor by which the camera should zoom. This can also be a negative number for the camera to zoom out.

The documentation for this class was generated from the following files: