// Copyright (C) 2022 Jérôme "Lynix" Leclercq (lynix680@gmail.com) // This file is part of the "Nazara Engine - Core module" // For conditions of distribution and use, see copyright notice in Config.hpp #pragma once #ifndef NAZARA_CORE_SYSTEMS_SYSTEMGRAPH_HPP #define NAZARA_CORE_SYSTEMS_SYSTEMGRAPH_HPP #include #include #include #include #include #include #include #include namespace Nz { class NAZARA_CORE_API SystemGraph { public: inline SystemGraph(entt::registry& registry); SystemGraph(const SystemGraph&) = delete; SystemGraph(SystemGraph&&) = delete; ~SystemGraph() = default; template T& AddSystem(Args&&... args); template T& GetSystem() const; void Update(); void Update(Time elapsedTime); SystemGraph& operator=(const SystemGraph&) = delete; SystemGraph& operator=(SystemGraph&&) = delete; private: struct NAZARA_CORE_API NodeBase { virtual ~NodeBase(); virtual void Update(Time elapsedTime) = 0; Int64 executionOrder; }; template struct Node : NodeBase { template Node(Args&&... args); void Update(Time elapsedTime) override; T system; }; std::unordered_map m_systemToNodes; std::vector m_orderedNodes; std::vector> m_nodes; entt::registry& m_registry; Nz::HighPrecisionClock m_clock; bool m_systemOrderUpdated; }; } #include #endif // NAZARA_CORE_SYSTEMS_SYSTEMGRAPH_HPP