3#include "experimental/ser/SerializerScheme.h"
4#include "spark/patterns/Composite.h"
11namespace spark::core::details
13 template <
typename Impl>
14 struct GameObjectDeleter;
20 template <
typename Impl>
24 SPARK_ALLOW_PRIVATE_SERIALIZATION
52 bool m_initialized =
false;
53 std::unordered_map<rtti::RttiBase*, std::pair<Component*, bool>> m_components;
60 template <
typename Impl>
63 inline static std::vector<AbstractGameObject<GameObject>*> objectsToDestroy;
65 static void DeleteMarkedObjects()
67 for (std::size_t i = 0; i < objectsToDestroy.size(); i++)
68 delete objectsToDestroy[i];
69 objectsToDestroy.clear();
72 void operator()(Impl* ptr,
const bool immediate)
const
78 objectsToDestroy.push_back(ptr);
81 void operator()(Impl* ptr)
const
83 operator()(ptr,
true);
88#include "spark/core/impl/AbstractGameObject.h"
A GameObject is any object in the game. It contains a list of components that provides functionality ...
Definition GameObject.h:26
A CRTP class to implement a GameObject. It is used to wrap the onSpawn, onUpdate and onDestroyed meth...
Definition AbstractGameObject.h:22
void onSpawn()
Method calling the corresponding method on the implementation, the children and components.
Definition AbstractGameObject.h:24
void onDestroyed()
Method calling the corresponding method on the implementation, the children and components.
Definition AbstractGameObject.h:50
void onUpdate(float dt)
Method calling the corresponding method on the implementation, the children and components.
Definition AbstractGameObject.h:39
Definition Composite.h:10
Deleter used to call the onDestroyed method on the implementation of a GameObject.
Definition AbstractGameObject.h:62