1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-01-26 03:52:01 +02:00

CVideoPlayer: Make overlay an argument of playVideo() instead of an attribute

This commit is contained in:
Alexander Wilms 2024-01-29 20:20:31 +01:00
parent 70ce090bc4
commit 6085893c0d
2 changed files with 7 additions and 7 deletions

View File

@ -101,8 +101,8 @@ bool CVideoPlayer::open(const VideoPath & fname, bool scale)
}
// loop = to loop through the video
// useOverlay = directly write to the screen.
bool CVideoPlayer::open(const VideoPath & videoToOpen, bool loop, bool useOverlay, bool scale)
// overlay = directly write to the screen.
bool CVideoPlayer::open(const VideoPath & videoToOpen, bool loop, bool overlay, bool scale)
{
close();
@ -199,7 +199,7 @@ bool CVideoPlayer::open(const VideoPath & videoToOpen, bool loop, bool useOverla
}
// Allocate a place to put our YUV image on that screen
if (useOverlay)
if (overlay)
{
texture = SDL_CreateTexture( mainRenderer, SDL_PIXELFORMAT_IYUV, SDL_TEXTUREACCESS_STATIC, pos.w, pos.h);
}
@ -624,7 +624,7 @@ Point CVideoPlayer::size()
}
// Plays a video. Only works for overlays.
bool CVideoPlayer::playVideo(int x, int y, bool stopOnKey)
bool CVideoPlayer::playVideo(int x, int y, bool stopOnKey, bool overlay)
{
// Note: either the windows player or the linux player is
// broken. Compensate here until the bug is found.
@ -683,6 +683,7 @@ bool CVideoPlayer::openAndPlayVideo(const VideoPath & name, int x, int y, EVideo
{
bool scale;
bool stopOnKey;
bool overlay;
switch(videoType)
{
@ -698,7 +699,7 @@ bool CVideoPlayer::openAndPlayVideo(const VideoPath & name, int x, int y, EVideo
overlay = true;
}
open(name, false, true, scale);
bool ret = playVideo(x, y, stopOnKey);
bool ret = playVideo(x, y, stopOnKey, overlay);
close();
return ret;
}

View File

@ -95,9 +95,8 @@ class CVideoPlayer final : public IMainVideoPlayer
/// video playback currnet progress, in seconds
double frameTime;
bool doLoop; // loop through video
bool overlay;
bool playVideo(int x, int y, bool stopOnKey);
bool playVideo(int x, int y, bool stopOnKey, bool overlay);
bool open(const VideoPath & fname, bool loop, bool useOverlay = false, bool scale = false);
public:
CVideoPlayer();