Provides functions to control the camera's perspective and its location. More...
#include <Camera.h>
Public Member Functions | |
Camera (int x, int y) | |
Constructor. More... | |
~Camera ()=default | |
Default destructor. More... | |
bool | inCamera (int x, int y) |
given a point, determine if the point is within camera sight. Used for drawing optimization More... | |
void | setCameraPos (int x, int y) |
Set camera's position. More... | |
int | getPosX () |
Get x location of camera. More... | |
int | getPosY () |
Get y location of camera. More... | |
int | getViewPortWidth () |
Get width of camera's viewport. More... | |
void | setViewPortWidth (int width) |
Set width of camera's viewport. More... | |
int | getViewPortHeight () |
Get height of camera's viewport. More... | |
void | setViewPortHeight (int height) |
Set height of camera's viewport. More... | |
int | getXOffset () |
Get camera's offset on horizontal direction. More... | |
void | setXOffset (int offset) |
Set camera's offset on horizontal direction. More... | |
int | getYOffset () |
Get camera's offset on vertical direction. More... | |
void | setYOffset (int offset) |
Set camera's offset on vertical direction. More... | |
Public Member Functions inherited from Component | |
Component () | |
~Component () | |
Provides functions to control the camera's perspective and its location.
Camera::Camera | ( | int | x, |
int | y | ||
) |
Constructor.
x | The x location of camera. |
y | The y location of camera. |
|
default |
Default destructor.
int Camera::getPosX | ( | ) |
Get x location of camera.
int Camera::getPosY | ( | ) |
Get y location of camera.
int Camera::getViewPortHeight | ( | ) |
Get height of camera's viewport.
int Camera::getViewPortWidth | ( | ) |
Get width of camera's viewport.
int Camera::getXOffset | ( | ) |
Get camera's offset on horizontal direction.
This function is used in tilemap editor whenever the screen was divided into left girds and right grids.
int Camera::getYOffset | ( | ) |
Get camera's offset on vertical direction.
bool Camera::inCamera | ( | int | x, |
int | y | ||
) |
given a point, determine if the point is within camera sight. Used for drawing optimization
void Camera::setCameraPos | ( | int | x, |
int | y | ||
) |
Set camera's position.
void Camera::setViewPortHeight | ( | int | height | ) |
Set height of camera's viewport.
height | The height of camera's viewport. |
void Camera::setViewPortWidth | ( | int | width | ) |
Set width of camera's viewport.
width | The width of camera's viewport. |
void Camera::setXOffset | ( | int | offset | ) |
Set camera's offset on horizontal direction.
void Camera::setYOffset | ( | int | offset | ) |
Set camera's offset on vertical direction.