diff options
author | Aki <please@ignore.pl> | 2022-12-31 01:43:22 +0100 |
---|---|---|
committer | Aki <please@ignore.pl> | 2022-12-31 01:43:22 +0100 |
commit | e5fb6a5cd3787d2af830de79cd87e2a0494d908b (patch) | |
tree | 9f0e575d7368fe1be7c9e64e631f9c1f47438469 | |
parent | 69887f68697fdd4a7e844677155d80e364a2630e (diff) | |
download | kurator-e5fb6a5cd3787d2af830de79cd87e2a0494d908b.zip kurator-e5fb6a5cd3787d2af830de79cd87e2a0494d908b.tar.gz kurator-e5fb6a5cd3787d2af830de79cd87e2a0494d908b.tar.bz2 |
Added a method to retrieve current scene from session
-rw-r--r-- | kurator/src/Session.cpp | 11 | ||||
-rw-r--r-- | 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<Scene> +Session::current() const +{ + return scenes.back(); +} + + void Session::set(std::shared_ptr<Scene> 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<Scene> current() const; void set(std::shared_ptr<Scene> scene); void push(std::shared_ptr<Scene> scene); void pop(); |