- Joined
- Dec 8, 2005
- Messages
- 6,603
- Age
- 41
- Location
- UK
- Website
- pokeparadox.itch.io
- WEBSITE
- https://github.com/pokeparadox
- YOUTUBE
- pokeparadox
Ok... anyone know anything about rotozoom and SDL, because I'm hitting my head against the keyboard trying to fix rotations...
Either I can get full sprite rotated and displayed but it's not centred... or I can get it centred but it's cropped :/
here is the truncated code from my image class:
CODE
else if(useRotation)
{
SDL_Surface* tempImage = NULL;
src.w *=scaleX;
src.h *=scaleY;
if(angle || scaleX != 1 || scaleY != 1)
{
if(!angle)
tempImage = zoomSurface(images,scaleX, scaleY, SMOOTHING_OFF);
else
tempImage = rotozoomSurfaceXY(images, angle, scaleX, scaleY, SMOOTHING_ON);
src.x -= (src.w - tempImage->w)/2;
src.y -= (src.h - tempImage->h)/2;
}
SDL_BlitSurface(tempImage,&src, dstimg, &dst);
if(tempImage)
SDL_FreeSurface(tempImage);
}
And this is what it currently does...
Either I can get full sprite rotated and displayed but it's not centred... or I can get it centred but it's cropped :/
here is the truncated code from my image class:
CODE
else if(useRotation)
{
SDL_Surface* tempImage = NULL;
src.w *=scaleX;
src.h *=scaleY;
if(angle || scaleX != 1 || scaleY != 1)
{
if(!angle)
tempImage = zoomSurface(images,scaleX, scaleY, SMOOTHING_OFF);
else
tempImage = rotozoomSurfaceXY(images, angle, scaleX, scaleY, SMOOTHING_ON);
src.x -= (src.w - tempImage->w)/2;
src.y -= (src.h - tempImage->h)/2;
}
SDL_BlitSurface(tempImage,&src, dstimg, &dst);
if(tempImage)
SDL_FreeSurface(tempImage);
}
And this is what it currently does...