1
0
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:
Mathieu Schroeter 2017-10-21 21:30:26 +02:00
parent 27d3bc6ac5
commit 10630b4b53
2 changed files with 14 additions and 1 deletions

View File

@ -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);

View File

@ -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
};