galaxy 1.0.0
Real-Time C++23 Game Programming Framework. Built on data-driven design principles and agile software engineering.
Loading...
Searching...
No Matches
SystemManager.cpp
Go to the documentation of this file.
1
7
8#include "SystemManager.hpp"
9
10namespace galaxy
11{
13 : m_suspended {false}
14 {
15 }
16
18 {
19 this->m_systems = std::move(sm.m_systems);
20 this->m_suspended = sm.m_suspended;
21 }
22
24 {
25 if (this != &sm)
26 {
27 this->m_systems = std::move(sm.m_systems);
28 this->m_suspended = sm.m_suspended;
29 }
30
31 return *this;
32 }
33
35 {
36 }
37
38 void SystemManager::add_system(const std::string& system)
39 {
40 auto& sf = entt::locator<SystemFactory>::value();
41 sf.create_system(system, m_systems);
42 }
43
45 {
46 if (!m_suspended)
47 {
48 for (auto&& system : m_systems)
49 {
50 system->update(em, scene);
51 }
52 }
53 }
54
55 void SystemManager::suspend() noexcept
56 {
57 m_suspended = true;
58 }
59
60 void SystemManager::resume() noexcept
61 {
62 m_suspended = false;
63 }
64
66 {
67 m_systems.clear();
68 }
69
71 {
72 return m_systems;
73 }
74} // namespace galaxy
Class for making creating and managing entities easier.
Represents a scene in a game.
Definition Scene.hpp:27
Manages the systems assigned to it.
void add_system(const std::string &system)
Add a system to operate on entities in this scene.
~SystemManager() noexcept
Destructor.
void clear()
Remove all systems.
bool m_suspended
Are systems allowed to run.
SystemManager & operator=(SystemManager &&) noexcept
Move assignment operator.
void resume() noexcept
Resume all systems.
SystemManager() noexcept
Constructor.
void suspend() noexcept
Suspend all running systems.
void update(EntityManager &em, Scene *scene)
Process all systems.
SystemStack & stack() noexcept
Get list of systems.
SystemStack m_systems
List of systems to process.
Application.hpp galaxy.
std::vector< std::shared_ptr< System > > SystemStack
System stack typedef.