I recently refactored my code to use a rudimentary forms system I have written. This new way of creating my menus is far superior to the previous method, but I have less control over what instances of SpriteBatch are used to draw my textures to the screen.
I have buttons that are DrawableGameComponents that are added to a controls list in my FormManager. FormManager calls the Draw, Update, LoadContent methods etc of these buttons. Each button has its own SpriteBatch instance and is drawn outside of the code
that is responsible for drawing the graphics that should sit behind the buttons.
In XNA I was able to use FrontToBack sort mode to put my window graphics on the lowest layer. In SilverSprite it's sporadic. Some of my buttons are behind my window graphics while others are in front as they should be. Tweaking the LayerDepth and sort mode
only seems to make things worse.
What strategy can I use to keep my layers all drawn in the right order that supports both XNA and SilverSprite?
I thought about creating my own draw dispatcher that is a static or singleton. That would allow me to use one SpriteBatch instance for all of my graphics, but it would be a pretty hefty refactoring effort.
Appreciate any thoughts / ideas