I’ve had a lot of interest in the new texture fill features in Level Director but wanted to clear some things up.
Level Director now supports Graphics2.0 texture fills for Rectangle, Circles and Polygons where you can simply select one of your imported asset/images as the texture and the export will take care of the rest, but due to a bug in Corona there are some limitations…
If you select an asset that is not part of a sprite sheet then it works fine, but selecting a frame from a sprite sheet only works for rectangle objects, for Circles and Polygons it just uses the whole sprite sheet image, yuk!
I have reported this bug but it still has not been resolved (http://forums.coronalabs.com/topic/41215-fixed-fill-with-imagesheets/).
Hopefully they will fix this soon as it is a really nice feature.
On the subject of texture fills, Level Director now has a Button object that you can simply add to your layer and specify the default and over images by selecting one of your existing assets.
The library code (LD_HelperG2.lua) that generates the buttons actually uses a rectangle display object with texture fill which makes it very flexible, so you can specify rounded corners, borders, fill color, text and optionally images.
In your code you simply need to tie a function to one of the button events e.g.
myButton = myLevel:getObject('button1') myButton.onPress = buttonPressed myButton.onRelease = buttonReleased
I started to implement this using the widget button but decided I wanted a little more control and integration with how Level Director dealt with assets and also to avoid adding another dependency.
Download Level Director and check out the G2Test example project.