NAT use SimpleWindow. Close #108

This commit is contained in:
2022-10-08 22:32:34 +00:00
parent be743e7f97
commit 9446ad09a8
5 changed files with 20 additions and 112 deletions

View File

@@ -1,9 +0,0 @@
package kiss_flixel;
import kiss.Prelude;
import kiss.List;
import kiss_tools.KeyShortcutHandler;
import flixel.util.FlxColor;
@:build(kiss.Kiss.build())
class KeyShortcutWindow<T> extends SimpleWindow {}

View File

@@ -1,29 +0,0 @@
// Wraps a given generic KeyShortcutHandler within
// the FlxKeyShortcutHandler that every SimpleWindow has,
// using the window to display available mappings
// from the currently active prefix map
(defNew [&prop :KeyShortcutHandler<T> innerKeyShortcuts
&prop :T->String elementToStringWithoutBrackets
&opt :String title
:FlxColor bgColor
:FlxColor textColor
:Float percentWidth
:Float percentHeight]
(super title bgColor textColor percentWidth percentHeight)
(set innerKeyShortcuts.onSelectPrefixMap ->map {
(clearControls)
(doFor =>key keyBehavior map
(case keyBehavior
((Final item)
(makeText "[${key}] - $(elementToString item)" null ->_ (innerKeyShortcuts.onSelectItem item)))
((Prefix innerMap)
(makeText "[${key}] - $(count innerMap) more options" null ->_ (innerKeyShortcuts.onSelectPrefixMap innerMap)))
(null null)))}))
(method &override :Void show []
(super.show)
(innerKeyShortcuts.start))
(method &override :Void hide []
(super.hide)
(innerKeyShortcuts.cancel))