Renamed BaseComponent to ECS::Component, removed enabled, renamed Position to Base

This commit is contained in:
2026-01-30 17:32:16 +02:00
parent 16c1a2c620
commit ff062567d8
4 changed files with 17 additions and 59 deletions

View File

@@ -26,12 +26,7 @@ void World::preSystems() {
}
void World::postSystems() {
// Can't do a foreach with a std::stack
while (!entitiesToDisable.empty()) {
std::pair<Components::Enabled *, bool> &request = entitiesToDisable.top();
request.first->enabled = request.second;
entitiesToDisable.pop();
}
// Defined for future use
}
// Entities
@@ -39,18 +34,12 @@ Entity World::CreateEntity() {
auto newEntity = Random::GenerateUUID();
// Default components
entityComponentMap.insert(newEntity, typeid(Components::Position),
Components::Position());
entityComponentMap.insert(newEntity, typeid(Components::Enabled),
Components::Enabled(this));
entityComponentMap.insert(newEntity, typeid(Components::Base),
Components::Base());
return newEntity;
}
const Components::Enabled &World::EntityEnable(const Entity &entity) noexcept {
return this->GetComponent<Components::Enabled>(entity);
}
bool World::EntityExists(const Entity &entity) noexcept {
bool exists = false;
entityComponentMap.scan(