GUInity
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
Component Class Referenceabstract

#include <Component.hpp>

Inheritance diagram for Component:
Camera Collider EditorCollider Light MeshComponent MeshRenderer RigidBody RigidStatic ScriptComponent

Public Member Functions

 Component ()
 
virtual ~Component ()
 
virtual void init ()
 
virtual void destroy ()
 
virtual void setActive (bool isActive)
 
virtual void awake ()
 
virtual void tick (float deltaSecods)
 
shared_ptr< ActorgetActor ()
 
void setActor (weak_ptr< Actor > actor)
 
virtual shared_ptr< Componentclone ()=0
 
virtual shared_ptr< ComponentDescriptiongetComponentDescription ()=0
 
virtual void deserialize (shared_ptr< ComponentDescription > desc)=0
 

Protected Member Functions

void setCopyMode (bool initWithData)
 

Protected Attributes

bool initWithData
 
bool isActive
 

Detailed Description

Component is the very basis of the engine. All the actor behaviour should come from a component Component-based game engines allow for small, modular classes that are reused very often. Component behaviour can vary from custom ScriptComponent (custom behaviour) to RigidBody physics and MeshRenderer. A Component can only exist in conjunction with an actor. Component is an abstract class and is the parent of all Components.

Constructor & Destructor Documentation

Component::Component ( )

Default Constructor

Component::~Component ( )
virtual

Default Destructor. Virtual because is parent class

Member Function Documentation

virtual void Component::awake ( )
inlinevirtual

Called by Actor owner when it's first awaken

Reimplemented in Camera, Collider, ScriptComponent, ScaleTool, PlayerScript, MoveTool, RotateHandle, RotateTool, and IncreaseColliderScript.

virtual shared_ptr<Component> Component::clone ( )
pure virtual

Pure virtual function. Clones current component (Prototype Design Pattern)

Returns
shared_ptr to cloned Component

Implemented in Camera, RigidBody, Collider, MeshRenderer, CapsuleCollider, FontMesh, ScriptComponent, EditorCollider, Light, MeshComponent, PlayerScript, RigidStatic, SphereCollider, BoxCollider, MeshFilter, and MeshCollider.

virtual void Component::destroy ( )
inlinevirtual

Destroys Component and release any component-specific members

Reimplemented in Camera, Collider, MeshRenderer, RigidBody, Light, ScriptComponent, and RigidStatic.

shared_ptr< Actor > Component::getActor ( )

Getter for owner Actor

Returns
shared_ptr for the owner
virtual void Component::init ( )
inlinevirtual

Initializes the component. Initialization should not be done in constructor due to enable_shared_from_this<T> inheritance.

Reimplemented in Camera, Collider, CapsuleCollider, MeshRenderer, RigidBody, Light, SphereCollider, EditorCollider, ScriptComponent, RigidStatic, BoxCollider, MeshCollider, and EditorCameraControl.

void Component::setActor ( weak_ptr< Actor actor)

Setter for owner Actor

Parameters
ownerActor
void Component::setCopyMode ( bool  initWithData)
protected

Used when been deserialized or cloned

Parameters
[in]initWithDatatrue if this component data will come from clone of deserialization, false if it's a new component being creates
virtual void Component::tick ( float  deltaSecods)
inlinevirtual

Member Data Documentation

bool Component::initWithData
protected

Used when been deserialized or cloned

bool Component::isActive
protected

Is component active


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