From e5fb6a5cd3787d2af830de79cd87e2a0494d908b Mon Sep 17 00:00:00 2001 From: Aki Date: Sat, 31 Dec 2022 01:43:22 +0100 Subject: Added a method to retrieve current scene from session --- kurator/src/Session.cpp | 11 +++++++++-- kurator/src/Session.h | 1 + 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/kurator/src/Session.cpp b/kurator/src/Session.cpp index 59adcae..4333a53 100644 --- a/kurator/src/Session.cpp +++ b/kurator/src/Session.cpp @@ -13,6 +13,13 @@ namespace kurator { +std::shared_ptr +Session::current() const +{ + return scenes.back(); +} + + void Session::set(std::shared_ptr scene) { @@ -42,11 +49,11 @@ void Session::run() { while (!window.should_close() && !scenes.empty()) { - auto scene = scenes.back(); + auto scene = current(); rlImGuiBegin(); scene->update(GetFrameTime()); if (!scenes.empty()) - scene = scenes.back(); + scene = current(); BeginDrawing(); scene->draw(); rlImGuiEnd(); diff --git a/kurator/src/Session.h b/kurator/src/Session.h index dfc49e0..24f6f30 100644 --- a/kurator/src/Session.h +++ b/kurator/src/Session.h @@ -14,6 +14,7 @@ namespace kurator class Session { public: + std::shared_ptr current() const; void set(std::shared_ptr scene); void push(std::shared_ptr scene); void pop(); -- cgit v1.1