mirror of
https://github.com/blupi-games/planetblupi
synced 2024-12-30 10:15:36 +01:00
Clear the texture when the movie is starting
Otherwise it's possible to see garbage with the first frame.
This commit is contained in:
parent
37da5b3b07
commit
c8cf431e38
@ -121,7 +121,7 @@ CMovie::fileOpenMovie (const std::string & pFilename)
|
||||
SDL_PauseAudioDevice (m_audioDev, 0);
|
||||
|
||||
m_videoTex = SDL_CreateTexture (
|
||||
g_renderer, info.video.format, SDL_TEXTUREACCESS_STATIC, info.video.width,
|
||||
g_renderer, info.video.format, SDL_TEXTUREACCESS_TARGET, info.video.width,
|
||||
info.video.height);
|
||||
|
||||
if (m_videoTex == nullptr)
|
||||
@ -146,7 +146,10 @@ CMovie::playMovie ()
|
||||
|
||||
// play/pause the AVI movie
|
||||
if (m_fPlaying)
|
||||
{
|
||||
this->starting = true;
|
||||
Kit_PlayerPlay (m_player);
|
||||
}
|
||||
else
|
||||
Kit_PlayerPause (m_player);
|
||||
}
|
||||
@ -290,6 +293,15 @@ CMovie::Render ()
|
||||
SDL_SetRenderDrawColor (g_renderer, 0, 0, 0, 255);
|
||||
SDL_RenderClear (g_renderer);
|
||||
|
||||
if (this->starting)
|
||||
{
|
||||
SDL_SetRenderTarget (g_renderer, m_videoTex);
|
||||
SDL_SetRenderDrawColor (g_renderer, 0, 0, 0, 255);
|
||||
SDL_RenderClear (g_renderer);
|
||||
SDL_SetRenderTarget (g_renderer, nullptr);
|
||||
this->starting = false;
|
||||
}
|
||||
|
||||
// Refresh videotexture and render it
|
||||
Kit_GetVideoData (m_player, m_videoTex);
|
||||
SDL_RenderCopy (g_renderer, m_videoTex, nullptr, nullptr);
|
||||
|
@ -60,6 +60,7 @@ protected:
|
||||
|
||||
char m_audiobuf[AUDIOBUFFER_SIZE];
|
||||
bool m_bEnable;
|
||||
bool starting;
|
||||
bool m_fPlaying; // Play flag: true == playing, false == paused
|
||||
bool m_fMovieOpen; // Open flag: true == movie open, false = none
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user