I uploaded my demo at GD.net to give you hope
(if it runs) heh
It uses the same rotation function as I posted, altough the
one I posted could include bugs because I tried to use it again but had some troubles. But here''s one that should work I coped from a working backup of my wrapper:
//-----------------------------------------------------------------------------// Name: RotateBlit// Desc: Rotates and blits a surface//-----------------------------------------------------------------------------WorkSurface::RotateBlit(int x, int y, float alpha, SURFACEDATA Scr, bool ColorKey){ DDSURFACEDESC2 SurfaceDesc2; DDCOLORKEY ddck; int lPitch2; USHORT* Buffer2; int ux,uy,vv; float hw,hh,x1,y1,x2,y2,x3,y3,mx,my,mx2,my2,ty,ty2,rx,ry,alpha2,r; alpha = alpha * (2.0f*PI/360.0f); hw=Scr.Width/2.0f; hh=Scr.Height/2.0f; //ColorKey Scr.Surface->GetColorKey(DDCKEY_SRCBLT, &ddck); //Locks the destination surface INITDESC(SurfaceDesc2); SurfaceData.Surface->Lock(NULL, &SurfaceDesc2, DDLOCK_SURFACEMEMORYPTR | DDLOCK_WAIT, NULL); Buffer=(USHORT *)SurfaceDesc2.lpSurface; lPitch=(int)(SurfaceDesc2.lPitch >> 1); //Locks the source surface INITDESC(SurfaceDesc2); Scr.Surface->Lock(NULL, &SurfaceDesc2, DDLOCK_SURFACEMEMORYPTR | DDLOCK_WAIT, NULL); Buffer2=(USHORT *)SurfaceDesc2.lpSurface; lPitch2=(int)(SurfaceDesc2.lPitch >> 1); //radien r=sqrtf(hw*hw+hh*hh); // #1 /* ux=-hw; uy=-hh;*/ alpha2=-(acosf(-hw/r))+alpha; x1=(x+cosf(alpha2)*r); y1=(y+sinf(alpha2)*r); // #2 alpha2=-(acosf(-hw/r))+alpha; x2=(x+cosf(alpha2)*r); y2=(y+sinf(alpha2)*r); // #3 alpha2=acosf(hw/r)+alpha; x3=(x+cosf(alpha2)*r); y3=(y+sinf(alpha2)*r); mx=(x2-x1)/(Scr.Width); my=(y2-y1)/(Scr.Width); mx2=(x3-x2)/(Scr.Height); my2=(y3-y2)/(Scr.Height); for(uy=0;uy<Scr.Height;uy++){ ty=(uy*mx2); ty2=(uy*my2); rx=x1; ry=y1; for(ux=0;ux<Scr.Width;ux++){ rx+=mx; ry+=my; if(Buffer2[ux+uy*lPitch2] != ddck.dwColorSpaceLowValue) { vv=int(rx+ty)+int(ry+ty2)*lPitch; Buffer[vv]=Buffer2[ux+uy*lPitch2]; Buffer[vv+1]=Buffer2[ux+uy*lPitch2]; } }} Scr.Surface->Unlock(NULL); SurfaceData.Surface->Unlock(NULL);}
And my cool demo is here:
2D SOFTWARE ROOTATION IN DIRECTDRAW DEMO
Good luck all!!
/MindWipe
"If it doesn''t fit, force it; if it breaks, it needed replacement anyway."