8#include <nlohmann/json.hpp>
21 this->
m_systems = std::move(sm.m_systems);
29 this->
m_systems = std::move(sm.m_systems);
42 auto& sf = entt::locator<SystemFactory>::value();
52 system->update(em, scene);
84 nlohmann::json json =
"{}"_json;
86 json[
"systems"] = nlohmann::json::object();
87 json[
"systems"][
"list"] = nlohmann::json::object();
89 for (
auto i = 0; i <
m_systems.size(); i++)
91 json[
"systems"][
"list"][std::to_string(i)] =
m_systems[i]->id();
101 const auto&
systems = json.at(
"systems");
104 for (
const auto& [index, name] :
systems.items())
Class for making creating and managing entities easier.
Represents a scene in a game.
void deserialize(const nlohmann::json &json) override
Deserializes from object.
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.
nlohmann::json serialize() override
Serializes object.
bool m_suspended
Are systems allowed to run.
SystemManager & operator=(SystemManager &&) noexcept
Move assignment operator.
void resume() noexcept
Resume all systems.
SystemManager() noexcept
Constructor.
bool is_suspended() const noexcept
Check if systems are suspended.
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.
std::vector< std::shared_ptr< System > > SystemStack
System stack typedef.