QUOTE(Alex. @ Nov 26 2008, 11:05 PM)

I tested the code below and it works:
Ooh, thanks! Looking at it I think I know what I've been doing wrong!
You're a star! (hopefully

)
QUOTE(quasist @ Nov 26 2008, 11:08 PM)

Is rotation is hardware-accelerated in SDL? (mean hw version on GP2X)
I don't think so, but I don't know how optimised it is. In all honesty I'll be using this in PandoraPanic! which is for Pandora, but the Pandora section of the board doesn't have the "I need Dev help", and also my engine supports GP2X too so it should benefit.
Best thing to do is to store prerotated surfaces where speed is critical. I intend of adding that later, but needed to get it working in the first place. Thanks again Alex.
UPDATE: Thankyouuuuu! It was those bloody "-=" I changed those to just an "-" sign and voilá!
UPDATE2: Just to share the wealth, here is my final rotate function:
dst is the position of the sprite, images[i] is the original surface, tempImage is the rotated surface.
Now I just need to fix AnimatedSprites (which I can do now)
CODE
else if(useRotation)
{
SDL_Surface* tempImage = NULL;
if(angle || scaleX != 1 || scaleY != 1)
{
tempImage = rotozoomSurfaceXY(images[i], angle, scaleX, scaleY, SMOOTHING_OFF);
dst.x += (images[i]->w - tempImage->w)/2;
dst.y += (images[i]->h - tempImage->h)/2;
}
SDL_BlitSurface(tempImage,NULL/*&src*/, dstimg, &dst);
if(tempImage)
SDL_FreeSurface(tempImage);
}
Edited by PokeParadox, 26 November 2008 - 11:53 PM.