dragonruby-zif
dragonruby-zif copied to clipboard
Can't Nest CompoundSprites
Due to expecting to call draw_override, there is an incompatibility when trying to add a Zif::CompoundSprite to the @sprites array on another Zif::CompoundSprite.
An example to illustrate this would be attempting to refactor the ExampleApp::FormField class to use a CompoundSprite for the background, like switching it to ExampleApp::MetalCutout instead of the simple white rectangle.
This class should probably be refactored a bit to handle this situation. The two major complications are:
- Only the top level CompoundSprite should be calling
draw_override, and should reach into its descendants to draw them - It must translate the positional and dimensional attributes down to the nested CompoundSprite (recursively). Specifically, the nested sprite should be positioned on screen relative to its parent's
x/yand zoomed relative to its parentsource_w/h.