aboutsummaryrefslogtreecommitdiff
path: root/game/QuitScript.cpp
diff options
context:
space:
mode:
authorMax-001 <maxsmits21@kpnmail.nl>2025-01-10 14:47:17 +0100
committerMax-001 <maxsmits21@kpnmail.nl>2025-01-10 14:47:17 +0100
commitbcf9bd69f173ecee0104c84e4eadc990f17569c6 (patch)
tree712d36dec5257a5524269dde85345ceaf90504d1 /game/QuitScript.cpp
parent433c840c14782d84b4b95265b3e6f7a1f67ade3b (diff)
parent798237b661e8e49284e78ffb1a16599cf6a46a6d (diff)
Merge remote-tracking branch 'origin/master' into max/game2
Diffstat (limited to 'game/QuitScript.cpp')
-rw-r--r--game/QuitScript.cpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/game/QuitScript.cpp b/game/QuitScript.cpp
new file mode 100644
index 0000000..0c9f55a
--- /dev/null
+++ b/game/QuitScript.cpp
@@ -0,0 +1,21 @@
+
+
+#include "QuitScript.h"
+
+#include <crepe/api/Event.h>
+#include <crepe/api/KeyCodes.h>
+
+using namespace crepe;
+
+bool QuitScript::on_event(const KeyPressEvent & ev) {
+ if (Keycode::ESCAPE == ev.key) {
+ trigger_event<ShutDownEvent>(ShutDownEvent {});
+ }
+ return false;
+}
+
+void QuitScript::init() {
+ subscribe<KeyPressEvent>([this](const KeyPressEvent & ev) -> bool {
+ return this->on_event(ev);
+ });
+}