R-Type
R-Type project
KapEngine::GameObject Class Reference
Inheritance diagram for KapEngine::GameObject:
KapEngine::Entity

Public Member Functions

 GameObject (SceneManagement::Scene &scene, std::string const &name)
 
void addComponent (std::shared_ptr< Component > comp)
 add new component to GameObject More...
 
void removeComponent (std::shared_ptr< Component > comp)
 remove component from its shared_ptr More...
 
void removeComponent (std::size_t id)
 remove component from its id More...
 
ComponentgetComponent (std::string const &componentName)
 Get the Component by its name. More...
 
template<typename T , typename = std::enable_if<std::is_base_of<Component, T>::value>>
T & getComponent (std::string const &componentName)
 Get the Component by its type. More...
 
template<typename T , typename = std::enable_if<std::is_base_of<Component, T>::value>>
T & getComponent ()
 Get the Component by its type. More...
 
template<typename T , typename = std::enable_if<std::is_base_of<Component, T>::value>>
std::vector< std::shared_ptr< T > > getComponents ()
 Get the Components by there type. More...
 
bool hasComponent (std::string const &componentName) const
 return if GameObject has component from its name More...
 
template<typename T , typename = std::enable_if<std::is_base_of<Component, T>::value>>
bool hasComponent () const
 return if GameObject has component from its type More...
 
KEnginegetEngine ()
 Get the Engine. More...
 
void __update (bool physics=false, bool runDisplay=true)
 
void __updateDisplay ()
 
void setActive (bool b)
 Set the Active status of GameObject. More...
 
bool isActive () const
 return if GameObject is active More...
 
bool isDestroyed () const
 return if GameObject is destroyed More...
 
SceneManagement::ScenegetScene ()
 Get the Scene. More...
 
SceneManagement::ScenegetSceneConst () const
 Get the Scene. More...
 
ComponentgetTransform ()
 Get the Transform. More...
 
void __engineStop ()
 
std::string getName () const
 Get GameObject Name. More...
 
EntitygetEntity () const
 Get the Entity of GameObject. More...
 
void __destroyIt ()
 
void __init ()
 
void __stoppingGame ()
 
void __onSceneGonnaUpdated ()
 
void __onSceneUpdated ()
 
void dump (bool displayComponent=false, std::string prefix="")
 display GameObject in log More...
 
std::vector< std::shared_ptr< Component > > getAllComponents () const
 Get the All Components of GameObject. More...
 
void destroy ()
 destroy the GameObject More...
 
void __setPrefab (std::string const &name)
 set prefab name More...
 
std::string getPrefabName () const
 Get the Prefab Name. More...
 
void setName (std::string const &name)
 Set the Name of GameObject. More...
 
void setTag (std::string const &tag)
 Set the GameObject Tag. More...
 
std::string getTag () const
 Get the GameObject Tag. More...
 
void __onSceneChanged ()
 call when scene changed to another scene More...
 
- Public Member Functions inherited from KapEngine::Entity
 Entity (std::size_t __id=0)
 
void __setId (std::size_t id)
 set entity id More...
 
std::size_t getId () const
 Get the entity id. More...
 
virtual Entityoperator= (Entity const &en)
 
virtual bool operator== (Entity const &en)
 
virtual bool operator!= (Entity const &en)
 

Additional Inherited Members

- Protected Attributes inherited from KapEngine::Entity
std::size_t _id = 0
 

Member Function Documentation

◆ __destroyIt()

void KapEngine::GameObject::__destroyIt ( )
Warning
do not call this function

◆ __engineStop()

void KapEngine::GameObject::__engineStop ( )
Warning
do not call this function

◆ __init()

void KapEngine::GameObject::__init ( )
Warning
do not call this function

◆ __onSceneChanged()

void KapEngine::GameObject::__onSceneChanged ( )

call when scene changed to another scene

Warning
do not call this function

◆ __onSceneGonnaUpdated()

void KapEngine::GameObject::__onSceneGonnaUpdated ( )
Warning
do not call this function

◆ __onSceneUpdated()

void KapEngine::GameObject::__onSceneUpdated ( )
Warning
do not call this function

◆ __setPrefab()

void KapEngine::GameObject::__setPrefab ( std::string const &  name)

set prefab name

Warning
do not use this function
Parameters
name

◆ __stoppingGame()

void KapEngine::GameObject::__stoppingGame ( )
Warning
do not call this function

◆ __update()

void KapEngine::GameObject::__update ( bool  physics = false,
bool  runDisplay = true 
)
Warning
do not call this function

◆ __updateDisplay()

