[SDL] How can I implement fade-in/fade-out

cocobear cocobear.cn at gmail.com
Sun Dec 9 06:21:16 PST 2007


于 Sun, 9 Dec 2007 07:54:47 -0600
"David Olsen" <jolynsbass at gmail.com> 写道:

> If you are changing the alpha over a short period of time, for 
> fade-in/fade-out effects, I think you will get the best performance
> if you leave out the SDL_RLEACCEL, as I think that it will re-encode
> the RLE compression each time, making the blit slower... I always
> thought that, at any rate, and have left the rle accel off for fades
> in my programs. If I'm wrong, someone please correct me!
> -Dave
> 

I try to removed SDL_RLEACCEL, but nothing happened, probably it has
little effects on my game.



> ----- Original Message ----- 
> From: "Ryan C. Gordon" <icculus at icculus.org>
> To: "A list for developers using the SDL library. (includes
> SDL-announce)" <sdl at lists.libsdl.org>
> Sent: Sunday, December 09, 2007 6:47 AM
> Subject: Re: [SDL] How can I implement fade-in/fade-out
> 
> 
> >
> >> SDL_SetAlpha(surface,SDL_RLEACCEL,(Uint8)i);
> >> This code does'nt work!
> >
> > Try this:
> >
> >   SDL_SetAlpha(surface,SDL_RLEACCEL | SDL_SRCALPHA,(Uint8)i);
> >
> > Without SDL_SRCALPHA, blitting will ignore the alpha value you
> > specified and just copy the pixels instead of blending them.
> >
> > --ryan.
> >
> > _______________________________________________
> > SDL mailing list
> > SDL at lists.libsdl.org
> > http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org 
> 
> _______________________________________________
> SDL mailing list
> SDL at lists.libsdl.org
> http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


More information about the SDL mailing list