Closed Starmapo closed 7 months ago
I agree it seems weird to have a drawOnTop
field for plugins. maybe it makes more sense to just always draw plugins on top? I can't imagine a time when someone would want to draw a plugin under everything.
The above is still a breaking change, so until 6.0.0 You might want to just call FlxG.plugins.draw()
manually in your state to draw it on top of everything. not ideal but works with minimal effort
Sounds good! And I agree that I can't imagine a situation where you'd want a plugin drawn behind everything.
Some ideas:
FlxG.plugins.drawOnTop
, which defaults to false
for backwards compatibility (Less complicated, less features)drawOnTop
arg to FlxG.plugins.addPlugin
that defaults to false. internally there will be 2 lists of plugins and the remove
and get
methods will check both (More complicated, more features)I actually did have the second idea in mind, it seems like the best option if we're going to allow the previous method (even if I don't know any situation where you'd want it). Will have to think about what to do with FlxG.plugins.list
though, unless the 2 new lists are just updated separately from that.
I'm actually leaning towards option 1, it still allows for objects on bottom, if desired, and if someone wants both then I would love for them to share their use case in a github issue. Also option 2 gets hairy when talking about edge cases, like if they try to add the same plugin instance to both or if they want to move something from one to the other
Yeah that's fair, option 1 it is then.
If you wanted to make a PR that'd be cool otherwise I dunno when I'll get around to it. and feel free to explore option 2 if you want
Alright sure, I'll make the PR when I get the time
It would be nice to be able to have a plugin be drawn on top of all other objects, as it's currently forced to be drawn under everything else. For example, this can be used for a plugin that displays achievement objects on the screen (which is what I was trying to implement a while ago), an FPS/memory display, etc.
I'm not sure what's the best way to go about this, as FlxG.plugins takes any FlxBasic instance, and I think it'll be confusing to add a variable that only works for plugins.
Please let me know your thoughts on this suggestion.