R-Type
R-Type project
KapEngine::Component Class Reference
Inheritance diagram for KapEngine::Component:
KapEngine::IComponent KapEngine::Animation KapEngine::Animator KapEngine::Camera KapEngine::Collider KapEngine::MouseDetector KapEngine::Transform KapEngine::UI::Button KapEngine::UI::Canvas KapEngine::UI::Image KapEngine::UI::Inputfield KapEngine::UI::Text KapMirror::Experimental::NetworkStatistics KapMirror::NetworkComponent KapMirror::NetworkIdentity KapMirror::NetworkManager RType::CampaignGenerator RType::ChangeKey RType::ConvertEnum RType::KeySelector RType::MapManager RType::MenuCampaignSelector RType::MenuVolume RType::NetStatViewer RType::UpdateStartGameKeys

Public Member Functions

 Component (std::shared_ptr< GameObject > &go, std::string const &name)
 
 Component (GameObject &go, std::string const &name)
 
void __update (bool runDisplay=true)
 function call by KapEngine to update your component More...
 
bool __setId (std::size_t i)
 function call by KapEngine to init your component More...
 
GameObjectgetGameObject () const
 Get the Game Object object. More...
 
std::size_t getGameObjectId () const
 
virtual void onInit () override
 call on component init More...
 
virtual void onAwake () override
 call component awake More...
 
virtual void onStart () override
 call component start More...
 
virtual void onUpdate () override
 call each frame
 
virtual void onFixedUpdate () override
 call eachv x ms More...
 
virtual void onDisplay () override
 use to display some things this function is call after all updates fucntion
 
virtual void onTriggerEnter (std::shared_ptr< GameObject > go) override
 something enter in object More...
 
virtual void onTriggerStay (std::shared_ptr< GameObject > go) override
 something stay in object More...
 
virtual void onTriggerExit (std::shared_ptr< GameObject > go) override
 something out of object More...
 
virtual void onMouseEnter () override
 called when mouse enter object More...
 
virtual void onMouseStay () override
 called when mouse stay on object More...
 
virtual void onMouseExit () override
 called when mouse leave object More...
 
virtual bool checkComponentValidity () override
 Check you component is runnable With this function you can add some conditions to make your component runnable or not. More...
 
virtual void onGameQuit () override
 call when game is turn off More...
 
virtual void onDestroy () override
 call when component destroyed More...
 
virtual void onDisable () override
 call when GameObject is disable after being enable More...
 
virtual void onEnable () override
 call when GameObject is enable after being disable More...
 
virtual void onSceneUpdated () override
 call when scene is updated (not threaded) More...
 
virtual void onSceneGonnaUpdated () override
 call when scene will update (not threaded) More...
 
virtual void onSceneChanged () override
 call when scene is changed More...
 
std::size_t getLevel () const
 Get the Level component. More...
 
void setLevel (std::size_t lvl)
 Set the Level object. More...
 
bool isEnable () const
 return if component is enable More...
 
bool isDisable () const
 return if component is disbale More...
 
void setActive (bool b)
 Set the active status of component if true : component is active else component is disable. More...
 
std::string getName () const
 Get the component name. More...
 
void __engineStop ()
 
int getThreadRunning () const
 Get the Thread Running index index of thread component. More...
 
Events::Input getInput ()
 Get input events. More...
 
Events::Mouse getMouse ()
 Get mouse events. More...
 
void addRequireComponent (std::string const &componentName)
 Add require component If your component need another component to work, you can add it's name with this function. Without the component require this component cannot run. More...
 
void __fixedUpdate ()
 
void __awake ()
 check awake validity More...
 
TransformgetTransform ()
 Get the Transform component. More...
 
std::size_t getId () const
 Get the Id of component. More...
 
void __setPhysics (bool b)
 set if it is a physic component if component is a physic component then it will be updated in physic thread if engine is threaded More...
 
bool __isPhysics () const
 check if component is a physic component More...
 
void __sceneChanged ()
 
