|
Engine
Raylib based game framework
|
Manages execution order and lifetime of systems. More...
#include <SystemManager.hpp>
Public Member Functions | |
| SystemManager (const SystemManager &)=delete | |
| SystemManager & | operator= (const SystemManager &)=delete |
| template<typename SystemT, typename... Args> | |
| std::shared_ptr< SystemT > | AddSystem (const u32 priority=1, Args &&... args) |
| Constructs a system and adds it to the manager. | |
| template<typename SystemT> | |
| void | RemoveSystem () |
| Removes a system from the manager. | |
| template<typename SystemT> | |
| std::shared_ptr< SystemT > | GetSystem () |
| Returns a shared pointer to a managed system. | |
| void | ClearSystems () |
| Removes and destroys all managed systems. | |
Friends | |
| class | Engine |
Manages execution order and lifetime of systems.
Systems are updated and drawn in ascending priority order. Lower priority values execute first. Systems update and draw before scenes each frame.
|
inline |
Constructs a system and adds it to the manager.
The system is owned by the manager. Systems are sorted by priority immediately after insertion.
| SystemT | System type (must derive from the System base class) |
| Args | System constructor argument types |
| priority | Execution priority — lower values run first (default 1) |
| args | Arguments forwarded to the system constructor |
Usage:
| void SystemManager::ClearSystems | ( | ) |
Removes and destroys all managed systems.
Called by the Engine destructor.
|
inline |
Returns a shared pointer to a managed system.
Returns an empty pointer if no system of this type has been added.
| SystemT | System type to retrieve |
|
inline |
Removes a system from the manager.
The system is destroyed when no more shared_ptrs to it remain. Does nothing if the system is not currently managed.
| SystemT | System type to remove |