Adventure Game Studio

AGS Support => Advanced Technical Forum => Topic started by: Kinoko on Sun 12/02/2006 07:32:12

Title: FadeOut non-blocking?
Post by: Kinoko on Sun 12/02/2006 07:32:12
Would it be possible to make the FadeIn and FadeOut functions non-blocking?
Title: Re: FadeOut non-blocking?
Post by: GarageGothic on Sun 12/02/2006 08:57:24
If you need to fade in and out from black or any other solid color, you could just at add a full-screen GUI with that color background and then change the transparency and control fade in/out time in repeatedly_execute.
Title: Re: FadeOut non-blocking?
Post by: Pumaman on Sun 12/02/2006 11:22:40
Interesting request -- would you also need a way of knowing when the fade had finished? What sort of effect would you use this for?
Title: Re: FadeOut non-blocking?
Post by: Kinoko on Sun 12/02/2006 13:20:32
Ah well, basically, what I was after was a slow fade room transition, going straight into a scrolling room (actively scrolling, that is) for a nice effect.

I've seen discovered that even without the non-blocking aspect, FadeIn and Out doesn't work for me because I can't FadeIn after a room change.

I might have to use the full screen gui after all...

But I might alter my my suggestion to being able to have a slow fade in and out while using ChangeRoom.
Title: Re: FadeOut non-blocking?
Post by: Pumaman on Sun 12/02/2006 16:09:07
Ah ok, I see what you mean.

Woudl anyone else use this?
Title: Re: FadeOut non-blocking?
Post by: Kweepa on Sun 12/02/2006 16:51:50
I think it would be pretty useful. It could make room transitions less rough.
I can see it being used to fade down the music volume, continue to animate a character off the screen, and so on.
Title: Re: FadeOut non-blocking?
Post by: Kinoko on Mon 13/02/2006 11:25:51
Another suggestion/question:

Would it be possible to fade in and out music tracks? This'd be really handy for me. Is it possible at the moment?
Title: Re: FadeOut non-blocking?
Post by: Rui 'Trovatore' Pires on Mon 13/02/2006 11:43:09
Well, you can crossfade them. Other than that, you can make your own function which changes the volume of a channel, or just the overall voule or whatever, in much the same way as you'd fade, say, a GUI.

Mind you, this might not be a viable solution, depending on what you want to do. Other than that, I dunno.
Title: Re: FadeOut non-blocking?
Post by: Kinoko on Mon 13/02/2006 11:56:32
Oh, that's a good idea... think it'd be possible to do this in a non-blocking way?
Title: Re: FadeOut non-blocking?
Post by: Rui 'Trovatore' Pires on Mon 13/02/2006 11:59:53
Yeah, instead of "Wait"ing for the delay in which you'd do something like this (i.e.,

while (counter<x) {
Ã,  counter++;
Ã,  ChangeWhateverYouWantTo(counter);
Ã,  Wait(1);
}

), you could do something like:

StartFading();
fading=true;

and in rep_exec:

if (fading==true) {
Ã,  if (counter<x) {
Ã,  ChangeWhateverYouWantTo(counter);
Ã,  counter++;
Ã,  }
Ã,  else fading=false;
}

This probably isn't totally right, but you see the logic - make your own timer, or use a built-in AGS one, and use it to make the checks.

EDIT - Yeah, not at all totally like this, it'd be more like:

if (fading==true) {
  if (counter2==0) {
    if (counter<100){
      ChangeWhateverYouWantTo(counter);
      counter++;
      counter2=4;
    }
    else fading=false;
   }
  else counter2--;
}
Title: Re: FadeOut non-blocking?
Post by: Pumaman on Mon 13/02/2006 18:09:08
If crossfading is switched on, then when you stop the music it will fade out automatically.
Title: Re: FadeOut non-blocking?
Post by: edmundito on Mon 13/02/2006 22:24:16
I'd think it'd be useful, and even fadein non blocking. It'd be cool to have cut-scenes fade in on characters already walking or doing some kind of work.
Title: Re: FadeOut non-blocking?
Post by: Kinoko on Tue 14/02/2006 00:39:00
Quote from: Pumaman on Mon 13/02/2006 18:09:08
If crossfading is switched on, then when you stop the music it will fade out automatically.


Oh, excellent! I didn't know that.