// setup de color for transparency
G.ddpf.dwSize = sizeof(G.ddpf) ;
G.lpDDSMenu->GetPixelFormat(&G.ddpf) ; // should I place my menu surface here?
DWORD KeyColor = 0 ; // keycolor = black
G.key.dwColorSpaceLowValue = KeyColor ;
G.key.dwColorSpaceHighValue = KeyColor ;
G.lpDDSBackground->SetColorKey(DDCKEY_SRCBLT, &G.key) ; // or here?
I have the following surfaces
G.lpDDSPrimary = primary surface
G.lpDDSBack = back surface
G.lpDDSBuffer = surface with my blocks
G.lpDDSBackground = surface with background for game
G.lpDDSMenu = surface where I store my words for my menu
now which surface should I use where in my code?
thanx in advance for any help
transparency in DDraw
can any1 pls explain me how that KeyColor works, because I have the following :
I have a tetris game and when I press "P" it should display the menu, but I can''t figure out how to make my meny transparent so it''ll only display the words and not the black background of my menu
My code works (I get no errors or such) but I just can''t get that black away
here''s my code
The pixelformat is not important for transparency.
Your error is that you have to set the colorkey for the menu, not the background.
Your error is that you have to set the colorkey for the menu, not the background.
so I should place my menu surface here :
G.lpDDSMenu->SetColorKey(DDCKEY_SRCBLT, &G.key) ; // or here?
and delete this line :
G.lpDDSMenu->GetPixelFormat(&G.ddpf) ; // should I place my menu surface here?
well, this doesn''t work my menu still isn''t transparent...
but still thanx for your effort
G.lpDDSMenu->SetColorKey(DDCKEY_SRCBLT, &G.key) ; // or here?
and delete this line :
G.lpDDSMenu->GetPixelFormat(&G.ddpf) ; // should I place my menu surface here?
well, this doesn''t work my menu still isn''t transparent...
but still thanx for your effort
Mhhh... It should work though.
I can think of two problems right now. Either you are in palletized mode and black is not index 0, or you are forgetting to specify the right flag while blitting. You have to specify DDBLT_KEYSRC when you are blitting transparent surfaces.
I can think of two problems right now. Either you are in palletized mode and black is not index 0, or you are forgetting to specify the right flag while blitting. You have to specify DDBLT_KEYSRC when you are blitting transparent surfaces.
While on the topic of transparency, if you wanted a color other than black to be transparent in a non-palettized mode, how exactly would you do that? How do you find the numerical value of the color? Using a RGB macro?
-Yoshi
XGXCX ''''99
-Yoshi
XGXCX ''''99
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement