Crimson Engine
1.0.0
A high-performance C++20 game engine prototype showcasing a custom ECS, Vulkan renderer, and ImGui editor.
Toggle main menu visibility
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
12
class
System
{
13
public
:
17
virtual
~System
() =
default
;
18
23
virtual
void
update
(
float
dt) = 0;
24
29
void
addEntity
(
Entity
e) {
entities
.push_back(e); }
30
35
void
removeEntity
(
Entity
e) {
36
entities
.erase(std::remove(
entities
.begin(),
entities
.end(), e),
entities
.end());
37
}
38
protected
:
40
std::vector<Entity>
entities
;
41
};
Entity.hpp
EntityManager.hpp
Entity
Lightweight identifier representing a game object in the Entity Component System.
Definition
Entity.hpp:11
System
Base class for ECS systems that process sets of entities.
Definition
System.hpp:12
System::addEntity
void addEntity(Entity e)
Adds an entity to the system tracking list.
Definition
System.hpp:29
System::removeEntity
void removeEntity(Entity e)
Removes an entity from system tracking.
Definition
System.hpp:35
System::entities
std::vector< Entity > entities
List of entities tracked by this system.
Definition
System.hpp:40
System::~System
virtual ~System()=default
Virtual destructor.
System::update
virtual void update(float dt)=0
Pure virtual update function to implement system behaviors.
engine
include
ecs
System.hpp
Generated by
1.17.0