SimpleWindow global default keys

This commit is contained in:
2023-07-10 09:45:01 -06:00
parent bc5213d4d3
commit 46708280cb

View File

@@ -62,6 +62,21 @@
(set selectedIndex nextIndex)
(return)))))
(var &mut defaultXKey "")
(var &mut defaultLeftKey "")
(var &mut defaultRightKey "")
(var &mut defaultUpKey "")
(var &mut defaultDownKey "")
(var &mut defaultEnterKey "")
(function sensibleDefaultKeys []
(set SimpleWindow.defaultXKey "escape")
(set SimpleWindow.defaultLeftKey "left")
(set SimpleWindow.defaultRightKey "right")
(set SimpleWindow.defaultUpKey "up")
(set SimpleWindow.defaultDownKey "down")
(set SimpleWindow.defaultEnterKey "enter"))
(defNew [&opt :String _title
:FlxColor bgColor
:FlxColor _textColor
@@ -80,12 +95,12 @@
:FlxColor titleColor (or _textColor FlxColor.WHITE)
&mut :FlxColor textColor (or _textColor FlxColor.WHITE)
:Bool xButton ?_xButton
:String xKey _xKey
:String leftKey _leftKey
:String rightKey _rightKey
:String upKey _upKey
:String downKey _downKey
:String enterKey _enterKey
:String xKey (or _xKey defaultXKey)
:String leftKey (or _leftKey defaultLeftKey)
:String rightKey (or _rightKey defaultRightKey)
:String upKey (or _upKey defaultUpKey)
:String downKey (or _downKey defaultDownKey)
:String enterKey (or _enterKey defaultEnterKey)
:ShortcutAction onClose _onClose
:FlxTypedGroup<FlxSprite> controls (new FlxTypedGroup)
:FlxKeyShortcutHandler<ShortcutAction> keyHandler (new FlxKeyShortcutHandler)