diff --git a/src/core/entry/entry_point.hpp b/src/core/entry/entry_point.hpp index 1c9beb4..32d95a1 100644 --- a/src/core/entry/entry_point.hpp +++ b/src/core/entry/entry_point.hpp @@ -37,11 +37,15 @@ int main(int argc, char** argv) rsl::log::setup(); rythe::core::Program program; - if (auto errorCode = init_program(program).report_errors(); errorCode != rsl::no_error_code) { - return static_cast(errorCode); - } + auto result = init_program(program); + rsl::scoped_assert_on_error saoe(false); + if (auto errorCode = result.report_errors(); errorCode != rsl::no_error_code) + { + return static_cast(errorCode); + } + } program.initialize(); while (program.isRunning()) diff --git a/src/core/program/program.cpp b/src/core/program/program.cpp index f0153bb..83cd9a0 100644 --- a/src/core/program/program.cpp +++ b/src/core/program/program.cpp @@ -4,7 +4,7 @@ namespace rythe::core { void Engine::setup(Program* ptr) { - rsl::log::debug("Engine[{}] Instance initialized", engineId); - programPtr = ptr; + rsl::log::debug("Engine[{}] Instance initialized", m_engineId); + m_programPtr = ptr; } } // namespace rythe::core diff --git a/src/core/program/program.hpp b/src/core/program/program.hpp index 318c6b0..e158aad 100644 --- a/src/core/program/program.hpp +++ b/src/core/program/program.hpp @@ -5,6 +5,8 @@ #include #include +#include +#include namespace rythe::core { @@ -13,26 +15,31 @@ namespace rythe::core class Engine { private: - Program* programPtr = nullptr; - rsl::id_type engineId = 0; + Program* m_programPtr = nullptr; + rsl::id_type m_engineId = 0; + rsl::type_map m_context; public: Engine(rsl::id_type id) - : engineId(id) + : m_engineId(id) { } void setup(Program* ptr); - void update() { rsl::log::debug("Engine[{}] Update", engineId); } + void update() { rsl::log::debug("Engine[{}] Update", m_engineId); } - void shutdown() { rsl::log::debug("Engine[{}] Shutdown", engineId); } + void shutdown() { rsl::log::debug("Engine[{}] Shutdown", m_engineId); } + + rsl::type_map& get_context() noexcept { return m_context; } + const rsl::type_map& get_context() const noexcept { return m_context; } }; class Program { private: std::unordered_map> m_engines; + rsl::type_map m_context; rsl::id_type m_lastIdx = 0; bool m_running = false; @@ -66,6 +73,9 @@ namespace rythe::core } } + rsl::type_map& get_context() noexcept { return m_context; } + const rsl::type_map& get_context() const noexcept { return m_context; } + [[rythe_always_inline]] bool isRunning() { return m_running; } [[rythe_always_inline]] void stop() { m_running = false; }