NWengine 0.9
Loading...
Searching...
No Matches
Transform.h
1#pragma once
2#include "Maths.h"
3#include "Globals.h"
4#include "GameObject.h"
5
9class Transform : public GameComponent {
10public:
15 static std::string GetType() { return "Transform"; };
16
17 fVec2 position = fVec2(0.0f,0.0f);
18 fVec2 scale = fVec2(1.0f, 1.0f);
19 float rotation = 0.0f;
26
32
39 int Serialize(std::fstream* data, int offset) override;
40
47 int Deserialize(std::fstream* data, int offset) override;
48
53 void SetGameObject(void* go) override;
54
59 void* GetGameObject() override;
60
61 static std::map<GameObject*, Transform> componentList;
62};
Defines the GameObject class and its related components.
Base class for game components.
Definition GameObject.h:29
Class representing a game object.
Definition GameObject.h:68
The Transform class represents the transformation of a game object.
Definition Transform.h:9
static std::map< GameObject *, Transform > componentList
Definition Transform.h:61
fVec2 scale
Definition Transform.h:18
static std::string GetType()
GetType returns the type of the Transform component.
Definition Transform.h:15
int Deserialize(std::fstream *data, int offset) override
Deserializes the Transform component data.
Definition Transform.cpp:18
int Serialize(std::fstream *data, int offset) override
Serializes the Transform component data.
Definition Transform.cpp:7
Transform()
Default constructor for the Transform class.
Definition Transform.h:25
fVec2 position
Definition Transform.h:17
void * GetGameObject() override
Gets the game object attached to the Transform component.
Definition Transform.cpp:32
GameObject * attachedObj
Definition Transform.h:20
float rotation
Definition Transform.h:19
void SetGameObject(void *go) override
Sets the game object attached to the Transform component.
Definition Transform.cpp:29