Handle/Rotation using single surface AnimImages

BlitzMax Forums/BlitzMax Programming/Handle/Rotation using single surface AnimImages

Fry Crayola(Posted 2009) [#1]
My 2D code uses a single surface texture split into several frames, which are then drawn using DrawImageRect after setting the UV coordinates for OpenGL or DirectX accordingly. It works great.

I'm having trouble applying rotation to this when drawing, specifically setting the handle so the frame is rotated about the centre (or any other coordinate) rather than 0,0. I've tried using SetHandle, but it doesn't seem to have any effect on DrawImageRect, which always gets drawn in the same location and always gets rotated around 0,0, regardless of whether or not I set the handle before the rotation.

I know I could do it manually by adding the offsets to the DrawImageRect function myself, and calculating the new coordinates after any rotation, but surely there's an easier way to achieve this?


Fry Crayola(Posted 2009) [#2]
Ah, solved it. I hadn't expected SetImageHandle to do the job, but it does, correctly setting the handle despite using different frames of the image for animation.

That'll teach me to assume!