• ### Announcements

#### Archived

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

# color keys in DX7

## 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 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).

• ## Partner Spotlight

• ### Forum Statistics

• Total Topics
627657
• Total Posts
2978471

• 10
• 12
• 22
• 13
• 33