mirror of
https://github.com/blupi-games/planetblupi
synced 2024-12-30 10:15:36 +01:00
Pause and resume the movies when the window lost the focus
This commit is contained in:
parent
36d0a341bb
commit
c7e79eb8f4
@ -324,6 +324,8 @@ void WindowProc2 (const SDL_Event &event)
|
|||||||
}
|
}
|
||||||
SDL_SetWindowTitle (g_window, "Blupi");
|
SDL_SetWindowTitle (g_window, "Blupi");
|
||||||
if (g_pSound != nullptr) g_pSound->RestartMusic ();
|
if (g_pSound != nullptr) g_pSound->RestartMusic ();
|
||||||
|
if (g_pMovie)
|
||||||
|
g_pMovie->Resume ();
|
||||||
return;
|
return;
|
||||||
|
|
||||||
case SDL_WINDOWEVENT_FOCUS_LOST:
|
case SDL_WINDOWEVENT_FOCUS_LOST:
|
||||||
@ -333,6 +335,8 @@ void WindowProc2 (const SDL_Event &event)
|
|||||||
}
|
}
|
||||||
SDL_SetWindowTitle (g_window, "Blupi -- stop");
|
SDL_SetWindowTitle (g_window, "Blupi -- stop");
|
||||||
if (g_pSound != nullptr) g_pSound->SuspendMusic ();
|
if (g_pSound != nullptr) g_pSound->SuspendMusic ();
|
||||||
|
if (g_pMovie)
|
||||||
|
g_pMovie->Pause ();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
22
movie.cpp
22
movie.cpp
@ -250,6 +250,28 @@ void CMovie::Stop()
|
|||||||
SDL_RenderSetLogicalSize (g_renderer, 0, 0);
|
SDL_RenderSetLogicalSize (g_renderer, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CMovie::Pause ()
|
||||||
|
{
|
||||||
|
if (!m_bEnable || !m_fPlaying)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (Kit_GetPlayerState (m_player) != KIT_PLAYING)
|
||||||
|
return;
|
||||||
|
|
||||||
|
Kit_PlayerPause (m_player);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CMovie::Resume ()
|
||||||
|
{
|
||||||
|
if (!m_bEnable || !m_fPlaying)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (Kit_GetPlayerState (m_player) != KIT_PAUSED)
|
||||||
|
return;
|
||||||
|
|
||||||
|
Kit_PlayerPlay (m_player);
|
||||||
|
}
|
||||||
|
|
||||||
bool CMovie::Render ()
|
bool CMovie::Render ()
|
||||||
{
|
{
|
||||||
if (!m_bEnable || !m_fPlaying)
|
if (!m_bEnable || !m_fPlaying)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user