Skip to content

Commit

Permalink
use FlxButtonState for 5.7.0 compat (#425)
Browse files Browse the repository at this point in the history
  • Loading branch information
Geokureli authored Mar 19, 2024
1 parent 7421525 commit 0d3b597
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions flixel/addons/ui/FlxClickArea.hx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@ import flixel.FlxObject;
import flixel.ui.FlxButton;
import flixel.math.FlxPoint;

#if (flixel < version("5.7.0"))
import flixel.ui.FlxButton.NORMAL;
import flixel.ui.FlxButton.HIGHLIGHT;
import flixel.ui.FlxButton.PRESSED;
#end

/**
* Trimmed-down button, invisible click area, only responds to onUP
*/
Expand Down Expand Up @@ -56,7 +62,7 @@ class FlxClickArea extends FlxObject

onUp = OnUp;

status = FlxButton.NORMAL;
status = NORMAL;
_pressed = false;
_initialized = false;

Expand Down Expand Up @@ -151,7 +157,7 @@ class FlxClickArea extends FlxObject
}
if (offAll)
{
status = FlxButton.NORMAL;
status = NORMAL;
}
}
}
Expand All @@ -169,11 +175,11 @@ class FlxClickArea extends FlxObject

if (JustPressed)
{
status = FlxButton.PRESSED;
status = PRESSED;
}
if (status == FlxButton.NORMAL)
if (status == NORMAL)
{
status = FlxButton.HIGHLIGHT;
status = HIGHLIGHT;
}
}

Expand All @@ -185,14 +191,14 @@ class FlxClickArea extends FlxObject
*/
function onMouseUp(event:Event):Void
{
if (!exists || !visible || !active || (status != FlxButton.PRESSED))
if (!exists || !visible || !active || (status != PRESSED))
{
return;
}
if (onUp != null)
{
onUp();
}
status = FlxButton.NORMAL;
status = NORMAL;
}
}

0 comments on commit 0d3b597

Please sign in to comment.