SceneManagement::ScenegetScene () const
 
KEnginegetEngine () const
 

Protected Attributes

std::string _name
 Component name.
 

Member Function Documentation

◆ __awake()

void KapEngine::Component::__awake ( )

check awake validity

Warning
Do not call by your selves. KapEngine will call it itself

◆ __engineStop()

void KapEngine::Component::__engineStop ( )
inline
Warning
Do not call this fucntion. Engine will do

◆ __fixedUpdate()

void KapEngine::Component::__fixedUpdate ( )
Warning
Do not touch or call this function. Your game can be destruct by modifications

◆ __isPhysics()

bool KapEngine::Component::__isPhysics ( ) const
inline

check if component is a physic component

Returns
true
false

◆ __setId()

bool KapEngine::Component::__setId ( std::size_t  i)
inline

function call by KapEngine to init your component

Warning
Do not call this function

◆ __setPhysics()

void KapEngine::Component::__setPhysics ( bool  b)
inline

set if it is a physic component if component is a physic component then it will be updated in physic thread if engine is threaded

Parameters
b

◆ __update()

void KapEngine::Component::__update ( bool  runDisplay = true)

function call by KapEngine to update your component

Warning
Do not call this function

◆ addRequireComponent()

void KapEngine::Component::addRequireComponent ( std::string const &  componentName)
inline

Add require component If your component need another component to work, you can add it's name with this function. Without the component require this component cannot run.

Parameters
componentName

◆ checkComponentValidity()

virtual bool KapEngine::Component::checkComponentValidity ( )
inlineoverridevirtual

Check you component is runnable With this function you can add some conditions to make your component runnable or not.

Returns
true if your component is runnable
false if your component is not runnable

Implements KapEngine::IComponent.

Reimplemented in KapEngine::UI::Text, KapEngine::UI::Canvas, and KapEngine::UI::Image.

◆ getGameObject()

GameObject & KapEngine::Component::getGameObject ( ) const

Get the Game Object object.

Exceptions
KapEngine::Errors::ComponentErrorif the object does not exist in scene
Returns
KapEngine::GameObject &

◆ getId()

std::size_t KapEngine::Component::getId ( ) const
inline

Get the Id of component.

Returns
std::size_t

◆ getInput()

KapEngine::Events::Input KapEngine::Component::getInput ( )

Get input events.

Returns
KapEngine::Events::Input

◆ getLevel()

std::size_t KapEngine::Component::getLevel ( ) const
inline

Get the Level component.

the level gives call priority to the component. The higher the level, the sooner it will be updated

Returns
std::size_t

◆ getMouse()

KapEngine::Events::Mouse KapEngine::Component::getMouse ( )

Get mouse events.

Returns
KapEngine::Events::Mouse

◆ getName()

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

Get the component name.

Returns
std::string

◆ getThreadRunning()

int KapEngine::Component::getThreadRunning ( ) const
inline

Get the Thread Running index index of thread component.

Returns
int

◆ getTransform()

KapEngine::Transform & KapEngine::Component::getTransform ( )

Get the Transform component.

Returns
KapEngine::Transform&

◆ isDisable()

bool KapEngine::Component::isDisable ( ) const
inline

return if component is disbale

Returns
true
false

◆ isEnable()

bool KapEngine::Component::isEnable ( ) const
inline

return if component is enable

Returns
true
false

◆ onAwake()

virtual void KapEngine::Component::onAwake ( )
inlineoverridevirtual

call component awake

will be called at runtime when the scene is first loaded or when another scene has been loaded before.

Implements KapEngine::IComponent.

Reimplemented in KapEngine::UI::Text, RType::NetStatViewer, KapEngine::UI::Image, RType::MenuCampaignSelector, KapMirror::NetworkManager, RType::CampaignGenerator, KapEngine::Transform, RType::ConvertEnum, RType::ChangeKey, KapMirror::NetworkComponent, and RType::MenuVolume.

◆ onDestroy()

virtual void KapEngine::Component::onDestroy ( )
inlineoverridevirtual

