2D_Game_Engine
Loading...
Searching...
No Matches
Public Member Functions | List of all members
Camera Class Reference

#include <camera.hpp>

Public Member Functions

 Camera ()
 
 ~Camera ()=default
 
void InitializeProj ()
 
void DrawSceneProj ()
 
void ResetSceneProj ()
 
glm::mat4 GetViewMatrix () const
 
glm::mat4 GetProjMatrix () const
 
glm::mat4 GetViewProjMatrix () const
 
void SetPosition (Vec2 pos)
 
void Move (float x_offset, float y_offset)
 
void SetZoom (float zoom)
 
void Zoom (float zoom_offset)
 
void SetRotation (float rotation)
 
void Rotate (float rotation_offset)
 
Vec2 GetPosition () const
 
float GetZoom () const
 
float GetRotation () const
 

Detailed Description

Definition at line 6 of file camera.hpp.

Constructor & Destructor Documentation

◆ Camera()

Camera::Camera ( )

Definition at line 5 of file camera.cpp.

◆ ~Camera()

Camera::~Camera ( )
default

Member Function Documentation

◆ DrawSceneProj()

void Camera::DrawSceneProj ( )

Set the projection matrix for RENDERER to draw the scene framebuffer

Definition at line 68 of file camera.cpp.

◆ GetPosition()

Vec2 Camera::GetPosition ( ) const
inline

Get the camera position.

Returns
the camera position

Definition at line 75 of file camera.hpp.

◆ GetProjMatrix()

glm::mat4 Camera::GetProjMatrix ( ) const
inline

Definition at line 27 of file camera.hpp.

◆ GetRotation()

float Camera::GetRotation ( ) const
inline

Get the camera rotation angle.

Returns
the camera rotation angle

Definition at line 87 of file camera.hpp.

◆ GetViewMatrix()

glm::mat4 Camera::GetViewMatrix ( ) const
inline

Definition at line 26 of file camera.hpp.

◆ GetViewProjMatrix()

glm::mat4 Camera::GetViewProjMatrix ( ) const
inline

Definition at line 28 of file camera.hpp.

◆ GetZoom()

float Camera::GetZoom ( ) const
inline

Get the zoom level.

Returns
the zoom level

Definition at line 81 of file camera.hpp.

◆ InitializeProj()

void Camera::InitializeProj ( )

Initialize RENDERER and TEXT_RENDERER projection matrices

Definition at line 11 of file camera.cpp.

◆ Move()

void Camera::Move ( float x_offset,
float y_offset )

Move the camera position. The function expects coordinates in engine units (screen width = 10 units).

Parameters
x_offsetthe x offset
y_offsetthe y offset

Definition at line 89 of file camera.cpp.

◆ ResetSceneProj()

void Camera::ResetSceneProj ( )

Set the projection matrix for RENDERER. It's the one generated by InitializeProj

Definition at line 75 of file camera.cpp.

◆ Rotate()

void Camera::Rotate ( float rotation_offset)

Rotate the camera.

Parameters
rotation_offsetAngle offset in degrees

Definition at line 126 of file camera.cpp.

◆ SetPosition()

void Camera::SetPosition ( Vec2 pos)

Set the camera position. The function expects coordinates in engine units (screen width = 10 units).

Parameters
posthe new position

Definition at line 82 of file camera.cpp.

◆ SetRotation()

void Camera::SetRotation ( float rotation)

Set the camera rotation angle.

Parameters
rotationAngle in degrees

Definition at line 119 of file camera.cpp.

◆ SetZoom()

void Camera::SetZoom ( float zoom)

Set the zoom level. Currently the zoom level is clamped between 0.1 and 3.0.

Parameters
zoomthe new zoom level

Definition at line 97 of file camera.cpp.

◆ Zoom()

void Camera::Zoom ( float zoom_offset)

Change the zoom level. Currently the zoom level is clamped between 0.1 and 3.0.

Parameters
zoom_offsetthe zoom offset

Definition at line 108 of file camera.cpp.


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