Sign in to follow this  
TIMPAN

Fading screen in SDL

Recommended Posts

TIMPAN    126
How do you fade a screen in SDL ??? I am doing an intro pic that has to fade before the main menu :-) isent there a function for this in SDL ? since many games use fading I think it would be rather strange...

Share this post


Link to post
Share on other sites
Mushu    1396
If you want to fade the whole screen to a solid color, you can hack it by just rendering a rect over the whole of the screen surface, and gradually changing the rect's alpha so that it becomes more opaque. This is the only method I've ever worked out, and its pretty slow with SDL. You can also do a motion blur with this method.

If you're looking to fade from one screen to another (directly) its going to be a nightmare.

EDIT: Okay, Rob, it isn't a nightmare persay using two screen surfaces (just modulate an alpha value on one and blit it onto the other), but performance wise that'll be a strain. Granted, I dev on a (relatively) low-end system, so "strain" to me might not mean all that much to everyone else [wink]

[Edited by - Mushu on August 3, 2005 9:47:15 PM]

Share this post


Link to post
Share on other sites
Rob Loach    1504
Quote:
Original post by Mushu
If you're looking to fade from one screen to another (directly) its going to be a nightmare.
Not necessarily, you'd just have two different screen surfaces that you'd be rendering on while slowly decreasing the alpha of one screen surface while increasing the alpha of the second one. SDL_gfx's rectangleRGBA will help you draw a rectangle with an alpha channel. It's actually not that slow of a process if you hack your way through [smile].

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this