call when component destroyed

Implements KapEngine::IComponent.

Reimplemented in KapMirror::Experimental::NetworkStatistics, and KapMirror::NetworkComponent.

◆ onDisable()

virtual void KapEngine::Component::onDisable ( )
inlineoverridevirtual

call when GameObject is disable after being enable

Implements KapEngine::IComponent.

◆ onEnable()

virtual void KapEngine::Component::onEnable ( )
inlineoverridevirtual

call when GameObject is enable after being disable

Implements KapEngine::IComponent.

◆ onFixedUpdate()

◆ onGameQuit()

virtual void KapEngine::Component::onGameQuit ( )
inlineoverridevirtual

call when game is turn off

Implements KapEngine::IComponent.

◆ onInit()

virtual void KapEngine::Component::onInit ( )
inlineoverridevirtual

call on component init

will be called during the component creation process. Be advised that some engine features cannot be used in this function.

Deprecated:

Implements KapEngine::IComponent.

◆ onMouseEnter()

virtual void KapEngine::Component::onMouseEnter ( )
inlineoverridevirtual

called when mouse enter object

Implements KapEngine::IComponent.

Reimplemented in KapEngine::UI::Inputfield, and KapEngine::UI::Button.

◆ onMouseExit()

virtual void KapEngine::Component::onMouseExit ( )
inlineoverridevirtual

called when mouse leave object

Implements KapEngine::IComponent.

Reimplemented in KapEngine::UI::Inputfield, and KapEngine::UI::Button.

◆ onMouseStay()

virtual void KapEngine::Component::onMouseStay ( )
inlineoverridevirtual

called when mouse stay on object

Implements KapEngine::IComponent.

Reimplemented in KapEngine::UI::Inputfield, and KapEngine::UI::Button.

◆ onSceneChanged()

virtual void KapEngine::Component::onSceneChanged ( )
inlineoverridevirtual

call when scene is changed

Implements KapEngine::IComponent.

◆ onSceneGonnaUpdated()

virtual void KapEngine::Component::onSceneGonnaUpdated ( )
inlineoverridevirtual

call when scene will update (not threaded)

Implements KapEngine::IComponent.

◆ onSceneUpdated()

virtual void KapEngine::Component::onSceneUpdated ( )
inlineoverridevirtual

call when scene is updated (not threaded)

Implements KapEngine::IComponent.

Reimplemented in RType::EnemyController, and KapEngine::Collider.

◆ onStart()

virtual void KapEngine::Component::onStart ( )
inlineoverridevirtual

call component start

will be called when the scene is loaded or when its KapEngine::GameObject is active after it is disabled

Implements KapEngine::IComponent.

Reimplemented in KapEngine::Animator, KapMirror::Experimental::NetworkStatistics, RType::PlayerController, RType::Bullet, RType::LobbyMenuManager, RType::GameMenuManager, RType::RtypeNetworkManager, and RType::PlayerSkin.

◆ onTriggerEnter()

virtual void KapEngine::Component::onTriggerEnter ( std::shared_ptr< GameObject go)
inlineoverridevirtual

something enter in object

Implements KapEngine::IComponent.

Reimplemented in RType::PlayerController, and RType::EnemyController.

◆ onTriggerExit()

virtual void KapEngine::Component::onTriggerExit ( std::shared_ptr< GameObject go)
inlineoverridevirtual

something out of object

Implements KapEngine::IComponent.

◆ onTriggerStay()

virtual void KapEngine::Component::onTriggerStay ( std::shared_ptr< GameObject go)
inlineoverridevirtual

something stay in object

Implements KapEngine::IComponent.

◆ setActive()

void KapEngine::Component::setActive ( bool  b)
inline

Set the active status of component if true : component is active else component is disable.

Parameters
b

◆ setLevel()

void KapEngine::Component::setLevel ( std::size_t  lvl)
inline

Set the Level object.

the level gives call priority to the component. The higher the level, the sooner it will be updated

Parameters
lvl

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