Ndk/Components: Added OnComponent[Attached|Detacted] events
And m_entity member variable Former-commit-id: d6bd9e382e55bafd357e7ec62862ae731c21f897
This commit is contained in:
@@ -14,8 +14,11 @@
|
||||
|
||||
namespace Ndk
|
||||
{
|
||||
class Entity;
|
||||
|
||||
class NDK_API BaseComponent
|
||||
{
|
||||
friend Entity;
|
||||
friend class Sdk;
|
||||
|
||||
public:
|
||||
@@ -35,10 +38,15 @@ namespace Ndk
|
||||
|
||||
protected:
|
||||
ComponentIndex m_componentIndex;
|
||||
Entity* m_entity;
|
||||
|
||||
static ComponentIndex RegisterComponent(ComponentId id, Factory factoryFunc);
|
||||
|
||||
private:
|
||||
virtual void OnComponentAttached(BaseComponent& component);
|
||||
virtual void OnComponentDetached(BaseComponent& component);
|
||||
void SetEntity(Entity* entity);
|
||||
|
||||
static bool Initialize();
|
||||
static void Uninitialize();
|
||||
|
||||
|
||||
@@ -7,7 +7,8 @@
|
||||
namespace Ndk
|
||||
{
|
||||
inline BaseComponent::BaseComponent(ComponentIndex index) :
|
||||
m_componentIndex(index)
|
||||
m_componentIndex(index),
|
||||
m_entity(nullptr)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -35,6 +36,11 @@ namespace Ndk
|
||||
return index;
|
||||
}
|
||||
|
||||
inline void BaseComponent::SetEntity(Entity* entity)
|
||||
{
|
||||
m_entity = entity;
|
||||
}
|
||||
|
||||
inline bool BaseComponent::Initialize()
|
||||
{
|
||||
// Rien à faire
|
||||
|
||||
Reference in New Issue
Block a user