32#include "nlohmann/json.hpp"
52 static size_t typeId = nextId++;
92 auto it = m_creators.find(name);
93 if (it != m_creators.end())
95 return it->second->CreateComponent();
102 std::unordered_map<std::string, std::unique_ptr<ComponentCreatorBase>> m_creators;
105#define COMPONENT(ComponentClass) \
107 static size_t TypeId() \
109 return mnd::Component::StaticTypeId<ComponentClass>(); \
111 size_t GetTypeId() const override \
115 static void Register() \
117 mnd::ComponentFactory::GetInstance().RegisterComponent<ComponentClass>(std::string(#ComponentClass)); \
Engine-wide primitive type aliases and GLM math imports.
virtual Component * CreateComponent()=0
virtual ~ComponentCreatorBase()=default
Component * CreateComponent() override
void RegisterComponent(const std::string &name)
static ComponentFactory & GetInstance()
Component * CreateComponent(const std::string &name)
virtual void Update(f32 deltaTime)=0
virtual ~Component()=default
static size_t StaticTypeId()
virtual void LoadProperties(const nlohmann::json &json)
virtual size_t GetTypeId() const =0
Node in the scene graph: a named transform that owns components and children.
float f32
32-bit IEEE float — the standard GL scalar type.