NWengine 0.9
|
The Camera class represents a camera in the game world. More...
#include <Camera.h>
Public Member Functions | |
Camera ()=default | |
Default constructor for the Camera class. | |
Camera (GameObject *go) | |
Constructor for the Camera class. | |
~Camera () | |
Destructor for the Camera class. | |
void | Capture () |
Captures the camera. | |
void | Update () |
Updates the camera. | |
void | ChangeOrtho (float sizeX, float sizeY) |
Changes the orthographic size of the camera. | |
void | MoveTo (Vector2< int > target, float interpolationTime) |
Moves the camera to the target position with interpolation. | |
void | Use () |
Uses the camera. | |
int | Serialize (std::fstream *data, int offset) override |
Serialize the object and write it to the file. | |
int | Deserialize (std::fstream *data, int offset) override |
Deserialize the object from the file. | |
Public Member Functions inherited from GameComponent | |
virtual void | Start () |
Start the game component. | |
virtual void | SetGameObject (void *go) |
Set the GameObject associated with the game component. | |
virtual void * | GetGameObject () |
Get the GameObject associated with the game component. | |
virtual | ~GameComponent () |
Destructor for the game component. | |
Public Member Functions inherited from Serialized | |
Serialized () | |
Default constructor for Serialized class. | |
Static Public Member Functions | |
static std::string | GetType () |
Gets the type of the camera. | |
static void | UpdateActiveCamera () |
Updates the active camera. | |
Static Public Member Functions inherited from GameComponent | |
static std::string | GetType () |
Get the type of the game component. | |
Public Attributes | |
Matrix4< float > | projectionMatrix |
Matrix4< float > | viewMatrix = Matrix4<float>(1.0f) |
fVec2 | size |
fVec2 | viewPortSize |
fVec3 | clearColor = fVec3(0.0,0.0, 0.0) |
float | alpha = 1.0f |
bool | isActive = 0 |
GameObject * | attachedObj = nullptr |
fVec2 | position = fVec2(0.0f,0.0f) |
float | rotation = 0.0f |
float | zoom = 1.0 |
FrameBuffer | fbo |
Static Public Attributes | |
static Camera * | ActiveCamera = nullptr |
The Camera class represents a camera in the game world.
Represents a camera component that can be attached to a game object.
Camera::Camera | ( | GameObject * | go | ) |
Constructor for the Camera class.
go | The game object to attach the camera to. |
void Camera::Capture | ( | ) |
Captures the camera.
Captures current scene (see currentScene variable in Scene class)
Changes the orthographic size of the camera.
sizeX | The new size along the X-axis. |
sizeY | The new size along the Y-axis. |
Deserialize the object from the file.
data | The file stream to read the serialized data from. |
offset | The offset in the file to start reading the serialized data. |
Reimplemented from Serialized.
|
inlinestatic |
Gets the type of the camera.
Moves the camera to the target position with interpolation.
target | The target position to move the camera to. |
interpolationTime | The time taken for the interpolation. |
Serialize the object and write it to the file.
data | The file stream to write the serialized data to. |
offset | The offset in the file to start writing the serialized data. |
Reimplemented from Serialized.
|
virtual |
Updates the camera.
Reimplemented from GameComponent.
|
static |
Updates the active camera.
This static method calls capture on ActiveCamera if not null.
float Camera::alpha = 1.0f |
The alpha value of the camera.
GameObject* Camera::attachedObj = nullptr |
The attached game object of the camera.
FrameBuffer Camera::fbo |
The frame buffer object of the camera.
bool Camera::isActive = 0 |
Indicates whether the camera is active or not.
float Camera::rotation = 0.0f |
The rotation of the camera.
fVec2 Camera::size |
The size of the camera.
fVec2 Camera::viewPortSize |
The viewport size of the camera.
float Camera::zoom = 1.0 |
The zoom level of the camera.