173 systems_.push_back(std::move(system));
189 template<
typename T,
typename... Args>
205 for (
auto& system : systems_) {
206 system->init(registry);
219 for (
auto& system : systems_) {
220 if (system->isEnabled()) {
221 system->update(world);
234 for (
auto& system : systems_) {
235 system->shutdown(registry);
244 std::sort(systems_.begin(), systems_.end(),
246 return a->getPriority() < b->getPriority();
251 std::vector<Unique<System>> systems_;
Core type definitions and utilities for ESEngine.
Unified context passed to all ECS systems.
Central container for all entities and components.
Container for organizing and executing systems.
void update(World &world)
Updates all enabled systems.
T & createSystem(Args &&... args)
Creates and adds a system to the group.
void addSystem(Unique< System > system)
Adds an existing system to the group.
void shutdown(Registry ®istry)
Shuts down all systems.
void init(Registry ®istry)
Initializes all systems in the group.
Base class for all ECS systems.
virtual void shutdown(Registry ®istry)
Called once when the system is removed.
void setEnabled(bool enabled)
Enables or disables the system.
virtual void update(World &world)=0
Called every frame to execute system logic.
i32 getPriority() const
Gets the system's execution priority.
i32 priority_
Execution priority (lower = earlier).
virtual void init(Registry ®istry)
Called once when the system is added to a group.
bool isEnabled() const
Checks if the system is enabled.
virtual ~System()=default
Virtual destructor for proper cleanup.
void setPriority(i32 priority)
Sets the system's execution priority.
bool enabled_
Whether the system is enabled.
constexpr Unique< T > makeUnique(Args &&... args)
Creates a Unique pointer with the given arguments.
std::int32_t i32
Signed 32-bit integer.
std::unique_ptr< T > Unique
Unique ownership smart pointer.
Context passed to every System::update call.