NWengine 0.9
Loading...
Searching...
No Matches
Transform Class Reference

The Transform class represents the transformation of a game object. More...

#include <Transform.h>

Inheritance diagram for Transform:
GameComponent Serialized

Public Member Functions

 Transform ()
 Default constructor for the Transform class.
 
 Transform (GameObject *go)
 Constructor for the Transform class.
 
int Serialize (std::fstream *data, int offset) override
 Serializes the Transform component data.
 
int Deserialize (std::fstream *data, int offset) override
 Deserializes the Transform component data.
 
void SetGameObject (void *go) override
 Sets the game object attached to the Transform component.
 
voidGetGameObject () override
 Gets the game object attached to the Transform component.
 
- Public Member Functions inherited from GameComponent
virtual void Update ()
 Update the game component.
 
virtual void Start ()
 Start 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 ()
 GetType returns the type of the Transform component.
 
- Static Public Member Functions inherited from GameComponent
static std::string GetType ()
 Get the type of the game component.
 

Public Attributes

fVec2 position = fVec2(0.0f,0.0f)
 
fVec2 scale = fVec2(1.0f, 1.0f)
 
float rotation = 0.0f
 
GameObjectattachedObj
 

Static Public Attributes

static std::map< GameObject *, TransformcomponentList
 

Detailed Description

The Transform class represents the transformation of a game object.

Represents a transform component that defines the position, rotation, and scale of a game object.

Constructor & Destructor Documentation

◆ Transform()

Transform::Transform ( GameObject * go)

Constructor for the Transform class.

Parameters
goThe game object to attach the Transform component to.

Member Function Documentation

◆ Deserialize()

int Transform::Deserialize ( std::fstream * data,
int offset )
overridevirtual

Deserializes the Transform component data.

Parameters
dataThe file stream to read the serialized data from.
offsetThe offset in the file stream to start reading the serialized data.
Returns
The number of bytes read from the file stream.

Reimplemented from Serialized.

◆ GetGameObject()

void * Transform::GetGameObject ( )
overridevirtual

Gets the game object attached to the Transform component.

Returns
The game object attached to the Transform component.

Reimplemented from GameComponent.

◆ GetType()

static std::string Transform::GetType ( )
inlinestatic

GetType returns the type of the Transform component.

Returns
The type of the Transform component.

◆ Serialize()

int Transform::Serialize ( std::fstream * data,
int offset )
overridevirtual

Serializes the Transform component data.

Parameters
dataThe file stream to write the serialized data to.
offsetThe offset in the file stream to start writing the serialized data.
Returns
The number of bytes written to the file stream.

Reimplemented from Serialized.

◆ SetGameObject()

void Transform::SetGameObject ( void * go)
overridevirtual

Sets the game object attached to the Transform component.

Parameters
goThe game object to attach.

Reimplemented from GameComponent.

Member Data Documentation

◆ attachedObj

GameObject* Transform::attachedObj

The game object attached to the Transform component.

◆ componentList

std::map< GameObject *, Transform > Transform::componentList
static

The list of game objects with Transform components.

◆ position

fVec2 Transform::position = fVec2(0.0f,0.0f)

The position of the game object.

◆ rotation

float Transform::rotation = 0.0f

The rotation of the game object.

◆ scale

fVec2 Transform::scale = fVec2(1.0f, 1.0f)

The scale of the game object.


The documentation for this class was generated from the following files: