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
27d3bc6ac5
commit
10630b4b53
@ -121,7 +121,7 @@ CMovie::fileOpenMovie (const std::string & pFilename)
|
|||||||
SDL_PauseAudioDevice (m_audioDev, 0);
|
SDL_PauseAudioDevice (m_audioDev, 0);
|
||||||
|
|
||||||
m_videoTex = SDL_CreateTexture (
|
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);
|
info.video.height);
|
||||||
|
|
||||||
if (m_videoTex == nullptr)
|
if (m_videoTex == nullptr)
|
||||||
@ -146,7 +146,10 @@ CMovie::playMovie ()
|
|||||||
|
|
||||||
// play/pause the AVI movie
|
// play/pause the AVI movie
|
||||||
if (m_fPlaying)
|
if (m_fPlaying)
|
||||||
|
{
|
||||||
|
this->starting = true;
|
||||||
Kit_PlayerPlay (m_player);
|
Kit_PlayerPlay (m_player);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
Kit_PlayerPause (m_player);
|
Kit_PlayerPause (m_player);
|
||||||
}
|
}
|
||||||
@ -290,6 +293,15 @@ CMovie::Render ()
|
|||||||
SDL_SetRenderDrawColor (g_renderer, 0, 0, 0, 255);
|
SDL_SetRenderDrawColor (g_renderer, 0, 0, 0, 255);
|
||||||
SDL_RenderClear (g_renderer);
|
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
|
// Refresh videotexture and render it
|
||||||
Kit_GetVideoData (m_player, m_videoTex);
|
Kit_GetVideoData (m_player, m_videoTex);
|
||||||
|
|
||||||
|
@ -60,6 +60,7 @@ protected:
|
|||||||
|
|
||||||
char m_audiobuf[AUDIOBUFFER_SIZE];
|
char m_audiobuf[AUDIOBUFFER_SIZE];
|
||||||
bool m_bEnable;
|
bool m_bEnable;
|
||||||
|
bool starting;
|
||||||
bool m_fPlaying; // Play flag: true == playing, false == paused
|
bool m_fPlaying; // Play flag: true == playing, false == paused
|
||||||
bool m_fMovieOpen; // Open flag: true == movie open, false = none
|
bool m_fMovieOpen; // Open flag: true == movie open, false = none
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user