Expose whether a sprite ignores draw offset

This is extremely niche, but I'd like a way to inspect whether a sprite is set to ignore the current draw offset. While it's easy to set using gfx.sprite:setIgnoresDrawOffset(flag), as far as I can tell there's nothing accessible in Lua that allows one to determine its value.

I can understand why this would seldom if ever be needed in a game, but I'm working on a little debug drawing utility (GitHub - ebeneliason/acetate: A visual debugging suite for Playdate) that needs a way to inspect the sprites created by whomever makes use of it. The best workaround I have at the moment is this nugget, which feels a little clandestine and I'd prefer to avoid:

local _setIgnoresDrawOffset = gfx.sprite.setIgnoresDrawOffset
function gfx.sprite:setIgnoresDrawOffset(flag)
    self.__ignoresDrawOffset = flag
    _setIgnoresDrawOffset(self, flag)
end
1 Like