Improvement to coordinate system
- Flip coordinate system for SwapChain passthrough - Normalize MouseMoveEvent coordination - Add RemoveSystem to Ecs
This commit is contained in:
@@ -33,6 +33,12 @@ namespace Copium
|
||||
return systemPool->AddSystem(typeid(SystemClass), new SystemClass{args...});
|
||||
}
|
||||
|
||||
template <typename SystemClass>
|
||||
void RemoveSystem()
|
||||
{
|
||||
systemPool->MoveSystemBefore(typeid(SystemClass));
|
||||
}
|
||||
|
||||
void UpdateSystems();
|
||||
void UpdateSystems(const Signal& signal);
|
||||
|
||||
|
||||
@@ -19,11 +19,27 @@ namespace Copium
|
||||
SystemOrderer SystemPool::AddSystem(const std::type_index& systemId, SystemBase* system)
|
||||
{
|
||||
system->manager = manager;
|
||||
CP_ASSERT(systems.find(systemId) == systems.end(), "System already exist in Ecs");
|
||||
systems.emplace(systemId, system);
|
||||
systemOrder.emplace_back(system);
|
||||
return SystemOrderer{systemId, this};
|
||||
}
|
||||
|
||||
void SystemPool::RemoveSystem(const std::type_index& systemId)
|
||||
{
|
||||
auto it = systems.find(systemId);
|
||||
if (it == systems.end())
|
||||
{
|
||||
CP_WARN("System does not exist in Ecs");
|
||||
return;
|
||||
}
|
||||
|
||||
auto itOrder = std::find(systemOrder.begin(), systemOrder.end(), it->second);
|
||||
delete it->second;
|
||||
systems.erase(it);
|
||||
systemOrder.erase(itOrder);
|
||||
}
|
||||
|
||||
void SystemPool::Update()
|
||||
{
|
||||
for (auto& system : systemOrder)
|
||||
|
||||
@@ -24,7 +24,9 @@ namespace Copium
|
||||
public:
|
||||
SystemPool(ECSManager* manager);
|
||||
~SystemPool();
|
||||
|
||||
SystemOrderer AddSystem(const std::type_index& systemId, SystemBase* system);
|
||||
void RemoveSystem(const std::type_index& systemId);
|
||||
void Update();
|
||||
void Update(const Signal& signal);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user