NWengine 0.9
Loading...
Searching...
No Matches
Camera.h
1#pragma once
2#include "GameObject.h"
3#include "FrameBuffer.h"
4#include "Maths.h"
5
9class Camera : public GameComponent {
10public:
15 static std::string GetType() { return "Camera"; };
16
22 static void UpdateActiveCamera();
23
29 fVec3 clearColor = fVec3(0.0,0.0, 0.0);
30 float alpha = 1.0f;
31 bool isActive = 0;
37 Camera() = default;
38
43 Camera(GameObject* go);
44
48 ~Camera();
49
53 void Capture();
54
58 void Update();
59
65 void ChangeOrtho(float sizeX, float sizeY);
66
72 void MoveTo(Vector2<int> target, float interpolationTime);
73
77 void Use();
78
79 fVec2 position = fVec2(0.0f,0.0f);
80 float rotation = 0.0f;
81 float zoom = 1.0;
88 int Serialize(std::fstream* data, int offset) override;
89
90 int Deserialize(std::fstream* data, int offset) override;
91};
Defines the GameObject class and its related components.
The Camera class represents a camera in the game world.
Definition Camera.h:9
bool isActive
Definition Camera.h:31
int Serialize(std::fstream *data, int offset) override
Serialize the object and write it to the file.
Definition Camera.cpp:68
static std::string GetType()
Gets the type of the camera.
Definition Camera.h:15
float zoom
Definition Camera.h:81
float rotation
Definition Camera.h:80
void Update()
Updates the camera.
Definition Camera.cpp:40
static void UpdateActiveCamera()
Updates the active camera.
Definition Camera.cpp:4
void MoveTo(Vector2< int > target, float interpolationTime)
Moves the camera to the target position with interpolation.
Definition Camera.cpp:48
fVec2 position
Definition Camera.h:79
float alpha
Definition Camera.h:30
Matrix4< float > viewMatrix
Definition Camera.h:25
void ChangeOrtho(float sizeX, float sizeY)
Changes the orthographic size of the camera.
Definition Camera.cpp:26
static Camera * ActiveCamera
Definition Camera.h:85
FrameBuffer fbo
Definition Camera.h:83
fVec2 size
Definition Camera.h:27
~Camera()
Destructor for the Camera class.
Definition Camera.cpp:62
fVec3 clearColor
Definition Camera.h:29
void Capture()
Captures the camera.
Definition Camera.cpp:9
Matrix4< float > projectionMatrix
Definition Camera.h:24
Camera()=default
Default constructor for the Camera class.
fVec2 viewPortSize
Definition Camera.h:28
int Deserialize(std::fstream *data, int offset) override
Deserialize the object from the file.
Definition Camera.cpp:85
GameObject * attachedObj
Definition Camera.h:32
void Use()
Uses the camera.
Definition Camera.cpp:54
The FrameBuffer class represents a framebuffer object.
Definition FrameBuffer.h:12
Base class for game components.
Definition GameObject.h:29
Class representing a game object.
Definition GameObject.h:68
Definition Maths.h:513