Archived

This topic is now archived and is closed to further replies.

color keys in DX7

This topic is 6036 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I am trying to use color keys for off-screen surfaces in DX7. Could someone give me help on how to use the IDIRECTDRAWSURFACE7::SetColorKey function, or how to set the high and low colorspace values in the DDSURFACEDESC before creating the surface? If you''ve made a game that does this and I can download the source code that would help also. -Amish

Share this post


Link to post
Share on other sites

int Set_ColorKey(LPDIRECTDRAWSURFACE7 surface, COLORREF color)
{
DDCOLORKEY DDCK;

DDCK.dwColorSpaceLowValue = color;
DDCK.dwColorSpaceHighValue = DDCK.dwColorSpaceLowValue;
surface->SetColorKey(DDCKEY_SRCBLT, &DDCK);

return 1;
}


use the RGB macro to make a COLORREF like this: RGB(24, 255, 65);
You must include windows.h (but of course you should already have that included since your using DirectX).

Share this post


Link to post
Share on other sites