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
This commit is contained in:
Thraix
2026-02-07 18:25:13 +01:00
parent e5866b2dcb
commit 9d5a5314a7
23 changed files with 729 additions and 245 deletions
+21 -10
View File
@@ -1,6 +1,7 @@
#pragma once
#include <typeindex>
#include <vector>
namespace Copium
{
@@ -8,27 +9,37 @@ namespace Copium
class SystemOrderer
{
private:
std::type_index systemId;
SystemPool* systemPool = nullptr;
public:
SystemOrderer(std::type_index systemId, SystemPool* systemPool);
template <typename Other>
template <typename System>
void Before()
{
Before(typeid(Other));
orderQueue.emplace_back(OrderOperation::Before, typeid(System));
}
template <typename Other>
template <typename System>
void After()
{
After(typeid(Other));
orderQueue.emplace_back(OrderOperation::After, typeid(System));
}
private:
void Before(const std::type_index& otherSystemId);
void After(const std::type_index& otherSystemId);
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);
};
}