Hi
Many times I want to use tripleplay's styling code to, for example, render text with shadows or a fancy background into a layer that then I can use in an animator to move around, rotate, etc.
I know that it's not what tripleplay it's meant to do :D but maybe there's a way to "render to layer" an element or root?
Here's what I'm currently doing:
private Layer labelToLayer(Label lbl) {
Root root = iface.createRoot(new AbsoluteLayout(), Stylesheet.builder().create());
root.add(AbsoluteLayout.at(lbl, 0, 0));
root.pack();
return root.layer;
}
this works fine except that the returned layer has size (0,0) so it fails when I want to center it on screen for example. I'm working around it by returning the Root, which does have size, and use that to calculate.
An ugly hack, indeed.
Any suggestions?