I created a timer just fine it my main menu state but I'm trying to create a countdown timer in different state but it isn't working. Though for some reason the Clock creates a huge number for ElapsedTime, so the countdown of 3 seconds only lasts a millisecond.
Here is what I have:
SwitchSong = 3.f;
DELAY_SONG = true;
...
ElapsedTime = Clock.GetElapsedTime();
Clock.Reset();
if( DELAY_SONG )
{
std::cout << "BEFORE: " << SwitchSong << std::endl;
SwitchSong -= ElapsedTime;
std::cout << "AFTER: " << SwitchSong << std::endl;
if( SwitchSong <= 0 )
{
BackGround.Stop();
BackGround2.Play();
BackGround2.SetLoop(true);
DELAY_SONG = false;
}
}
Thanks.