FlxKeyShortcutHandler

This commit is contained in:
2022-02-09 14:29:00 -07:00
parent 30938959b3
commit 77ee9edab8
4 changed files with 54 additions and 7 deletions

View File

@@ -4,13 +4,12 @@
// Hold left-click to hide the habit text and see the image clearly:
(when entryTexts (if FlxG.mouse.pressed (remove entryTexts) (add entryTexts)))
// Handle keyboard input:
(let [:FlxKey id (FlxG.keys.firstJustPressed)]
(unless (= id -1)
(shortcutHandler.handleKey (.toLowerCase (id.toString))))))
(when shortcutHandler
(shortcutHandler.update)))
(prop &mut :FlxTypedGroup<FlxText> entryTexts null)
(prop &mut :FlxTypedGroup<FlxSprite> rewardBlockers null)
(prop &mut :KeyShortcutHandler<Entry> shortcutHandler null)
(prop &mut :FlxKeyShortcutHandler<Entry> shortcutHandler null)
(prop &mut :HabitModel model null)
@@ -21,7 +20,7 @@
(method setModel [m]
(set model m)
(set shortcutHandler (new KeyShortcutHandler))
(set shortcutHandler (new FlxKeyShortcutHandler))
(let [p (m.totalPoints)
&mut i 0