Detect changes to clipRect without needing to reset the field in order to take effect
currently, using FlxRect for fields such as FlxSprite.clipRect requires reassigning in order for changes to take effect. i've seen multiple people question this, and i've wondered if there's a simpler way around it.
Some ideas:
- Create a class similar to
FlxCallbackPoint(potentiallyFlxCallbackRect) that acts similarly to the callback point class. - Implement this functionality in
FlxRectitself, possibly acallbackfunction that gets called when setting x, y, width, height.
If we went with the latter, we could potentially remove FlxCallbackPoint and add similar functionality into the standard FlxPoint class.
As I said in chat, I'm not a fan of FlxCallbackPoints for memory reasons and I'm even trying to do away with that in the long run. but I think there may be another way to detect changes to the clipRect field, i'll do some test when I have time
@Sword352 had an idea of polling the current cliprect in draw() (and all other places) rather than triggering some refresh on change or detecting changes. I think this would work for actually rendering the sprite but fear it may make other affected getters more costly. Its worth consideration, nonetheless
As I said in chat, I'm not a fan of FlxCallbackPoints for memory reasons and I'm even trying to do away with that in the long run. but I think there may be another way to detect changes to the clipRect field, i'll do some test when I have time
a "bit" late but do you mind sharing the idea you had in mind? depending on what it is i could attempt implementation and appropriate testing
When I have time, I'll make a quick mock-up of what I have in mind, thanks for reminding me