Estella 0.113.0
A fast 2D and 3D game engine powered by WebAssembly and ECS
Loading...
Searching...
No Matches
esengine::ecs::SystemGroup Class Reference

Container for organizing and executing systems. More...

#include <System.hpp>

Public Member Functions

void addSystem (Unique< System > system)
 Adds an existing system to the group.
template<typename T, typename... Args>
T & createSystem (Args &&... args)
 Creates and adds a system to the group.
void init (Registry &registry)
 Initializes all systems in the group.
void update (World &world)
 Updates all enabled systems.
void shutdown (Registry &registry)
 Shuts down all systems.

Detailed Description

Container for organizing and executing systems.

Manages a collection of systems, executing them in priority order during update. Systems with lower priority values execute first.

SystemGroup systems;
// Create systems with different priorities
auto& physics = systems.createSystem<PhysicsSystem>();
physics.setPriority(0); // Runs first
auto& render = systems.createSystem<RenderSystem>();
render.setPriority(100); // Runs last
// In game loop:
systems.init(registry);
while (running) {
systems.update(registry, deltaTime);
}
systems.shutdown(registry);
Container for organizing and executing systems.
Definition System.hpp:163
void update(World &world)
Updates all enabled systems.
Definition System.hpp:218
T & createSystem(Args &&... args)
Creates and adds a system to the group.
Definition System.hpp:190
void shutdown(Registry &registry)
Shuts down all systems.
Definition System.hpp:233
void init(Registry &registry)
Initializes all systems in the group.
Definition System.hpp:204

Definition at line 163 of file System.hpp.

Member Function Documentation

◆ addSystem()

void esengine::ecs::SystemGroup::addSystem ( Unique< System > system)
inline

Adds an existing system to the group.

Parameters
systemUnique pointer to the system (ownership transferred)

The group takes ownership of the system. Systems are automatically sorted by priority after adding.

Definition at line 172 of file System.hpp.

Referenced by createSystem().

◆ createSystem()

template<typename T, typename... Args>
T & esengine::ecs::SystemGroup::createSystem ( Args &&... args)
inline

Creates and adds a system to the group.

Template Parameters
TThe system type to create
ArgsConstructor argument types
Parameters
argsArguments forwarded to T's constructor
Returns
Reference to the created system
auto& mySystem = group.createSystem<MySystem>(arg1, arg2);
mySystem.setPriority(10);

Definition at line 190 of file System.hpp.

References addSystem(), and esengine::makeUnique().

◆ init()

void esengine::ecs::SystemGroup::init ( Registry & registry)
inline

Initializes all systems in the group.

Parameters
registryReference to the ECS registry

Calls init() on each system in priority order. Should be called once before the main loop.

Definition at line 204 of file System.hpp.

◆ shutdown()

void esengine::ecs::SystemGroup::shutdown ( Registry & registry)
inline

Shuts down all systems.

Parameters
registryReference to the ECS registry

Calls shutdown() on each system in priority order. Should be called once after the main loop.

Definition at line 233 of file System.hpp.

◆ update()

void esengine::ecs::SystemGroup::update ( World & world)
inline

Updates all enabled systems.

Parameters
registryReference to the ECS registry
deltaTimeTime since last frame in seconds

Calls update() on each enabled system in priority order. Disabled systems are skipped.

Definition at line 218 of file System.hpp.


The documentation for this class was generated from the following file:
  • /home/runner/work/estella/estella/src/esengine/ecs/System.hpp