Files
Copium/CopiumEngine/src/copium/ecs/SystemOrderer.cpp
T
Thraix 9d5a5314a7 Rework ECS framework
- Add queue systems when adding/removing components and systems
- Add GlobalData to ECSManager, used to store data that is not specific
  to entities
- Add View class, used to for loop all entities that contains the given
  Components
- Rework how signaling works
2026-02-07 18:25:13 +01:00

44 lines
926 B
C++

#include "copium/ecs/SystemOrderer.h"
#include "copium/ecs/SystemPool.h"
namespace Copium
{
SystemOrderer::SystemOrderer(std::type_index systemId, SystemPool* systemPool)
: systemId{systemId},
systemPool{systemPool}
{
}
void SystemOrderer::CommitOrdering()
{
for (const auto& [orderOperation, systemId] : orderQueue)
{
switch (orderOperation)
{
case OrderOperation::Before:
{
CommitBefore(systemId);
break;
}
case OrderOperation::After:
{
CommitAfter(systemId);
break;
}
}
}
orderQueue.clear();
}
void SystemOrderer::CommitBefore(const std::type_index& otherSystemId)
{
systemPool->MoveSystemBefore(systemId, otherSystemId);
}
void SystemOrderer::CommitAfter(const std::type_index& otherSystemId)
{
systemPool->MoveSystemAfter(systemId, otherSystemId);
}
}