Open greysondn opened 5 years ago
So I don't forget... the best solution I thought of today was for each HaxeUI object (maybe the ones added to the main container group or maybe all of them) to keep track of the last time they were updated. If they were updated in the previous frame or something (compare to FlxG.ticks
), then HaxeUI should consider them valid for mouse events. Otherwise, ignore them. The tick setting could occur within the normal overridden update()
. This would fix substates and sprites/groups not added to the stage.
I've updated my haxe version, haxelibs, and this thing's code since it was last visited. I could zip a new bundle if necessary, but that is in my repo no later than commit 0e93b20. (Specific folder: link)
The specific versions now, which are of interest for looking back over this thing's history, are:
flixel, git 4d23ed84 haxeui-core, haxelib 1.0.7 haxeui-flixel, git 110fd2ac
There's really nothing to observe as far as I can tell, other than that this still persists. I wish I had good news.
The copy/paste is strong with this one, I know.
Edit: I did come up with a workaround, but it's... kinda silly, honestly.
Specificially, the titlestate is changed from the above in this same comment: link
Comment out line 43 and uncomment line 46 to test the workaround version.
The substate in that specific project has no haxeui code in it... but haxeui apparently doesn't really care much about that when it comes to being told where to draw, so we just tell it where to draw the surface. So we treat it like a normal switch for context in haxeui and it just doesn't complain.
The total alt onclick is two functions there, lines 60 - 73:
public function onSubAlt(ignored:UIEvent):Void
{
// this works by using haxeui's surface properties
// and msghero's method of swapping in and out substates
var _sub:ASubState = new ASubState(0x20000000);
Toolkit.screen.options = {container : _sub};
_sub.closeCallback = this.onSubAlt_close;
this.openSubState(_sub);
}
public function onSubAlt_close():Void
{
Toolkit.screen.options = {container: this.uiGroup};
}
I don't think I find this ideal, but at least as far as this testcase goes, it seems to work as a workaround. Victories wherever we can get them, right?
Again this has a readme writeup that's not too terrible that I've included after the break.
In my repo: 03-cantstopwontstop Specific commit: 8a59958 Zipped version attached to this issue: 03-cantstopwontstop.zip
Substates pause their parent classes by default. Haxeui doesn't listen to when its parent class is paused due to a substate being opened.
This is built to demonstrate that. You can click add all day, even with the substate open, and the counter will continue to increment.
haxelib versions from git...
flixel
,984124c4
haxeui-core
,f601c051
haxeui-flixel
,6cc3b3f4
Tested targets
haxelib list...
Update: 1 July 2019
Some potentially useful insight was dumped into the chat.
Typically when discussing pausing a state in flixel, we expect something like setting
state.active = false
. As it turns out, this isn't how substates are handled.The logic is here: https://github.com/HaxeFlixel/flixel/blob/master/flixel/FlxState.hx#L169
And the actual opening of the substate is here: https://github.com/HaxeFlixel/flixel/blob/master/flixel/FlxState.hx#L76
As I wrote in the chat:
This was followed up with some examination.