void KapEngine::GameObject::__updateDisplay ( )
Warning
do not call this function

◆ addComponent()

void KapEngine::GameObject::addComponent ( std::shared_ptr< Component comp)

add new component to GameObject

Parameters
comp

◆ destroy()

void KapEngine::GameObject::destroy ( )

destroy the GameObject

◆ dump()

void KapEngine::GameObject::dump ( bool  displayComponent = false,
std::string  prefix = "" 
)

display GameObject in log

Parameters
displayComponent
prefix

◆ getAllComponents()

std::vector< std::shared_ptr< KapEngine::Component > > KapEngine::GameObject::getAllComponents ( ) const

Get the All Components of GameObject.

Returns
std::vector<std::shared_ptr<KapEngine::Component>>

◆ getComponent() [1/3]

template<typename T , typename = std::enable_if<std::is_base_of<Component, T>::value>>
T& KapEngine::GameObject::getComponent ( )
inline

Get the Component by its type.

Template Parameters
T
typename
T>::value>
Returns
T&

◆ getComponent() [2/3]

KapEngine::Component & KapEngine::GameObject::getComponent ( std::string const &  componentName)

Get the Component by its name.

Parameters
componentName
Returns
Component&
Deprecated:

◆ getComponent() [3/3]

template<typename T , typename = std::enable_if<std::is_base_of<Component, T>::value>>
T& KapEngine::GameObject::getComponent ( std::string const &  componentName)
inline

Get the Component by its type.

Template Parameters
T
typename
T>::value>
Parameters
componentName
Returns
T&
Deprecated:

◆ getComponents()

template<typename T , typename = std::enable_if<std::is_base_of<Component, T>::value>>
std::vector<std::shared_ptr<T> > KapEngine::GameObject::getComponents ( )
inline

Get the Components by there type.

Template Parameters
T
typename
T>::value>
Returns
std::vector<std::shared_ptr<T>>

◆ getEngine()

KapEngine::KEngine & KapEngine::GameObject::getEngine ( )

Get the Engine.

Returns
KapEngine::KEngine&

◆ getEntity()

Entity& KapEngine::GameObject::getEntity ( ) const
inline

Get the Entity of GameObject.

Returns
KapEngine::Entity&

◆ getName()

std::string KapEngine::GameObject::getName ( ) const
inline

Get GameObject Name.

Returns
std::string

◆ getPrefabName()

std::string KapEngine::GameObject::getPrefabName ( ) const
inline

Get the Prefab Name.

Returns
std::string

◆ getScene()

SceneManagement::Scene& KapEngine::GameObject::getScene ( )
inline

Get the Scene.

Returns
SceneManagement::Scene &

◆ getSceneConst()

SceneManagement::Scene& KapEngine::GameObject::getSceneConst ( ) const
inline

Get the Scene.

Returns
SceneManagement::Scene & const

◆ getTag()

std::string KapEngine::GameObject::getTag ( ) const
inline

Get the GameObject Tag.

Returns
std::string

◆ getTransform()

KapEngine::Component & KapEngine::GameObject::getTransform ( )

Get the Transform.

Deprecated:
Returns
Component&

◆ hasComponent() [1/2]

template<typename T , typename = std::enable_if<std::is_base_of<Component, T>::value>>
bool KapEngine::GameObject::hasComponent ( ) const
inline

return if GameObject has component from its type

Template Parameters
T
typename
T>::value>
Returns
true
false

◆ hasComponent() [2/2]

bool KapEngine::GameObject::hasComponent ( std::string const &  componentName) const

return if GameObject has component from its name

Parameters
componentName
Returns
true
false
Deprecated:

◆ isActive()

bool KapEngine::GameObject::isActive ( ) const
inline

return if GameObject is active

Returns
true
false

◆ isDestroyed()

bool KapEngine::GameObject::isDestroyed ( ) const
inline

return if GameObject is destroyed

Returns
true
false

◆ removeComponent() [1/2]

void KapEngine::GameObject::removeComponent ( std::shared_ptr< Component comp)

remove component from its shared_ptr

Parameters
comp

◆ removeComponent() [2/2]

void KapEngine::GameObject::removeComponent ( std::size_t  id)

remove component from its id

Parameters
id

◆ setActive()

void KapEngine::GameObject::setActive ( bool  b)

Set the Active status of GameObject.

Parameters
b

◆ setName()

void KapEngine::GameObject::setName ( std::string const &  name)
inline

Set the Name of GameObject.

Parameters
name

◆ setTag()

void KapEngine::GameObject::setTag ( std::string const &  tag)
inline

Set the GameObject Tag.

Parameters
tag

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