Rotated sprites draw with black backgrounds

rotate

It’s the return of my Totally Non-Infringing Tale of Grelda test project from last year! :laughing:

Looks like if you apply a non-zero rotation to a sprite (via playdate.graphics.sprite:setRotation(angle, [scale, [yScale]])), the sprite will draw with a black background.

I’ve attached the project. Use the crank to spin the sword. Relevant code can be seen in sprite_hero.lua; see references to the sword sprite property.

Grelda.zip (80.4 KB)

1 Like

I am also seeing this on my project after updating to SDK v1.2.1

I screwed up big time. I wanted to avoid creating a mask for images rotated a multiple of 90 degrees, but not only did I forget to leave it for images that have a mask I even got the logic backwards. :sob:

int needsMask = fabsf(rotation - 90 * roundf(rotation/90)) < 0.01;

We should have had a unit test to catch that. I’m filing an issue to add this to the image drawing test and also add any others that we may have missed. It’s really upsetting that this didn’t get caught before going out. :frowning:

1 Like

Confirmed fixed in 1.3.0 :+1:

1 Like