Ember
A C++ 20 'game engine' built with SDL3 with wide platform support.
Public Member Functions | Public Attributes | List of all members
Camera2D Struct Reference

Camera2D component. More...

#include <camera.h>

Public Member Functions

 Camera2D (int view_width, int view_height, float zoom=1.0f)
 
glm::mat4 GetViewMatrix () const
 
glm::vec4 GetViewport () const
 Get the viewport. More...
 
bool IsVisible (const glm::vec3 &position)
 Check if the position is visible by the camera. More...
 
void Resize (int view_width, int view_height)
 Resize the camera view. More...
 
glm::mat4 GetProjectionMatrix () const
 Get the projection matrix (orthographic) More...
 
int GetHeight () const
 
int GetWidth () const
 
void SetZoom (float zoom)
 
float GetZoom () const
 

Public Attributes

Transform transform
 
float zoom = 1.0f
 

Detailed Description

Camera2D component.

Parameters
view_widthViewport width
view_heightViewport height
zoomCamera zoom between (0.0f - 10.0f)
Version
0.0.5

Constructor & Destructor Documentation

◆ Camera2D()

Camera2D::Camera2D ( int  view_width,
int  view_height,
float  zoom = 1.0f 
)
inline

Member Function Documentation

◆ GetHeight()

int Camera2D::GetHeight ( ) const
inline

◆ GetProjectionMatrix()

glm::mat4 Camera2D::GetProjectionMatrix ( ) const

Get the projection matrix (orthographic)

Version
0.0.4
Returns
glm::mat4 Matrix

◆ GetViewMatrix()

glm::mat4 Camera2D::GetViewMatrix ( ) const

◆ GetViewport()

glm::vec4 Camera2D::GetViewport ( ) const

Get the viewport.

Version
0.0.4
Returns
glm::vec4 Viewport

◆ GetWidth()

int Camera2D::GetWidth ( ) const
inline

◆ GetZoom()

float Camera2D::GetZoom ( ) const
inline

◆ IsVisible()

bool Camera2D::IsVisible ( const glm::vec3 &  position)

Check if the position is visible by the camera.

Parameters
positionObject position Transform (position)
Version
0.0.4
Returns
bool

◆ Resize()

void Camera2D::Resize ( int  view_width,
int  view_height 
)

Resize the camera view.

Parameters
view_widthViewport width
view_heightViewport height
Version
0.0.4
Returns
void

◆ SetZoom()

void Camera2D::SetZoom ( float  zoom)
inline

Member Data Documentation

◆ transform

Transform Camera2D::transform

◆ zoom

float Camera2D::zoom = 1.0f

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