Crimson Engine 1.0.0
A high-performance C++20 game engine prototype showcasing a custom ECS, Vulkan renderer, and ImGui editor.
Loading...
Searching...
No Matches
System.hpp
Go to the documentation of this file.
1#pragma once
2#include "Entity.hpp"
3#include "EntityManager.hpp"
4#include <functional>
5#include <vector>
6#include <algorithm>
7
12class System {
13public:
17 virtual ~System() = default;
18
23 virtual void update(float dt) = 0;
24
29 void addEntity(Entity e) { entities.push_back(e); }
30
36 entities.erase(std::remove(entities.begin(), entities.end(), e), entities.end());
37 }
38protected:
40 std::vector<Entity> entities;
41};
Lightweight identifier representing a game object in the Entity Component System.
Definition Entity.hpp:11
Base class for ECS systems that process sets of entities.
Definition System.hpp:12
void addEntity(Entity e)
Adds an entity to the system tracking list.
Definition System.hpp:29
void removeEntity(Entity e)
Removes an entity from system tracking.
Definition System.hpp:35
std::vector< Entity > entities
List of entities tracked by this system.
Definition System.hpp:40
virtual ~System()=default
Virtual destructor.
virtual void update(float dt)=0
Pure virtual update function to implement system behaviors.