mirror of
https://github.com/vcmi/vcmi.git
synced 2025-08-13 19:54:17 +02:00
CVideoHandler: Call SDL_RenderClear() when playing intro, call SDL_RenderFillRect() for spellbook animation
This commit is contained in:
@@ -430,15 +430,15 @@ void playIntro()
|
|||||||
{
|
{
|
||||||
auto audioData = CCS->videoh->getAudio(VideoPath::builtin("3DOLOGO.SMK"));
|
auto audioData = CCS->videoh->getAudio(VideoPath::builtin("3DOLOGO.SMK"));
|
||||||
int sound = CCS->soundh->playSound(audioData);
|
int sound = CCS->soundh->playSound(audioData);
|
||||||
if(CCS->videoh->openAndPlayVideo(VideoPath::builtin("3DOLOGO.SMK"), 0, 1, true, true))
|
if(CCS->videoh->openAndPlayVideo(VideoPath::builtin("3DOLOGO.SMK"), 0, 1, true, true, false))
|
||||||
{
|
{
|
||||||
audioData = CCS->videoh->getAudio(VideoPath::builtin("NWCLOGO.SMK"));
|
audioData = CCS->videoh->getAudio(VideoPath::builtin("NWCLOGO.SMK"));
|
||||||
sound = CCS->soundh->playSound(audioData);
|
sound = CCS->soundh->playSound(audioData);
|
||||||
if (CCS->videoh->openAndPlayVideo(VideoPath::builtin("NWCLOGO.SMK"), 0, 1, true, true))
|
if (CCS->videoh->openAndPlayVideo(VideoPath::builtin("NWCLOGO.SMK"), 0, 1, true, true, false))
|
||||||
{
|
{
|
||||||
audioData = CCS->videoh->getAudio(VideoPath::builtin("H3INTRO.SMK"));
|
audioData = CCS->videoh->getAudio(VideoPath::builtin("H3INTRO.SMK"));
|
||||||
sound = CCS->soundh->playSound(audioData);
|
sound = CCS->soundh->playSound(audioData);
|
||||||
CCS->videoh->openAndPlayVideo(VideoPath::builtin("H3INTRO.SMK"), 0, 1, true, true);
|
CCS->videoh->openAndPlayVideo(VideoPath::builtin("H3INTRO.SMK"), 0, 1, true, true, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
CCS->soundh->stopSound(sound);
|
CCS->soundh->stopSound(sound);
|
||||||
|
@@ -647,7 +647,14 @@ bool CVideoPlayer::playVideo(int x, int y, bool stopOnKey)
|
|||||||
|
|
||||||
SDL_Rect rect = CSDL_Ext::toSDL(pos);
|
SDL_Rect rect = CSDL_Ext::toSDL(pos);
|
||||||
|
|
||||||
SDL_RenderFillRect(mainRenderer, &rect);
|
if(overlayVideo)
|
||||||
|
{
|
||||||
|
SDL_RenderFillRect(mainRenderer, &rect);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
SDL_RenderClear(mainRenderer);
|
||||||
|
}
|
||||||
SDL_RenderCopy(mainRenderer, texture, nullptr, &rect);
|
SDL_RenderCopy(mainRenderer, texture, nullptr, &rect);
|
||||||
SDL_RenderPresent(mainRenderer);
|
SDL_RenderPresent(mainRenderer);
|
||||||
|
|
||||||
@@ -672,8 +679,9 @@ bool CVideoPlayer::playVideo(int x, int y, bool stopOnKey)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CVideoPlayer::openAndPlayVideo(const VideoPath & name, int x, int y, bool stopOnKey, bool scale)
|
bool CVideoPlayer::openAndPlayVideo(const VideoPath & name, int x, int y, bool stopOnKey, bool scale, bool overlay)
|
||||||
{
|
{
|
||||||
|
overlayVideo = overlay;
|
||||||
open(name, false, true, scale);
|
open(name, false, true, scale);
|
||||||
bool ret = playVideo(x, y, stopOnKey);
|
bool ret = playVideo(x, y, stopOnKey);
|
||||||
close();
|
close();
|
||||||
|
@@ -33,7 +33,7 @@ class IMainVideoPlayer : public IVideoPlayer
|
|||||||
public:
|
public:
|
||||||
virtual ~IMainVideoPlayer() = default;
|
virtual ~IMainVideoPlayer() = default;
|
||||||
virtual void update(int x, int y, SDL_Surface *dst, bool forceRedraw, bool update = true, std::function<void()> restart = nullptr){}
|
virtual void update(int x, int y, SDL_Surface *dst, bool forceRedraw, bool update = true, std::function<void()> restart = nullptr){}
|
||||||
virtual bool openAndPlayVideo(const VideoPath & name, int x, int y, bool stopOnKey = false, bool scale = false)
|
virtual bool openAndPlayVideo(const VideoPath & name, int x, int y, bool stopOnKey = false, bool scale = false, bool overlay = true)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -89,6 +89,7 @@ class CVideoPlayer final : public IMainVideoPlayer
|
|||||||
/// video playback currnet progress, in seconds
|
/// video playback currnet progress, in seconds
|
||||||
double frameTime;
|
double frameTime;
|
||||||
bool doLoop; // loop through video
|
bool doLoop; // loop through video
|
||||||
|
bool overlayVideo;
|
||||||
|
|
||||||
bool playVideo(int x, int y, bool stopOnKey);
|
bool playVideo(int x, int y, bool stopOnKey);
|
||||||
bool open(const VideoPath & fname, bool loop, bool useOverlay = false, bool scale = false);
|
bool open(const VideoPath & fname, bool loop, bool useOverlay = false, bool scale = false);
|
||||||
@@ -106,7 +107,7 @@ public:
|
|||||||
void update(int x, int y, SDL_Surface *dst, bool forceRedraw, bool update = true, std::function<void()> onVideoRestart = nullptr) override; //moves to next frame if appropriate, and blits it or blits only if redraw parameter is set true
|
void update(int x, int y, SDL_Surface *dst, bool forceRedraw, bool update = true, std::function<void()> onVideoRestart = nullptr) override; //moves to next frame if appropriate, and blits it or blits only if redraw parameter is set true
|
||||||
|
|
||||||
// Opens video, calls playVideo, closes video; returns playVideo result (if whole video has been played)
|
// Opens video, calls playVideo, closes video; returns playVideo result (if whole video has been played)
|
||||||
bool openAndPlayVideo(const VideoPath & name, int x, int y, bool stopOnKey = false, bool scale = false) override;
|
bool openAndPlayVideo(const VideoPath & name, int x, int y, bool stopOnKey = false, bool scale = false, bool overlay = true) override;
|
||||||
|
|
||||||
std::pair<std::unique_ptr<ui8 []>, si64> getAudio(const VideoPath & videoToOpen) override;
|
std::pair<std::unique_ptr<ui8 []>, si64> getAudio(const VideoPath & videoToOpen) override;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user