diff options
| author | Mica White <botahamec@outlook.com> | 2026-10-26 11:04:14 -0400 |
|---|---|---|
| committer | Mica White <botahamec@outlook.com> | 2026-10-26 11:04:14 -0400 |
| commit | 2987e310e8e6eaeaa60546bb92a61d9c3713263a (patch) | |
| tree | 530ff5abe1b584bc1a6da5babd328d71d1e1173c /src/exit_on_escape.rs | |
Diffstat (limited to 'src/exit_on_escape.rs')
| -rw-r--r-- | src/exit_on_escape.rs | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/exit_on_escape.rs b/src/exit_on_escape.rs new file mode 100644 index 0000000..a7885ca --- /dev/null +++ b/src/exit_on_escape.rs @@ -0,0 +1,10 @@ +use tortuise_script::{input::KeyCode, ScriptContext, TortuiseScript}; + +pub const EXIT_ON_ESCAPE: TortuiseScript = TortuiseScript { + update: |mut context: ScriptContext| { + if context.is_key_pressed_this_frame(KeyCode::Esc) { + context.exit(); + } + }, + ..TortuiseScript::empty() +}; |
