Engine
Raylib based game framework
Loading...
Searching...
No Matches
Public Member Functions | List of all members
SystemManager Class Reference

Manages execution and order of systems. More...

#include <SystemManager.h>

Public Member Functions

void Update (const float deltaT)
 Updates all systems in order.
 
void Draw ()
 Renders all systems in order.
 
template<typename T , typename... Args>
requires std::is_base_of_v<System, T>
T & AddSystem (const u32 priority=1, Args &&... args)
 Adds a system to the manager.
 
template<typename T >
requires std::is_base_of_v<System, T>
void RemoveSystem ()
 
template<typename T >
requires std::is_base_of_v<System, T>
T * GetSystem ()
 Gets a system pointer.
 
void ClearSystems ()
 Clears all systems.
 

Detailed Description

Manages execution and order of systems.

Systems are updated and rendered in order. Lower priority values go first. Systems update and render before scenes.

Member Function Documentation

◆ AddSystem()

template<typename T , typename... Args>
requires std::is_base_of_v<System, T>
T & SystemManager::AddSystem ( const u32  priority = 1,
Args &&...  args 
)
inline

Adds a system to the manager.

The system is constructed in within the manager and owned by it. Systems must derive from the System base class..

Template Parameters
TSystem type
ArgsT Constructor argument types
Parameters
priorityExecution priority (lower executes first)
argsSystem constructor arguments
Returns
Reference to the created system

Usage:

PhysicsSystem& physics = systemManager.AddSystem<PhysicsSystem>(3, gravity);

◆ GetSystem()

template<typename T >
requires std::is_base_of_v<System, T>
T * SystemManager::GetSystem ( )
inline

Gets a system pointer.

Return a nullptr if the system does not exist.

Template Parameters
TSystem type

◆ Update()

void SystemManager::Update ( const float  deltaT)

Updates all systems in order.

Parameters
deltaTDuration of previous frame

The documentation for this class was generated from the following files: