// Copyright (C) 2023 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_ENTTSYSTEMGRAPH_HPP #define NAZARA_CORE_ENTTSYSTEMGRAPH_HPP #include #include #include #include #include #include #include #include namespace Nz { class NAZARA_CORE_API EnttSystemGraph { public: inline EnttSystemGraph(entt::registry& registry); EnttSystemGraph(const EnttSystemGraph&) = delete; EnttSystemGraph(EnttSystemGraph&&) = delete; ~EnttSystemGraph() = default; template T& AddSystem(Args&&... args); template T& GetSystem() const; void Update(); void Update(Time elapsedTime); EnttSystemGraph& operator=(const EnttSystemGraph&) = delete; EnttSystemGraph& operator=(EnttSystemGraph&&) = 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_ENTTSYSTEMGRAPH_HPP