#include <Camera.h>
|
| | Camera (Camera &other)=delete |
| void | operator= (const Camera &)=delete |
| void | setScaling (float mapWidth, float mapHeight) |
| | Update the Camera scaling factors based on the current world.
|
| void | resized () |
| | Update the Camera scaling factors based on the current window size.
|
| float | xToPixel (float normalizedX) const |
| float | yToPixel (float normalizedY) const |
| float | getTileWidth () const |
| | Returns the width of a tile according to the current scaling factors.
|
| float | getTileHeight () const |
| | Returns the height of a tile according to the current scaling factors.
|
◆ Camera()
| Camera::Camera |
( |
Camera & | other | ) |
|
|
delete |
Singletons should not be cloneable or assignable.
◆ getInstance()
| Camera & Camera::getInstance |
( |
| ) |
|
|
staticnodiscard |
Returns an instance of the Camera class.
- Returns
- Camera instance
◆ getTileHeight()
| float Camera::getTileHeight |
( |
| ) |
const |
|
nodiscard |
Returns the height of a tile according to the current scaling factors.
- Returns
- Height of a tile
◆ getTileWidth()
| float Camera::getTileWidth |
( |
| ) |
const |
|
nodiscard |
Returns the width of a tile according to the current scaling factors.
- Returns
- Width of a tile
◆ operator=()
| void Camera::operator= |
( |
const Camera & | | ) |
|
|
delete |
◆ resized()
Update the Camera scaling factors based on the current window size.
When the window is resized it is important that this is properly reflected by the Camera. Will call setScaling afterward.
◆ setScaling()
| void Camera::setScaling |
( |
float | mapWidth, |
|
|
float | mapHeight ) |
Update the Camera scaling factors based on the current world.
This must be done to assure that the whole world will always fit on screen. Regardless of map or window size.
- Parameters
-
| mapWidth | The loaded world map width in tiles |
| mapHeight | The loaded world map height in tiles |
◆ xToPixel()
| float Camera::xToPixel |
( |
float | normalizedX | ) |
const |
|
nodiscard |
- Parameters
-
| normalizedX | Normalized world X coordinate. |
- Returns
- X coordinate scaled appropriately for the current window width.
◆ yToPixel()
| float Camera::yToPixel |
( |
float | normalizedY | ) |
const |
|
nodiscard |
- Parameters
-
| normalizedY | Normalized world Y coordinate. |
- Returns
- Y coordinate scaled appropriately for the current window height.
The documentation for this class was generated from the following files: