The Table Engine
|
Manages the camera's view in a game, handling its position in the world space. More...
#include <camera.h>
Public Member Functions | |
Camera () | |
~Camera () | |
void | update () |
Vec2 | getWorldPosition () |
void | setWorldPosition (float x, float y) |
![]() | |
Component () | |
Default constructor for the Component. More... | |
Component (std::string name) | |
Constructs a Component with a specified name. More... | |
virtual | ~Component () |
Virtual destructor for safe polymorphic use. More... | |
std::string | getName () |
Retrieves the name of the component. More... | |
GameObject * | getOwner () |
Retrieves the GameObject that owns this component. More... | |
void | setName (std::string name) |
Sets the name of the component. More... | |
void | setOwner (GameObject *owner) |
Sets the GameObject owner of this component. More... | |
virtual void | input () |
Virtual method for handling input, intended to be overridden by derived components. More... | |
virtual void | render () |
Virtual method for rendering, intended to be overridden by derived components. More... | |
Private Attributes | |
Vec2 | m_worldPosition |
Stores the world position of the camera. More... | |
Additional Inherited Members | |
![]() | |
std::string | m_name |
Name of the component, useful for identification or debugging. More... | |
GameObject * | m_owner |
Pointer to the GameObject that owns this component. More... | |
Manages the camera's view in a game, handling its position in the world space.
The Camera class extends Component, allowing it to be attached to game objects and manage the view based on the game object's transformations or other logic.
Camera::Camera | ( | ) |
Constructor for the Camera class.
Definition at line 9 of file camera.cpp.
Camera::~Camera | ( | ) |
Destructor for the Camera class.
Definition at line 13 of file camera.cpp.
Vec2 Camera::getWorldPosition | ( | ) |
Gets the current world position of the camera.
Definition at line 62 of file camera.cpp.
void Camera::setWorldPosition | ( | float | x, |
float | y | ||
) |
Sets the world position of the camera.
x | The x-coordinate of the new world position. |
y | The y-coordinate of the new world position. |
Definition at line 66 of file camera.cpp.
|
virtual |
Updates the camera's position and behavior. This should be called each frame.
Reimplemented from Component.
Definition at line 17 of file camera.cpp.
|
private |