summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAki <please@ignore.pl>2022-12-23 01:19:56 +0100
committerAki <please@ignore.pl>2022-12-23 01:19:56 +0100
commitd3a4459071b561d2ee50fa1dfcbdf62590c5758e (patch)
tree49938bf5dc0cc2a58933d213185f4a1b78be260e
parent6cb50eafafaf940b9016015fe9a4b2a448e5c2bb (diff)
downloadkurator-d3a4459071b561d2ee50fa1dfcbdf62590c5758e.zip
kurator-d3a4459071b561d2ee50fa1dfcbdf62590c5758e.tar.gz
kurator-d3a4459071b561d2ee50fa1dfcbdf62590c5758e.tar.bz2
Added a method to quit game naturally through Session
-rw-r--r--kurator/src/Session.cpp9
-rw-r--r--kurator/src/Session.h2
2 files changed, 10 insertions, 1 deletions
diff --git a/kurator/src/Session.cpp b/kurator/src/Session.cpp
index 4f8e8e2..0d55eb3 100644
--- a/kurator/src/Session.cpp
+++ b/kurator/src/Session.cpp
@@ -22,7 +22,7 @@ Session::set(std::shared_ptr<Scene> _scene)
void
Session::run()
{
- while (!window.should_close()) {
+ while (!window.should_close() && keep_going) {
if (!scene)
return;
rlImGuiBegin();
@@ -35,4 +35,11 @@ Session::run()
}
+void
+Session::quit()
+{
+ keep_going = false;
+}
+
+
} // namespace kurator
diff --git a/kurator/src/Session.h b/kurator/src/Session.h
index 43f5747..4bb55cf 100644
--- a/kurator/src/Session.h
+++ b/kurator/src/Session.h
@@ -15,7 +15,9 @@ class Session
public:
void set(std::shared_ptr<Scene> _scene);
void run();
+ void quit();
private:
+ bool keep_going = true;
Window window;
std::shared_ptr<Scene> scene;
};