|
@@ -9,6 +9,7 @@
|
|
*/
|
|
*/
|
|
#include "StdInc.h"
|
|
#include "StdInc.h"
|
|
#include "VideoWidget.h"
|
|
#include "VideoWidget.h"
|
|
|
|
+#include "TextControls.h"
|
|
|
|
|
|
#include "../CGameInfo.h"
|
|
#include "../CGameInfo.h"
|
|
#include "../gui/CGuiHandler.h"
|
|
#include "../gui/CGuiHandler.h"
|
|
@@ -33,11 +34,14 @@ VideoWidgetBase::~VideoWidgetBase() = default;
|
|
|
|
|
|
void VideoWidgetBase::playVideo(const VideoPath & fileToPlay)
|
|
void VideoWidgetBase::playVideo(const VideoPath & fileToPlay)
|
|
{
|
|
{
|
|
|
|
+ OBJECT_CONSTRUCTION;
|
|
|
|
+
|
|
videoInstance = CCS->videoh->open(fileToPlay, scaleFactor);
|
|
videoInstance = CCS->videoh->open(fileToPlay, scaleFactor);
|
|
if (videoInstance)
|
|
if (videoInstance)
|
|
{
|
|
{
|
|
pos.w = videoInstance->size().x;
|
|
pos.w = videoInstance->size().x;
|
|
pos.h = videoInstance->size().y;
|
|
pos.h = videoInstance->size().y;
|
|
|
|
+ subTitle = std::make_unique<CMultiLineLabel>(Rect(0, (pos.h / 5) * 4, pos.w, pos.h / 5), EFonts::FONT_HIGH_SCORE, ETextAlignment::CENTER, Colors::WHITE, "");
|
|
}
|
|
}
|
|
|
|
|
|
if (playAudio)
|
|
if (playAudio)
|
|
@@ -52,6 +56,8 @@ void VideoWidgetBase::show(Canvas & to)
|
|
{
|
|
{
|
|
if(videoInstance)
|
|
if(videoInstance)
|
|
videoInstance->show(pos.topLeft(), to);
|
|
videoInstance->show(pos.topLeft(), to);
|
|
|
|
+ if(subTitle)
|
|
|
|
+ subTitle->showAll(to);
|
|
}
|
|
}
|
|
|
|
|
|
void VideoWidgetBase::loadAudio(const VideoPath & fileToPlay)
|
|
void VideoWidgetBase::loadAudio(const VideoPath & fileToPlay)
|
|
@@ -107,6 +113,8 @@ void VideoWidgetBase::showAll(Canvas & to)
|
|
{
|
|
{
|
|
if(videoInstance)
|
|
if(videoInstance)
|
|
videoInstance->show(pos.topLeft(), to);
|
|
videoInstance->show(pos.topLeft(), to);
|
|
|
|
+ if(subTitle)
|
|
|
|
+ subTitle->showAll(to);
|
|
}
|
|
}
|
|
|
|
|
|
void VideoWidgetBase::tick(uint32_t msPassed)
|
|
void VideoWidgetBase::tick(uint32_t msPassed)
|
|
@@ -122,6 +130,8 @@ void VideoWidgetBase::tick(uint32_t msPassed)
|
|
onPlaybackFinished();
|
|
onPlaybackFinished();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+ if(subTitle && videoInstance)
|
|
|
|
+ subTitle->setText(std::to_string(std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::system_clock::now().time_since_epoch()).count()) + "\n" + std::to_string(msPassed) + "\n" + std::to_string(videoInstance->timeStamp()));
|
|
}
|
|
}
|
|
|
|
|
|
VideoWidget::VideoWidget(const Point & position, const VideoPath & prologue, const VideoPath & looped, bool playAudio)
|
|
VideoWidget::VideoWidget(const Point & position, const VideoPath & prologue, const VideoPath & looped, bool playAudio)
|