diff options
author | heavydemon21 <48092678+heavydemon21@users.noreply.github.com> | 2025-01-10 14:44:59 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-01-10 14:44:59 +0100 |
commit | 798237b661e8e49284e78ffb1a16599cf6a46a6d (patch) | |
tree | 8f4881cf4abc58774625383620cf82fa55b9d1f0 /game/QuitScript.cpp | |
parent | bb2db93bfb8dd7e080d2708548eae660e6b33913 (diff) | |
parent | d1cebcca2018ed4ef47ad125e45aafd018a2ab2e (diff) |
Merge pull request #125 from lonkaars/niels/game
missile alerts
Diffstat (limited to 'game/QuitScript.cpp')
-rw-r--r-- | game/QuitScript.cpp | 21 |
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); + }); +} |