1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-29 23:07:48 +02:00

Make scale a parameter of "open" methods

This commit is contained in:
AlexVinS
2014-07-10 14:18:21 +04:00
parent 18f34e14f8
commit 679dd64ff9
4 changed files with 28 additions and 47 deletions

View File

@@ -71,18 +71,16 @@ CVideoPlayer::CVideoPlayer()
// combination of av_register_input_format() /
// av_register_output_format() / av_register_protocol() instead.
av_register_all();
doScale = false;
}
bool CVideoPlayer::open(std::string fname)
bool CVideoPlayer::open(std::string fname, bool scale/* = false*/)
{
return open(fname, true, false);
}
// loop = to loop through the video
// useOverlay = directly write to the screen.
bool CVideoPlayer::open(std::string fname, bool loop, bool useOverlay)
bool CVideoPlayer::open(std::string fname, bool loop, bool useOverlay, bool scale /*= false*/)
{
close();
@@ -167,7 +165,7 @@ bool CVideoPlayer::open(std::string fname, bool loop, bool useOverlay)
//setup scaling
if(doScale)
if(scale)
{
pos.w = screen->w;
pos.h = screen->h;
@@ -480,9 +478,9 @@ bool CVideoPlayer::playVideo(int x, int y, SDL_Surface *dst, bool stopOnKey)
return true;
}
bool CVideoPlayer::openAndPlayVideo(std::string name, int x, int y, SDL_Surface *dst, bool stopOnKey)
bool CVideoPlayer::openAndPlayVideo(std::string name, int x, int y, SDL_Surface *dst, bool stopOnKey, bool scale/* = false*/)
{
open(name, false, true);
open(name, false, true, scale);
bool ret = playVideo(x, y, dst, stopOnKey);
close();
return ret;