does anyone have working transparency code for DD7? I'm using DX8.1 (but DD7) on WinXP and here is my basic code:
PHP Code:
void cozSprite::Draw(int frame, int x, int y, LPDIRECTDRAWSURFACE7 dest)
{
RECT destRect;
//horizontal extent
destRect.left = x;
destRect.right = destRect.left + Width;
//vertical extent
destRect.top = y;
destRect.bottom = y+Height;
//blit it
dest->Blt(&destRect, Image[frame], &srcRect, DDBLT_KEYSRC|DDBLT_WAIT, &ddbltfx);
//error reported is that there are invalid parameters, commenting out DDBLT_KEYSRC fixes this
}
Image is an array of LPDIRECTDRAWSURFACE7-s, and here is the function to create them:
PHP Code:
void cozSprite::CreateSurfaces()
{
DDCOLORKEY ddck;
for(int i = 0; i < Frames; i++)
Image[i] = DDBase.CreateOffscreenSurface(Width,Height);
//ddck.dwColorSpaceHighValue = ddck.dwColorSpaceLowValue = ColorMatch(RGB(254,0,254));
ddck.dwColorSpaceHighValue = ddck.dwColorSpaceLowValue = (DWORD)RGB(254,0,254);
for(int i = 0; i < Frames; i++)
Image[i]->SetColorKey(DDCKEY_SRCBLT, &ddck);
}
All that happens is that nothing is drawn, and when i check my error messages on all of these functions setcolorkey has no errors, nor does anything else in my entire program (at least related in any way to drawing code), but I do get a DDERR_INVALIDPARAMS on the Blt() call.
I would really appreciate any help that anyone can give me, I'm really having a hard time with this.