Sdk/Entity: Add Disable shortcut
This commit is contained in:
parent
0a5cbe656f
commit
6c8b3eb319
|
|
@ -41,6 +41,7 @@ namespace Ndk
|
||||||
|
|
||||||
const EntityHandle& Clone() const;
|
const EntityHandle& Clone() const;
|
||||||
|
|
||||||
|
inline void Disable();
|
||||||
inline void Enable(bool enable = true);
|
inline void Enable(bool enable = true);
|
||||||
|
|
||||||
inline BaseComponent& GetComponent(ComponentIndex index);
|
inline BaseComponent& GetComponent(ComponentIndex index);
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@
|
||||||
// This file is part of the "Nazara Development Kit"
|
// This file is part of the "Nazara Development Kit"
|
||||||
// For conditions of distribution and use, see copyright notice in Prerequesites.hpp
|
// For conditions of distribution and use, see copyright notice in Prerequesites.hpp
|
||||||
|
|
||||||
|
#include <NDK/Entity.hpp>
|
||||||
#include <Nazara/Core/Error.hpp>
|
#include <Nazara/Core/Error.hpp>
|
||||||
#include <Nazara/Core/StringStream.hpp>
|
#include <Nazara/Core/StringStream.hpp>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
@ -27,12 +28,21 @@ namespace Ndk
|
||||||
return static_cast<ComponentType&>(AddComponent(std::move(ptr)));
|
return static_cast<ComponentType&>(AddComponent(std::move(ptr)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief Disables the entity
|
||||||
|
*
|
||||||
|
* This is just a shortcut to Enable(false)
|
||||||
|
*/
|
||||||
|
inline void Entity::Disable()
|
||||||
|
{
|
||||||
|
Enable(false);
|
||||||
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Enables the entity
|
* \brief Enables the entity
|
||||||
*
|
*
|
||||||
* \param enable Should the entity be enabled
|
* \param enable Should the entity be enabled
|
||||||
*/
|
*/
|
||||||
|
|
||||||
inline void Entity::Enable(bool enable)
|
inline void Entity::Enable(bool enable)
|
||||||
{
|
{
|
||||||
if (m_enabled != enable)
|
if (m_enabled != enable)
|
||||||
|
|
@ -323,4 +333,4 @@ namespace std
|
||||||
return hash<Ndk::EntityId>()(id);
|
return hash<Ndk::EntityId>()(id);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue