Skip to content

Commit 11c9ed5

Browse files
authored
Remove refs to statusAnimations for flixel > 5.9 (#291)
* remove refs to statusAnimations for flixel > 5.9 * D'oh * fix version checks
1 parent 2c553e8 commit 11c9ed5

File tree

6 files changed

+28
-20
lines changed

6 files changed

+28
-20
lines changed

flixel/addons/ui/FlxInputText.hx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -745,7 +745,7 @@ class FlxInputText extends FlxText
745745
r.x = r.y = 0;
746746
caret.pixels.fillRect(r, caretC); // draw caret
747747
caret.offset.x = caret.offset.y = 0;
748-
#if (flixel > "5.8.0")
748+
#if (flixel > version("5.8.0"))
749749
case SHADOW_XY(shadowX, shadowY):
750750
// Shadow offset to the lower-right
751751
cw += Std.int(Math.abs(shadowX));

flixel/addons/ui/FlxUIGroup.hx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ import flixel.FlxSprite;
44
import flixel.group.FlxSpriteGroup;
55
import flixel.math.FlxRect;
66
import flixel.addons.ui.interfaces.IFlxUIWidget;
7-
#if (flixel >= "5.7.0")
7+
#if (flixel >= version("5.7.0"))
88
import flixel.group.FlxSpriteContainer;
99
#end
1010

11-
#if (flixel < "5.4.0" && FLX_NO_POINT_POOL)
11+
#if (flixel < version("5.4.0") && FLX_NO_POINT_POOL)
1212
/* This is a weird haxe bug I haven't figured out, fixed in 5.4.0
1313
* via https://github.com/HaxeFlixel/flixel/pull/2808
1414
* Note: this is only the case when FLX_NO_POINT_POOL is defined.

flixel/addons/ui/FlxUITypedButton.hx

Lines changed: 22 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -170,28 +170,39 @@ class FlxUITypedButton<T:FlxSprite> extends FlxTypedButton<T> implements IFlxUIB
170170

171171
_centerLabelOffset = FlxPoint.get(0, 0);
172172

173-
statusAnimations[3] = "normal_toggled";
174-
statusAnimations[4] = "highlight_toggled";
175-
statusAnimations[5] = "pressed_toggled";
176-
177173
labelAlphas = [for (i in 0...3) 1];
178174

179175
inputOver = new FlxInput(0);
180176
}
181-
177+
182178
override public function graphicLoaded():Void
183179
{
184180
super.graphicLoaded();
185-
186-
setupAnimation("normal_toggled", 3);
187-
setupAnimation("highlight_toggled", 4);
188-
setupAnimation("pressed_toggled", 5);
181+
182+
setupAnimation(getToggleStatusAnimation(NORMAL), 3);
183+
setupAnimation(getToggleStatusAnimation(HIGHLIGHT), #if FLX_MOUSE 4 #else 3 #end);
184+
setupAnimation(getToggleStatusAnimation(PRESSED), 5);
189185

190186
if (_autoCleanup)
191187
{
192188
cleanup();
193189
}
194190
}
191+
192+
function getToggleStatusAnimation(status:FlxButtonState)
193+
{
194+
#if (flixel <= "5.9.0")
195+
return switch(status)
196+
{
197+
case NORMAL: "normal_toggled";
198+
case PRESSED: "pressed_toggled";
199+
case HIGHLIGHT: "highlight_toggled";
200+
case DISABLED: "disabled_toggled";
201+
}
202+
#else
203+
return status.toString() + "_toggled";
204+
#end
205+
}
195206

196207
@:access(flixel.addons.ui.FlxUITypedButton)
197208
public function copyGraphic(other:FlxUITypedButton<FlxSprite>):Void
@@ -311,14 +322,11 @@ class FlxUITypedButton<T:FlxSprite> extends FlxTypedButton<T> implements IFlxUIB
311322
}
312323
}
313324

314-
/**
315-
* Offset the statusAnimations-index by 3 when toggled.
316-
*/
317-
override public function updateStatusAnimation():Void
325+
override function updateStatusAnimation():Void
318326
{
319327
if (has_toggle && toggled)
320328
{
321-
animation.play(statusAnimations[status + 3]);
329+
animation.play(getToggleStatusAnimation(status));
322330
}
323331
else
324332
{

flixel/addons/ui/FontDef.hx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import flixel.text.FlxText;
77
import flixel.util.FlxColor;
88
import openfl.Assets;
99
import openfl.text.TextFormatAlign;
10-
#if (openfl >= "4.0.0")
10+
#if (openfl >= version("4.0.0"))
1111
import openfl.utils.AssetType;
1212
#end
1313

flixel/addons/ui/FontFixer.hx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package flixel.addons.ui;
22

33
import openfl.Assets;
4-
#if (openfl >= "4.0.0")
4+
#if (openfl >= version("4.0.0"))
55
import openfl.utils.AssetType;
66
#end
77

flixel/addons/ui/U.hx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ import sys.FileSystem;
2727
import sys.io.File;
2828
import sys.io.FileOutput;
2929
#end
30-
#if (openfl >= "4.0.0")
30+
#if (openfl >= version("4.0.0"))
3131
import openfl.utils.AssetType;
3232
#end
3333
#if haxe4

0 commit comments

Comments
 (0)