diff options
author | Loek Le Blansch <loek@pipeframe.xyz> | 2024-12-14 13:27:08 +0100 |
---|---|---|
committer | Loek Le Blansch <loek@pipeframe.xyz> | 2024-12-14 13:27:08 +0100 |
commit | 438f5301d8b14fa53fef73a4356f4a5171ac91af (patch) | |
tree | e3b0e4389c620a9b1d7224a7c390293c2ea01321 /src/crepe/api/Script.cpp | |
parent | 644c1ee1a1f109ae293cc6b09fafe8ba8b448ff3 (diff) | |
parent | a03f90fa9bcbd5a0c5b5d1f2e50df183c7c3640c (diff) |
more WIP demo
Diffstat (limited to 'src/crepe/api/Script.cpp')
-rw-r--r-- | src/crepe/api/Script.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/crepe/api/Script.cpp b/src/crepe/api/Script.cpp index cafc636..d5f3f06 100644 --- a/src/crepe/api/Script.cpp +++ b/src/crepe/api/Script.cpp @@ -1,6 +1,7 @@ #include <string> #include "../manager/SceneManager.h" +#include "../facade/SDLContext.h" #include "Script.h" @@ -48,3 +49,16 @@ void Script::replay::release(recording_t recording) { LoopTimerManager & Script::get_loop_timer() const { return this->mediator->loop_timer; } +const keyboard_state_t & Script::get_keyboard_state() const { + SDLContext & sdl_context = this->mediator->sdl_context; + return sdl_context.get_keyboard_state(); +} + +bool Script::get_key_state(Keycode key) const noexcept { + try { + return this->get_keyboard_state().at(key); + } catch (...) { + return false; + } +} + |