Don't call startMusic every frame on race result screen
It breaks pausing music when going background in android
This commit is contained in:
parent
a1c099cc1c
commit
7a07b716b8
@ -95,6 +95,7 @@ void RaceResultGUI::init()
|
||||
getWidget("middle")->setVisible(false);
|
||||
getWidget("right")->setVisible(false);
|
||||
|
||||
m_started_race_over_music = false;
|
||||
music_manager->stopMusic();
|
||||
|
||||
bool human_win = true;
|
||||
@ -1021,13 +1022,15 @@ void RaceResultGUI::unload()
|
||||
void RaceResultGUI::onUpdate(float dt)
|
||||
{
|
||||
// When the finish sound has been played, start the race over music.
|
||||
if (m_finish_sound && m_finish_sound->getStatus() != SFXBase::SFX_PLAYING)
|
||||
if (!m_started_race_over_music &&
|
||||
m_finish_sound && m_finish_sound->getStatus() != SFXBase::SFX_PLAYING)
|
||||
{
|
||||
try
|
||||
{
|
||||
// This call is done once each frame, but startMusic() is cheap
|
||||
// if the music is already playing.
|
||||
music_manager->startMusic(m_race_over_music);
|
||||
m_started_race_over_music = true;
|
||||
}
|
||||
catch (std::exception& e)
|
||||
{
|
||||
|
@ -164,6 +164,8 @@ private:
|
||||
* animation can be skipped. */
|
||||
bool m_gp_position_was_changed;
|
||||
|
||||
bool m_started_race_over_music;
|
||||
|
||||
/** The previous monospace state of the font. */
|
||||
//bool m_was_monospace;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user