diff --git a/ChangeLog.md b/ChangeLog.md index 09aec3d4f..ba3b40b55 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -269,6 +269,7 @@ Nazara Development Kit: - Added TextAreaWidget support for outline - Fixed possible crash when disabling BaseWidget background - Added BaseWidget::OnMouseWheelMoved +- Added Entity::OnEntity[Disabled|Enabled] signals # 0.4: diff --git a/SDK/include/NDK/Entity.hpp b/SDK/include/NDK/Entity.hpp index 43a4a43c7..e09f4eac4 100644 --- a/SDK/include/NDK/Entity.hpp +++ b/SDK/include/NDK/Entity.hpp @@ -74,6 +74,8 @@ namespace Ndk Entity& operator=(Entity&&) = delete; NazaraSignal(OnEntityDestruction, Entity* /*entity*/); + NazaraSignal(OnEntityDisabled, Entity* /*entity*/); + NazaraSignal(OnEntityEnabled, Entity* /*entity*/); private: Entity(World* world, EntityId id); diff --git a/SDK/src/NDK/Entity.cpp b/SDK/src/NDK/Entity.cpp index 7bc81982d..4e211f0db 100644 --- a/SDK/src/NDK/Entity.cpp +++ b/SDK/src/NDK/Entity.cpp @@ -111,11 +111,15 @@ namespace Ndk { for (std::size_t i = m_componentBits.FindFirst(); i != m_componentBits.npos; i = m_componentBits.FindNext(i)) m_components[i]->OnEntityEnabled(); + + OnEntityEnabled(this); } else { for (std::size_t i = m_componentBits.FindFirst(); i != m_componentBits.npos; i = m_componentBits.FindNext(i)) m_components[i]->OnEntityDisabled(); + + OnEntityDisabled(this); } Invalidate();