diff options
| author | heavydemon21 <nielsstunnebrink1@gmail.com> | 2025-01-10 12:05:16 +0100 | 
|---|---|---|
| committer | heavydemon21 <nielsstunnebrink1@gmail.com> | 2025-01-10 12:05:16 +0100 | 
| commit | 15a958a7f327bb2e81e7d445f1499ec78c7f5839 (patch) | |
| tree | 335754f27b42f00353be643c2f01240ec7a2bcc4 /game/QuitScript.cpp | |
| parent | d20b25828b53af170a6534263e8de114e7fac121 (diff) | |
alers scripts and quitscript with ESC key
Diffstat (limited to 'game/QuitScript.cpp')
| -rw-r--r-- | game/QuitScript.cpp | 23 | 
1 files changed, 23 insertions, 0 deletions
| diff --git a/game/QuitScript.cpp b/game/QuitScript.cpp new file mode 100644 index 0000000..e48863f --- /dev/null +++ b/game/QuitScript.cpp @@ -0,0 +1,23 @@ + + +#include "QuitScript.h" +#include "api/Event.h" +#include "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); +	}); +} |