I have been trying but it doesn't work. The nineSlice seems to just disappear. Even with rects they disappear the moment i create a sprite.
When I do
frame:drawInRect(...)
gfx.sprite.update()
the frame is not shown, and when i do
gfx.sprite.update()
frame:drawInRect(...)
the frame is on top..
Here is some more code:
function setup()
local logoImage = gfx.image.new("images/cropped")
assert(logoImage)
logoSprite = gfx.sprite.new(logoImage)
logoSprite:moveTo(300, 60)
logoSprite:add()
end
setup()
function playdate.update()
x, y, w, h = 4, 4, 100, 100
gfx.setColor(gfx.kColorBlack)
gfx.fillRect(x - 1, y - 1, w + 2, h + 2)
gfx.sprite.update()
end
if i comment out the setup part, the rect is drawn. If i comment it in, no rect.
Probably the simplest approach would be to draw both the image and the frame in your sprite's draw() function. Background drawing is best used for things that don't move (or at least whose positions aren't determined by sprites).
Alternatively, you can draw the image and frame into a bitmap (see Offscreen Drawing) and then assign that image to your sprite.