PocketMatrix forums

A read-only archive of the PocketMatrix forums (2001–2014). Posting and accounts are closed.

Rotating sprites

Hi,

I want to rotate a sprite on the fly. The sprite is a 16x16 solid picture. But when rotating 45 degrees the sprite will be clipped at 16x16 and not increase in size (which is logical). How do others do this? Put the sprite in the the center of a 24x24 transparent sprite, rotate it and then draw it with an offset?

Maurice
maurice: With GapiDraw 2.0 you can now specify the center point on the destination surface.. So you don't need to bother with offsets. Or temporary surface. In GapiDraw 1.04 you always had to:

(1) Blt-rotate to a larger temporary surface with an offset to avoid clipping.
(2) BltFast the temporary surface to the back buffer and use your own clipping rectangles.

Since GapiDraw rotation code also performs clipping, it is now as simple as:

(1) Blt-rotate directly to back buffer using destination center. This center point can also be negative coordinates (-10, -10).
Cool! I'll just skip the rotation for now, and implement it next week.

Thanks!