dEngine
Simple 2D C++ game engine
Public Member Functions | Private Attributes | List of all members
dengine::Camera Class Reference

A camera. More...

#include <Camera.h>

Public Member Functions

 Camera (std::string name, int x, int y, int height, int width)
 Constructor. More...
 
 Camera (std::string name, int height, int width)
 Constructor. More...
 
std::string GetName ()
 Get Camera Name. More...
 
void SetPosition (int x, int y)
 Set camera position. More...
 

Private Attributes

SDL_Rect pos
 
std::string name
 

Detailed Description

A camera.

The camera is meant to be used as a view point for the player or user of the application. This allows the scene to focus on different aspects of the environment or different viewpoints of the character.

Constructor & Destructor Documentation

◆ Camera() [1/2]

Camera::Camera ( std::string  name,
int  x,
int  y,
int  height,
int  width 
)

Constructor.

Create a new camera with x,y coordinates

Parameters
nameThe name of the camera
xThe X coordinate of the camera
yThe Y coordinate of the camera
heightThe height of the viewport
widthThe width of the viewport
See also
Camera(std::string name, int height, int width)

◆ Camera() [2/2]

Camera::Camera ( std::string  name,
int  height,
int  width 
)

Constructor.

Create a new camera with default x and y coordinates

Parameters
nameThe name of the camera
heightThe height of the viewport
widthThe width of the viewport

Member Function Documentation

◆ GetName()

std::string Camera::GetName ( )

Get Camera Name.

Returns
Camera name

◆ SetPosition()

void Camera::SetPosition ( int  x,
int  y 
)

Set camera position.

Parameters
xX coordinate
yY coordinate

Member Data Documentation

◆ name

std::string dengine::Camera::name
private

Referenced by Camera(), and GetName().

◆ pos

SDL_Rect dengine::Camera::pos
private

Referenced by Camera(), and SetPosition().