Sdk/Entity: Add Disable shortcut

This commit is contained in:
Jérôme Leclercq 2017-11-23 13:22:38 +01:00
parent 0a5cbe656f
commit 6c8b3eb319
2 changed files with 13 additions and 2 deletions

View File

@ -41,6 +41,7 @@ namespace Ndk
const EntityHandle& Clone() const;
inline void Disable();
inline void Enable(bool enable = true);
inline BaseComponent& GetComponent(ComponentIndex index);

View File

@ -2,6 +2,7 @@
// This file is part of the "Nazara Development Kit"
// For conditions of distribution and use, see copyright notice in Prerequesites.hpp
#include <NDK/Entity.hpp>
#include <Nazara/Core/Error.hpp>
#include <Nazara/Core/StringStream.hpp>
#include <algorithm>
@ -27,12 +28,21 @@ namespace Ndk
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
*
* \param enable Should the entity be enabled
*/
inline void Entity::Enable(bool enable)
{
if (m_enabled != enable)