Archived

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

wendieu

16-24 bit fades in DDraw

Recommended Posts

Okay I am currently making a game in MSVC++ in Direct Draw in 16 bpp. I am trying to make the screen fade to black but it will not work. Can anyone help me to have the screen fade to black? Edited by - wendieu on March 20, 2002 1:55:03 PM

Share this post


Link to post
Share on other sites
gamma is not supporte dont all cards, plus is a stupid method. instead look at the articles on how to do blending on this site. games that use gamma control for this tend to screw up the desktop if they crash, assuming that the card supports it. search the board, this question has been asked and answered before (with some code i might add).

Share this post


Link to post
Share on other sites
hmm, i guess you dont know how to search well

http://www.gamedev.net/reference/programming/features/mmxblend/

that was found in mere seconds using gamedevs search engine.

Share this post


Link to post
Share on other sites
thanks I am not too familiar with this site that much. How can do a search...?(This is probably the second time I had posted a topic here)

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
If you''re just fading to black.. why not do something like this.. obviously there are more efficient ways of doing this, but at least this will show you exactly what''s going on :o).

you have your pointer to a 16-bit surface, and you''re width/height (unsigned short *Ptr_16Bit,unsigned short width ,height.


  
void Fade16(unsigned short *Ptr_16Bit, unsigned short width, unsigned short height)
{
int x,y;
unsigned char r,g,b;
for (y=0;y!=height;++y)
{
for (x=0;x!=width;++x)
{
//Get r,g,b

r = ((*Ptr_16Bit)&31);
g = (((*Ptr_16Bit)>>5)&63);
b = (((*Ptr_16Bit)>>11)&31);
if (r) --r; //Subrtact 1 if not 0!

if (g) --g; //Subrtact 1 if not 0!

if (b) --b; //Subrtact 1 if not 0!

*Ptr_16Bit=(b<<11) + (g<<5) + r; //Set our new value!

++Ptr_16Bit; //Increment to next value!

}
}
}


Billy - BillyB@mrsnj.com

Share this post


Link to post
Share on other sites
Forum search:
Click "search" (above and to the right)

Article search:
Go to "Articles & Resources"
Use the Google thingy

Share this post


Link to post
Share on other sites