summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAki <please@ignore.pl>2022-12-24 01:56:44 +0100
committerAki <please@ignore.pl>2022-12-24 01:56:44 +0100
commitfec58fc8f6b41f76c3f60a3747e0b6bd069f2701 (patch)
tree6c893327b29dcfe11353247f3a5416dd1657a4cd
parente732f10d32f96837f5787ab946bdbe6ba6bf6f2a (diff)
downloadkurator-fec58fc8f6b41f76c3f60a3747e0b6bd069f2701.zip
kurator-fec58fc8f6b41f76c3f60a3747e0b6bd069f2701.tar.gz
kurator-fec58fc8f6b41f76c3f60a3747e0b6bd069f2701.tar.bz2
Session now holds previous scene until end of frame
This allows any ongoing function to end, be it draw or update, and allows to call session->set() from within them to change the scene.
-rw-r--r--kurator/src/Session.cpp3
-rw-r--r--kurator/src/Session.h1
2 files changed, 4 insertions, 0 deletions
diff --git a/kurator/src/Session.cpp b/kurator/src/Session.cpp
index 0d55eb3..1d1d513 100644
--- a/kurator/src/Session.cpp
+++ b/kurator/src/Session.cpp
@@ -15,6 +15,7 @@ namespace kurator
void
Session::set(std::shared_ptr<Scene> _scene)
{
+ previous_scene = scene;
scene = _scene;
}
@@ -31,6 +32,8 @@ Session::run()
scene->draw();
rlImGuiEnd();
EndDrawing();
+ if (previous_scene)
+ previous_scene.reset();
}
}
diff --git a/kurator/src/Session.h b/kurator/src/Session.h
index 4bb55cf..59aa597 100644
--- a/kurator/src/Session.h
+++ b/kurator/src/Session.h
@@ -20,6 +20,7 @@ private:
bool keep_going = true;
Window window;
std::shared_ptr<Scene> scene;
+ std::shared_ptr<Scene> previous_scene;
};