Archived

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

fade out transition help!

This topic is 5586 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

OK I got the fade out routine to correctly fade out, but for this effect to look good, you need fade in after the fade out is complete. Now here is my problem: I have a backbuffer and a number of offscreen surfaces. Say I am in gameState TITLE_SCREEN and the user presses DIK_RETURN to go to the main game screen. CTitleScreen::HandleInput( void ) { if ( m_input->Pressed( DIK_RETURN ) ) { // fade out FadeOut(); SetGameState( MAIN_GAME_SCREEN ); } } So I call fade out, it fades out what is in the backbuffer, ok? so that looks good. But I need to fade in the main game screen, but I haven;t composed that screen to the backbuffer. How would I do this? Do you have a better way?

Share this post


Link to post
Share on other sites
Hoi, I guess you would draw your main game screen first, but DONT flip it to be the viewable surface, then run your fade to black on that buffer. Then once you are totally faded out, run your fade in routine while drawing and flipping like normal. After all that has completed, then start looking for input and process game logic. Hope that helps

Share this post


Link to post
Share on other sites
Let''s see if I understood your question right... Now you want to fade out from one menu and fade in to another?

Ok, this is how I would do. The fading out to black is easy, so I''ll not comment on that.

For the fading in to a picture you need the picture you are fading in to already drawn on a offscreen surface. Then you draw it on a screen surface, then apply the fade (of a certain degree). (Of course, if you are using double or triple buffering this will have to be done on all flippable surfaces, which makes it a little slow, but it disables the overlay effect.)

Anyhow, you just do that. Look at this piece of pseudo-code.

If(ENTER_KEY_PRESSED)
{
do
{
draw(picture_to_be_faded_out_to);
draw(black_screen_with_transparency[amount_of_transparency]);
amount_of_transparency++;
} while(amount_of_transparency < max_transparency_value);
}

something like that. Now I hope I answered the right question, heh.

Share this post


Link to post
Share on other sites