Files
Copium/CopiumEngine/src/copium/ecs/SystemOrderer.h
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

46 lines
882 B
C++

#pragma once
#include <typeindex>
#include <vector>
namespace Copium
{
class SystemPool;
class SystemOrderer
{
public:
SystemOrderer(std::type_index systemId, SystemPool* systemPool);
template <typename System>
void Before()
{
orderQueue.emplace_back(OrderOperation::Before, typeid(System));
}
template <typename System>
void After()
{
orderQueue.emplace_back(OrderOperation::After, typeid(System));
}
private:
enum class OrderOperation
{
Before,
After
};
std::type_index systemId;
SystemPool* systemPool = nullptr;
std::vector<std::pair<OrderOperation, std::type_index>> orderQueue;
private:
friend class SystemPool;
void CommitOrdering();
void CommitBefore(const std::type_index& otherSystemId);
void CommitAfter(const std::type_index& otherSystemId);
};
}