Original Post
I use the following function to blit my "things" on screen.
The last parametre is set to 0, 90, 180 or 270,the degrees of the rotation i want my surface to have.
The thing is that it returns an error when i set it to 90 or else and i can''t execute any rotation.
Why?
What do i miss? What do i do wrong?
Any help truly appriciated.
SetBitmapOnScreen(int xDest, int yDest, int nWidth, int nHeight,
int xSrc, int ySrc, int iRotation)
{
RECT rcDest;
RECT rcSrc;
SetRect( &rcDest, xDest, yDest, xDest + nWidth, yDest + nHeight );
SetRect( &rcSrc, xSrc, ySrc, xSrc + nWidth, ySrc + nHeight );
if(iRotation > 0)
{
DDBLTFX fx;
ZeroMemory(&fx, sizeof(DDBLTFX));
fx.dwSize = sizeof(fx);
switch(iRotation)
{
case 90:
fx.dwDDFX = DDBLTFX_ROTATE90;
break;
case 180:
fx.dwDDFX = DDBLTFX_ROTATE180;
break;
case 270:
fx.dwDDFX = DDBLTFX_ROTATE270;
break;
}
if( ddsBack->Blt(&rcDest, ddsOff, &rcSrc, DDBLT_WAIT | DDBLT_KEYSRC | DDBLT_DDFX, &fx) != S_OK)
ERROR_MSG(hWnd, "BltFailed");
}
else
{
ddsBack->Blt(&rcDest, ddsOff, &rcSrc, DDBLT_WAIT | DDBLT_KEYSRC , NULL);
}
}