Ndk/Algorithm: Added Is[Component|System] function
Former-commit-id: 946f5081cea0b8df7faf0e95cfea2a3e5dd9f7bb
This commit is contained in:
@@ -3,6 +3,8 @@
|
||||
// For conditions of distribution and use, see copyright notice in Prerequesites.hpp
|
||||
|
||||
#include <Nazara/Core/Endianness.hpp>
|
||||
#include <Ndk/BaseComponent.hpp>
|
||||
#include <Ndk/BaseSystem.hpp>
|
||||
|
||||
namespace Ndk
|
||||
{
|
||||
@@ -44,4 +46,16 @@ namespace Ndk
|
||||
SystemType::systemIndex = SystemType::RegisterSystem();
|
||||
return SystemType::systemIndex;
|
||||
}
|
||||
|
||||
template<typename ComponentType>
|
||||
bool IsComponent(BaseComponent& component)
|
||||
{
|
||||
return component.GetIndex() == GetComponentIndex<ComponentType>();
|
||||
}
|
||||
|
||||
template<typename SystemType>
|
||||
bool IsSystem(BaseSystem& system)
|
||||
{
|
||||
return system.GetIndex() == GetSystemIndex<SystemType>();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user