Is there any downsides (performance issues, etc?) in adding objects to surfaces vs adding objects "directly"? I'm guessing fe.add_XXXX draws to it's own surface?
I ask because I put together a Layers module which basically draws the surfaces first, then you only draw to the surfaces. This gives you more flexibility and control with a "layered" effect, meaning you can add objects at a later time and have it drawn to the background or foreground layer.
I was initially including this as part of ExtendedObjects but I'm looking to put it out as a standalone module.
layers <- {
version = 1.4,
build = 100,
function add( name )
{
this[name] <- fe.add_surface( fe.layout.width, fe.layout.height );
},
function init( layers = null )
{
//default layers to be used
if ( layers == null ) layers = [ "Background", "Primary", "Foreground" ];
//add layers
foreach ( layer in layers ) { add( layer ); }
}
}
//now we can draw to the layers instead, in any order we want
layers.init();
layers.Foreground.add_text("I'm on top of title", 0, 0, 400, 30);
layers.Background.add_text("[Title]", 0, 0, 400, 30);
This also means you could manipulate an entire surface (and group of objects) at once. In fact, I thought about using the surface as a holder for a more complex object might be an option. So the surface could be your "object", which includes multiple text or image objects.