Dauphine  0.1
A platforming/stealth game in a medieval fantasy setting, developed with SDL2.
Public Member Functions | Private Member Functions | Private Attributes | List of all members
Camera Class Reference

The camera class. More...

#include <Camera.h>

Public Member Functions

 Camera (Entity *const entity_)
 The constructor. More...
 
 ~Camera ()
 The destructor.
 
void update ()
 Updates the camera. More...
 
void centralizeOn (Entity *const entity_)
 Changes the entity to centralize upon. More...
 
SDL_Rect & getClip ()
 
void setLevelWH (const unsigned int width_, const unsigned int height_)
 

Private Member Functions

void updatePosition ()
 Updates the cameras position. More...
 

Private Attributes

Entityentity
 Reference to the entity. More...
 
unsigned int levelW
 The width of the level. More...
 
unsigned int levelH
 The height of the level. More...
 
SDL_Rect clip
 
            Clip which will be used to clip the rendering only to the extent of

the camera. More...

 

Detailed Description

The camera class.

Contains all the relevant implementation relative to the camera.

Constructor & Destructor Documentation

Camera::Camera ( Entity *const  entity_)

The constructor.

Initializes all the attributes.

Parameters
entity_: The entity to centralize the camera on.
Todo:
If the player changes the resolution, so should the clip. (?)

Member Function Documentation

void Camera::centralizeOn ( Entity *const  entity_)

Changes the entity to centralize upon.

Parameters
entity_: The entity to centralize the camera on.
SDL_Rect & Camera::getClip ( )
Returns
The camera clip (an SDL_Rect).
void Camera::setLevelWH ( const unsigned int  width_,
const unsigned int  height_ 
)
Parameters
width_,height_: Tells the camera what the width and height of the level is.
See Also
Level::update()
void Camera::update ( )

Updates the camera.

See Also
Camera::updatePosition Centralizes the player on the screen.
void Camera::updatePosition ( )
private

Updates the cameras position.

Based on the players position, change cameras position.

Member Data Documentation

SDL_Rect Camera::clip
private

            Clip which will be used to clip the rendering only to the extent of

the camera.

Entity* Camera::entity
private

Reference to the entity.

unsigned int Camera::levelH
private

The height of the level.

unsigned int Camera::levelW
private

The width of the level.


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