I am trying to both render a sprite and graphics simultaneously, but when the sprites are rendered — graphics disappears.
Here is the code:
gfx.drawRoundRect(10, 10, 30, 50, 5)
-- if I comment below out, rect is shown again
local ySprite = gfx.sprite.new( yLetterImage )
ySprite:moveTo( 200, 120 )
ySprite:setScale( 4 )
It is unclear from API reference, whether I should store graphics somewhere and then run an update on it.
gfx.sprite.update() clear the screen using
gfx.backgroundColor. You can either:
- Set the background color as
- Move your drawing code inside a function and set this function as the background drawing callback using
- Move your drawing code inside a sprite and set a low zIndex for this sprite to always be behind your other sprites.
Thank you, @Daeke!
It seems that my screen indeed was filled with background color, and I was not seeing initial render.