Jump to content
  • Advertisement
Sign in to follow this  
LamerGamer

Fade Out - Allegro

This topic is 4845 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

How do I fade in and fade out a BITMAP blitted to the screen? One way is to have the images available in a file, and blit them sequentially, but I want to do this with a function in Allegro.

Share this post


Link to post
Share on other sites
Advertisement
fade_in(const PALETTE p, int speed);
fade_out(int speed);

These functions only work properly for 8 bit color depth. They fade using the specified 256 color palette. If you're using higher than 8 bit color depth then you can certainly do the method you mentioned.

[edit]
You can also use Allegro's color blending functions to draw a translucent BITMAP over the BITMAP you want to fade.

Look in the Allegro manual for info on the use of these functions:

set_trans_blender(int r, int g, int b, int a);
draw_trans_sprite(BITMAP *bmp, BITMAP *sprite, int x, int y);
draw_lit_sprite(BITMAP *bmp, BITMAP *sprite, int x, int y, int color);

[Edited by - Edward_Sheets on May 15, 2005 6:33:54 PM]

Share this post


Link to post
Share on other sites
Quote:
Original post by LamerGamer
How do I fade in and fade out a BITMAP blitted to the screen? One way is to have the images available in a file, and blit them sequentially, but I want to do this with a function in Allegro.


The Allegro[http://www.allegro.cc] has some fade code[http://www.allegro.cc/resource/code/fade.php] in their code gallery.
It basicly implements Edward_Sheets suggestion.

Share this post


Link to post
Share on other sites
Like poster above said, you are probably going to want to render an alpha blended black image on top, real easy, write a simple function around that if you want. Its not difficult at all (a 5-10min task)

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!