SplashScreen fade

How would I make the SplashScreen component fadeout? I’ve tried with fadeOutComponent in numerous places to no avail.

[code]class FadingSplashScreen : public ResizableWindow, public Timer
{
Image* splashImage;
Time timeA;
Time timeB;
public:

FadingSplashScreen() : ResizableWindow(T("name"),Colours::white,false)
{
	setDropShadowEnabled(false);
	setBackgroundColour(Colours::white.withAlpha(0.f));
	addToDesktop(0);
}

int getDesktopWindowStyleFlags() const
{
	return 0;
}

void show(int timeAMillis, int timeBMillis, String pathToImage)
{
	splashImage = ImageCache::getFromFile(File(pathToImage));
	if(splashImage)
	{
		setAlwaysOnTop(true);
		setVisible(true);
		centreWithSize(splashImage->getWidth(), splashImage->getHeight());
		if(timeAMillis < timeBMillis)
		{
			timeA = Time::getCurrentTime() + RelativeTime(timeAMillis/1000.f);
			timeB = Time::getCurrentTime() + RelativeTime(timeBMillis/1000.f);
			startTimer(30);
		}
	}
}

void timerCallback()
{
	if(Time::getCurrentTime() > timeA)
	{
		if(splashImage)
		{
			splashImage->multiplyAllAlphas(.9f);
			repaint();			
		}
	}
	if(Time::getCurrentTime() > timeB)
	{
		stopTimer();
		delete this;
	}
	
}

void paint(Graphics& g)
{
	if(splashImage)
	{
		g.drawImageAt(splashImage, 0, 0);
	}
}

~FadingSplashScreen()
{
	if(splashImage)
	{
		ImageCache::release(splashImage);
	}
}

};
[/code]

A couple notes:
First, and most importantly, you probably don’t want to use this code exactly; it’s not as functional as the SplashScreen class is. Just take a look at what’s being done and add what you need.

timeA is the time that the fadeOut starts, and timeB is the time after which the window is deleted. You can’t specify the fadeout time as such; it’s implicit in the rate of the timer is called and the opacity multiplier. Sorry about the ambiguous names.

There were more notes, but I figured out what was wrong. :slight_smile:

Made a few little mods, but otherwise works perfectly. Thanks and well done! :smiley: