Dark Bit Factory & Gravity

PROGRAMMING => General coding questions => Topic started by: Pot Noodle on January 23, 2012

Title: Fading away
Post by: Pot Noodle on January 23, 2012
I have been playing with Pure-basic and I must say it's a step up from Blitzmax and I have got further in less time than I did with blitz, but having said all that I was wondering if some one could take a look at this and point me in the right direction, this is for volume fade "not very good" I know, But I would like to add screen fade to it as well.

 ;////////////////////////////////////////////
 ; Volume fade
 ;////////////////////////////////////////////
  ExamineKeyboard()
 
  If KeyboardPushed(#PB_Key_Escape) Or Exit=1
    If Time=3
      Volume=Volume-1
      ModuleVolume(iMod,Volume)
      Time=0
    Else
      Time=Time+1
    EndIf
    Exit=1
  EndIf

This is in my main loop witch exit's when volume reaches 0, Any Ideas?
Thanks.
Title: Re: Fading away
Post by: ttemper on January 24, 2012
I'm also interested in this process but for Freebasic, as soon I will also attempt this Volume fade and Screen fade in from black to 256colour and then the opposite.

Something like this...? http://www.freebasic.net/forum/viewtopic.php?p=139595 (http://www.freebasic.net/forum/viewtopic.php?p=139595)
Title: Re: Fading away
Post by: benny! on January 24, 2012
You could have a (black) sprite which covers the whole screen in front of your demo set to transparent and slowy fade it to solid. This should do the trick ...
Title: Re: Fading away
Post by: Pot Noodle on January 24, 2012
Cheers Benny! I had thought of that but I was concerned with the overheads it would cause if any!
Do you think a sprite this size 800 x 600 would be a problem?
Title: Re: Fading away
Post by: benny! on January 24, 2012
Cheers Benny! I had thought of that but I was concerned with the overheads it would cause if any!
Do you think a sprite this size 800 x 600 would be a problem?

The original image of the sprite could be way smaller, e.g. 1 pixel. Then just scale it to the desired size and fade the tranparent value in/out.
Title: Re: Fading away
Post by: Pot Noodle on January 24, 2012
Thanks Benny! I was thinking of one big black sprite  :-[ but yes this is possible.
Cheers.
Title: Re: Fading away
Post by: Pot Noodle on January 25, 2012
Just for the record I have sorted full screen fade :inspired: with out the use of a sprite instead I am using  ChangeGamma()
This works like a dream.
Title: Re: Fading away
Post by: Jim on January 25, 2012
Fair enough :) Be nice though, I think Gamma is a global system setting so please put it back where it was afterwards ;)

Jim
Title: Re: Fading away
Post by: Pot Noodle on January 29, 2012
Hi Jim, having noted your reply I got worried so I had a look at the manual it only states that  it affects the current screen
up till now there's been no probs, Thanks for the advice thou.