Created
November 14, 2017 02:38
-
-
Save gltovar/23f47d0c81c33a9ca6d24ae5ac32df20 to your computer and use it in GitHub Desktop.
fix for flx button JUST_PRESSED/RELEASED states when polling
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
///// HOW IT IS NOW | |
/** | |
* Called by the game loop automatically, handles mouseover and click detection. | |
*/ | |
override public function update(elapsed:Float):Void | |
{ | |
super.update(elapsed); | |
input.update(); ////////// problem method | |
if (visible) | |
{ | |
// Update the button, but only if at least either mouse or touches are enabled | |
#if FLX_POINTER_INPUT | |
updateButton(); | |
#end | |
// Trigger the animation only if the button's input status changes. | |
if (lastStatus != status) | |
{ | |
updateStatusAnimation(); | |
lastStatus = status; | |
} | |
} | |
} | |
///// PROPOSED SOLUTION | |
/** | |
* Called by the game loop automatically, handles mouseover and click detection. | |
*/ | |
override public function update(elapsed:Float):Void | |
{ | |
super.update(elapsed); | |
if (visible) | |
{ | |
// Update the button, but only if at least either mouse or touches are enabled | |
#if FLX_POINTER_INPUT | |
updateButton(); | |
#end | |
// Trigger the animation only if the button's input status changes. | |
if (lastStatus != status) | |
{ | |
updateStatusAnimation(); | |
lastStatus = status; | |
} | |
} | |
input.update(); ////////// move this down here | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment