static SimpleWindow.create with keyword args

This commit is contained in:
2025-03-12 10:05:58 -05:00
parent 26f1b006ef
commit 5972ddf0af
2 changed files with 21 additions and 0 deletions

View File

@@ -26,6 +26,23 @@ using StringTools;
typedef ShortcutAction = Void->Void;
typedef Action = FlxSprite->Void;
typedef ConstructorArgs = {
?title:String,
?bgColor:FlxColor,
?textColor:FlxColor,
?percentWidth:Float,
?percentHeight:Float,
?xButton:Bool,
?xKey:String,
?leftKey:String,
?rightKey:String,
?upKey:String,
?downKey:String,
?enterKey:String,
?onClose:ShortcutAction,
?selectionMarker:FlxSprite,
?screenReaderAudioFolder:String
};
@:build(kiss.Kiss.build())
class SimpleWindow extends FlxSprite {}

View File

@@ -148,6 +148,10 @@
(set SimpleWindow.defaultDownKey "down")
(set SimpleWindow.defaultEnterKey "enter"))
(function create [:ConstructorArgs args]
(new SimpleWindow args.title args.bgColor args.textColor args.percentWidth args.percentHeight args.xButton args.xKey
args.leftKey args.rightKey args.upKey args.downKey args.enterKey args.onClose args.selectionMarker args.screenReaderAudioFolder))
(defNew [&opt :String _title
:FlxColor bgColor
:FlxColor _textColor