Archived

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

da_cobra

transparency in DDraw

Recommended Posts

da_cobra    122
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
  
// 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

Share this post


Link to post
Share on other sites
da_cobra    122
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

Share this post


Link to post
Share on other sites
Askadar    122
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.

Share this post


Link to post
Share on other sites
YoshiN    122
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

Share this post


Link to post
Share on other sites