Added systems

It's now officially an ECS, yay!


Former-commit-id: e2aacaa5c9fd362921cf3d064e346d11f942bd59
This commit is contained in:
Lynix
2015-03-17 19:55:39 +01:00
parent bc40fbb02f
commit e91313b62d
14 changed files with 476 additions and 0 deletions

View File

@@ -0,0 +1,41 @@
// Copyright (C) 2015 Jérôme Leclercq
// This file is part of the "Nazara Development Kit"
// For conditions of distribution and use, see copyright notice in Prerequesites.hpp
#include <NDK/BaseSystem.hpp>
namespace Ndk
{
BaseSystem::~BaseSystem()
{
for (const EntityHandle& entity : m_entities)
entity->UnregisterSystem(m_systemId);
}
bool BaseSystem::Filters(const EntityHandle& entity) const
{
for (ComponentId component : m_requiredComponents)
{
if (!entity->HasComponent(component))
return false; // Au moins un component requis n'est pas présent
}
for (ComponentId component : m_excludedComponents)
{
if (entity->HasComponent(component))
return false; // Au moins un component exclu est présent
}
return true;
}
void BaseSystem::OnEntityAdded(const EntityHandle& entity)
{
NazaraUnused(entity);
}
void BaseSystem::OnEntityRemoved(const EntityHandle& entity)
{
NazaraUnused(entity);
}
}