1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-23 22:37:55 +02:00
This commit is contained in:
Laserlicht
2024-09-12 23:06:33 +02:00
parent 822fa61bf2
commit 8fc3fe3cc3
11 changed files with 44 additions and 44 deletions

View File

@@ -17,7 +17,12 @@
#include "../render/Canvas.h"
VideoWidgetBase::VideoWidgetBase(const Point & position, const VideoPath & video, bool playAudio)
: playAudio(playAudio)
: VideoWidgetBase(position, video, playAudio, 1.0)
{
}
VideoWidgetBase::VideoWidgetBase(const Point & position, const VideoPath & video, bool playAudio, float scaleFactor)
: playAudio(playAudio), scaleFactor(scaleFactor)
{
addUsedEvents(TIME);
pos += position;
@@ -28,7 +33,7 @@ VideoWidgetBase::~VideoWidgetBase() = default;
void VideoWidgetBase::playVideo(const VideoPath & fileToPlay)
{
videoInstance = CCS->videoh->open(fileToPlay, Point(0, 0));
videoInstance = CCS->videoh->open(fileToPlay, scaleFactor);
if (videoInstance)
{
pos.w = videoInstance->size().x;
@@ -119,11 +124,6 @@ void VideoWidgetBase::tick(uint32_t msPassed)
}
}
Point VideoWidgetBase::size()
{
return videoInstance->size();
}
VideoWidget::VideoWidget(const Point & position, const VideoPath & prologue, const VideoPath & looped, bool playAudio)
: VideoWidgetBase(position, prologue, playAudio)
, loopedVideo(looped)
@@ -147,6 +147,12 @@ VideoWidgetOnce::VideoWidgetOnce(const Point & position, const VideoPath & video
{
}
VideoWidgetOnce::VideoWidgetOnce(const Point & position, const VideoPath & video, bool playAudio, float scaleFactor, const std::function<void()> & callback)
: VideoWidgetBase(position, video, playAudio, scaleFactor)
, callback(callback)
{
}
void VideoWidgetOnce::onPlaybackFinished()
{
callback();