11 #include "GameObject.hpp"
12 #include "IComponent.hpp"
15 #include "Profiler/KapProfiler.hpp"
27 namespace SceneManagement {
40 Component(std::shared_ptr<GameObject> &go, std::string
const& name);
48 void __update(
bool runDisplay =
true);
55 PROFILER_FUNC_START();
72 std::size_t getGameObjectId()
const;
112 PROFILER_FUNC_START();
124 PROFILER_FUNC_START();
136 PROFILER_FUNC_START();
148 PROFILER_FUNC_START();
159 PROFILER_FUNC_START();
176 PROFILER_FUNC_START();
186 PROFILER_FUNC_START();
188 return threadRunning;
208 PROFILER_FUNC_START();
209 _componentsNeeded.push_back(componentName);
237 PROFILER_FUNC_START();
249 PROFILER_FUNC_START();
264 void __sceneChanged() {
265 PROFILER_FUNC_START();
272 SceneManagement::Scene &getScene()
const {
273 PROFILER_FUNC_START();
278 KEngine &getEngine()
const {
279 PROFILER_FUNC_START();
290 bool _physics =
false;
291 int threadRunning = 2;
293 std::size_t _level = 0;
295 bool _awakeDone =
false;
296 bool _startDone =
false;
298 std::vector<std::string> _componentsNeeded;
303 bool __checkValidity();
void __fixedUpdate()
Definition: Component.cpp:102
virtual void onTriggerEnter(std::shared_ptr< GameObject > go) override
something enter in object
Definition: Component.hpp:83
bool isDisable() const
return if component is disbale
Definition: Component.hpp:147
virtual void onTriggerStay(std::shared_ptr< GameObject > go) override
something stay in object
Definition: Component.hpp:84
std::string _name
Component name.
Definition: Component.hpp:288
virtual void onSceneChanged() override
call when scene is changed
Definition: Component.hpp:102
std::size_t getId() const
Get the Id of component.
Definition: Component.hpp:236
virtual void onAwake() override
call component awake
Definition: Component.hpp:76
int getThreadRunning() const
Get the Thread Running index index of thread component.
Definition: Component.hpp:185
virtual void onDisable() override
call when GameObject is disable after being enable
Definition: Component.hpp:97
void __setPhysics(bool b)
set if it is a physic component if component is a physic component then it will be updated in physic ...
Definition: Component.hpp:248
GameObject & getGameObject() const
Get the Game Object object.
Definition: Component.cpp:35
Definition: IComponent.hpp:19
bool __isPhysics() const
check if component is a physic component
Definition: Component.hpp:260
bool isEnable() const
return if component is enable
Definition: Component.hpp:135
virtual void onSceneGonnaUpdated() override
call when scene will update (not threaded)
Definition: Component.hpp:101
Definition: GameObject.hpp:40
std::size_t getLevel() const
Get the Level component.
Definition: Component.hpp:111
std::string getName() const
Get the component name.
Definition: Component.hpp:168
Events::Mouse getMouse()
Get mouse events.
Definition: Component.cpp:115
void __update(bool runDisplay=true)
function call by KapEngine to update your component
Definition: Component.cpp:43
Events::Input getInput()
Get input events.
Definition: Component.cpp:109
virtual void onMouseStay() override
called when mouse stay on object
Definition: Component.hpp:88
virtual void onMouseExit() override
called when mouse leave object
Definition: Component.hpp:89
virtual void onStart() override
call component start
Definition: Component.hpp:77
virtual void onMouseEnter() override
called when mouse enter object
Definition: Component.hpp:87
void __awake()
check awake validity
Definition: Component.cpp:75
virtual void onDisplay() override
use to display some things this function is call after all updates fucntion
Definition: Component.hpp:81
virtual void onUpdate() override
call each frame
Definition: Component.hpp:78
void addRequireComponent(std::string const &componentName)
Add require component If your component need another component to work, you can add it's name with th...
Definition: Component.hpp:207
Definition: Component.hpp:38
bool __setId(std::size_t i)
function call by KapEngine to init your component
Definition: Component.hpp:54
void __engineStop()
Definition: Component.hpp:175
void setLevel(std::size_t lvl)
Set the Level object.
Definition: Component.hpp:123
virtual void onEnable() override
call when GameObject is enable after being disable
Definition: Component.hpp:98
main namespace
Definition: Component.hpp:17
virtual void onFixedUpdate() override
call eachv x ms
Definition: Component.hpp:79
virtual void onDestroy() override
call when component destroyed
Definition: Component.hpp:96
virtual void onGameQuit() override
call when game is turn off
Definition: Component.hpp:95
virtual void onTriggerExit(std::shared_ptr< GameObject > go) override
something out of object
Definition: Component.hpp:85
virtual bool checkComponentValidity() override
Check you component is runnable With this function you can add some conditions to make your component...
Definition: Component.hpp:91
Transform & getTransform()
Get the Transform component.
Definition: Component.cpp:156
void setActive(bool b)
Set the active status of component if true : component is active else component is disable.
Definition: Component.hpp:158
virtual void onSceneUpdated() override
call when scene is updated (not threaded)
Definition: Component.hpp:100
virtual void onInit() override
call on component init
Definition: Component.hpp:75
Class of engine.
Definition: Engine.hpp:60