dragonruby-zif icon indicating copy to clipboard operation
dragonruby-zif copied to clipboard

Can't Nest CompoundSprites

Open danhealy opened this issue 4 years ago • 0 comments

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:

  1. Only the top level CompoundSprite should be calling draw_override, and should reach into its descendants to draw them
  2. 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/y and zoomed relative to its parentsource_w/h.

danhealy avatar May 17 '21 01:05 danhealy