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

@@ -19,9 +19,27 @@ namespace Ndk
return componentId;
}
template<unsigned int N>
SystemId BuildSystemId(const char (&id)[N])
{
static_assert(N-1 <= sizeof(ComponentId), "ID too long for this size of component id");
ComponentId componentId = 0;
for (int i = 0; i < N; ++i)
componentId |= static_cast<ComponentId>(id[i]) << i*8;
return componentId;
}
template<typename ComponentType>
constexpr ComponentId GetComponentId()
{
return ComponentType::ComponentId;
}
template<typename SystemType>
constexpr SystemId GetSystemId()
{
return SystemType::SystemId;
}
}