From 12f4d35efce12e3dbbe731c9459646c1b713bdec Mon Sep 17 00:00:00 2001 From: George FunBook Date: Thu, 23 Jan 2025 10:11:32 -0600 Subject: [PATCH 1/4] remove refs to statusAnimations for flixel > 5.9 --- flixel/addons/ui/FlxUITypedButton.hx | 36 +++++++++++++++++----------- 1 file changed, 22 insertions(+), 14 deletions(-) diff --git a/flixel/addons/ui/FlxUITypedButton.hx b/flixel/addons/ui/FlxUITypedButton.hx index 5f3e5c1..60c3e55 100644 --- a/flixel/addons/ui/FlxUITypedButton.hx +++ b/flixel/addons/ui/FlxUITypedButton.hx @@ -170,28 +170,39 @@ class FlxUITypedButton extends FlxTypedButton implements IFlxUIB _centerLabelOffset = FlxPoint.get(0, 0); - statusAnimations[3] = "normal_toggled"; - statusAnimations[4] = "highlight_toggled"; - statusAnimations[5] = "pressed_toggled"; - labelAlphas = [for (i in 0...3) 1]; inputOver = new FlxInput(0); } - + override public function graphicLoaded():Void { super.graphicLoaded(); - - setupAnimation("normal_toggled", 3); - setupAnimation("highlight_toggled", 4); - setupAnimation("pressed_toggled", 5); + + setupAnimation(getToggleStatusAnimation(NORMAL, 3)); + setupAnimation(getToggleStatusAnimation(HIGHLIGHT, #if FLX_MOUSE 4 #else 3 #end)); + setupAnimation(getToggleStatusAnimation(PRESSED, 5)); if (_autoCleanup) { cleanup(); } } + + function getToggleStatusAnimation(status:FlxButtonState) + { + #if (flixel <= "5.9.0") + return switch(status) + { + case NORMAL: "normal_toggled"; + case PRESSED: "pressed_toggled"; + case HIGHLIGHT: "highlight_toggled"; + case DISABLED: "disabled_toggled"; + } + #else + return status.toString() + "_toggled"; + #end + } @:access(flixel.addons.ui.FlxUITypedButton) public function copyGraphic(other:FlxUITypedButton):Void @@ -311,14 +322,11 @@ class FlxUITypedButton extends FlxTypedButton implements IFlxUIB } } - /** - * Offset the statusAnimations-index by 3 when toggled. - */ - override public function updateStatusAnimation():Void + override function updateStatusAnimation():Void { if (has_toggle && toggled) { - animation.play(statusAnimations[status + 3]); + animation.play(getToggleStatusAnimation(status)); } else { From 0abcd75935c9bfcd9aea75099d7edccc5e9c318d Mon Sep 17 00:00:00 2001 From: George FunBook Date: Thu, 23 Jan 2025 10:21:39 -0600 Subject: [PATCH 2/4] D'oh --- flixel/addons/ui/FlxUITypedButton.hx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/flixel/addons/ui/FlxUITypedButton.hx b/flixel/addons/ui/FlxUITypedButton.hx index 60c3e55..ab0255c 100644 --- a/flixel/addons/ui/FlxUITypedButton.hx +++ b/flixel/addons/ui/FlxUITypedButton.hx @@ -179,9 +179,9 @@ class FlxUITypedButton extends FlxTypedButton implements IFlxUIB { super.graphicLoaded(); - setupAnimation(getToggleStatusAnimation(NORMAL, 3)); - setupAnimation(getToggleStatusAnimation(HIGHLIGHT, #if FLX_MOUSE 4 #else 3 #end)); - setupAnimation(getToggleStatusAnimation(PRESSED, 5)); + setupAnimation(getToggleStatusAnimation(NORMAL), 3); + setupAnimation(getToggleStatusAnimation(HIGHLIGHT), #if FLX_MOUSE 4 #else 3 #end); + setupAnimation(getToggleStatusAnimation(PRESSED), 5); if (_autoCleanup) { From 513b98f22aba026043f0d5a2f5c145d5fd54a076 Mon Sep 17 00:00:00 2001 From: George FunBook Date: Thu, 23 Jan 2025 10:41:42 -0600 Subject: [PATCH 3/4] fix version checks --- flixel/addons/ui/FlxInputText.hx | 2 +- flixel/addons/ui/FlxUIGroup.hx | 4 ++-- flixel/addons/ui/FontDef.hx | 2 +- flixel/addons/ui/FontFixer.hx | 2 +- flixel/addons/ui/U.hx | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/flixel/addons/ui/FlxInputText.hx b/flixel/addons/ui/FlxInputText.hx index 6f100a7..fe32b54 100644 --- a/flixel/addons/ui/FlxInputText.hx +++ b/flixel/addons/ui/FlxInputText.hx @@ -745,7 +745,7 @@ class FlxInputText extends FlxText r.x = r.y = 0; caret.pixels.fillRect(r, caretC); // draw caret caret.offset.x = caret.offset.y = 0; - #if (flixel > "5.8.0") + #if (flixel > version("5.8.0")) case SHADOW_XY(shadowX, shadowY): // Shadow offset to the lower-right cw += Std.int(Math.abs(shadowX)); diff --git a/flixel/addons/ui/FlxUIGroup.hx b/flixel/addons/ui/FlxUIGroup.hx index 96c6ce2..155aaa9 100644 --- a/flixel/addons/ui/FlxUIGroup.hx +++ b/flixel/addons/ui/FlxUIGroup.hx @@ -4,11 +4,11 @@ import flixel.FlxSprite; import flixel.group.FlxSpriteGroup; import flixel.math.FlxRect; import flixel.addons.ui.interfaces.IFlxUIWidget; -#if (flixel >= "5.7.0") +#if (flixel >= version("5.7.0")) import flixel.group.FlxSpriteContainer; #end -#if (flixel < "5.4.0" && FLX_NO_POINT_POOL) +#if (flixel < version("5.4.0") && FLX_NO_POINT_POOL) /* This is a weird haxe bug I haven't figured out, fixed in 5.4.0 * via https://github.com/HaxeFlixel/flixel/pull/2808 * Note: this is only the case when FLX_NO_POINT_POOL is defined. diff --git a/flixel/addons/ui/FontDef.hx b/flixel/addons/ui/FontDef.hx index 276f75c..696ee57 100644 --- a/flixel/addons/ui/FontDef.hx +++ b/flixel/addons/ui/FontDef.hx @@ -7,7 +7,7 @@ import flixel.text.FlxText; import flixel.util.FlxColor; import openfl.Assets; import openfl.text.TextFormatAlign; -#if (openfl >= "4.0.0") +#if (openfl >= version("4.0.0")) import openfl.utils.AssetType; #end diff --git a/flixel/addons/ui/FontFixer.hx b/flixel/addons/ui/FontFixer.hx index ab9a53c..b9e0ea8 100644 --- a/flixel/addons/ui/FontFixer.hx +++ b/flixel/addons/ui/FontFixer.hx @@ -1,7 +1,7 @@ package flixel.addons.ui; import openfl.Assets; -#if (openfl >= "4.0.0") +#if (openfl >= version("4.0.0")) import openfl.utils.AssetType; #end diff --git a/flixel/addons/ui/U.hx b/flixel/addons/ui/U.hx index a21753a..479f49d 100644 --- a/flixel/addons/ui/U.hx +++ b/flixel/addons/ui/U.hx @@ -27,7 +27,7 @@ import sys.FileSystem; import sys.io.File; import sys.io.FileOutput; #end -#if (openfl >= "4.0.0") +#if (openfl >= version("4.0.0")) import openfl.utils.AssetType; #end #if haxe4 From bcf5be4c616617be0ac82e71ab2b30e3a5928b7f Mon Sep 17 00:00:00 2001 From: George FunBook Date: Fri, 31 Jan 2025 08:56:01 -0600 Subject: [PATCH 4/4] release 2.6.4 --- CHANGELOG.md | 4 ++++ haxelib.json | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4fde0ad..919afb1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +2.6.4 (December 10, 2024) +------------------------------ +`FlxUITypedButton`: Avoid deprecated `statusAnimations` field ([#291](https://github.com/HaxeFlixel/flixel-ui/pull/291)) + 2.6.3 (December 10, 2024) ------------------------------ Fix compile error with Flixel 5.8.0 ([289](https://github.com/HaxeFlixel/flixel-ui/pull/289)) diff --git a/haxelib.json b/haxelib.json index 70816ef..fdf0a3d 100644 --- a/haxelib.json +++ b/haxelib.json @@ -4,7 +4,7 @@ "license": "MIT", "tags": ["game", "openfl", "flash", "neko", "cpp", "android", "ios", "cross"], "description": "A UI library for Flixel", - "version": "2.6.3", - "releasenote": "Backwards compatibility with Flixel 5.8.0", + "version": "2.6.4", + "releasenote": "Compatibility with Flixel 6.0.0", "contributors": ["haxeflixel", "larsiusprime", "Gama11", "GeoKureli"] }