mirror of
https://github.com/vcmi/vcmi.git
synced 2025-11-23 22:37:55 +02:00
scaling
This commit is contained in:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user