|
|
@@ -101,8 +101,8 @@ bool CVideoPlayer::open(const VideoPath & fname, bool scale)
|
|
|
}
|
|
|
|
|
|
// loop = to loop through the video
|
|
|
-// useOverlay = directly write to the screen.
|
|
|
-bool CVideoPlayer::open(const VideoPath & videoToOpen, bool loop, bool useOverlay, bool scale)
|
|
|
+// overlay = directly write to the screen.
|
|
|
+bool CVideoPlayer::open(const VideoPath & videoToOpen, bool loop, bool overlay, bool scale)
|
|
|
{
|
|
|
close();
|
|
|
|
|
|
@@ -199,7 +199,7 @@ bool CVideoPlayer::open(const VideoPath & videoToOpen, bool loop, bool useOverla
|
|
|
}
|
|
|
|
|
|
// Allocate a place to put our YUV image on that screen
|
|
|
- if (useOverlay)
|
|
|
+ if (overlay)
|
|
|
{
|
|
|
texture = SDL_CreateTexture( mainRenderer, SDL_PIXELFORMAT_IYUV, SDL_TEXTUREACCESS_STATIC, pos.w, pos.h);
|
|
|
}
|
|
|
@@ -624,7 +624,7 @@ Point CVideoPlayer::size()
|
|
|
}
|
|
|
|
|
|
// Plays a video. Only works for overlays.
|
|
|
-bool CVideoPlayer::playVideo(int x, int y, bool stopOnKey)
|
|
|
+bool CVideoPlayer::playVideo(int x, int y, bool stopOnKey, bool overlay)
|
|
|
{
|
|
|
// Note: either the windows player or the linux player is
|
|
|
// broken. Compensate here until the bug is found.
|
|
|
@@ -647,7 +647,14 @@ bool CVideoPlayer::playVideo(int x, int y, bool stopOnKey)
|
|
|
|
|
|
SDL_Rect rect = CSDL_Ext::toSDL(pos);
|
|
|
|
|
|
- SDL_RenderFillRect(mainRenderer, &rect);
|
|
|
+ if(overlay)
|
|
|
+ {
|
|
|
+ SDL_RenderFillRect(mainRenderer, &rect);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ SDL_RenderClear(mainRenderer);
|
|
|
+ }
|
|
|
SDL_RenderCopy(mainRenderer, texture, nullptr, &rect);
|
|
|
SDL_RenderPresent(mainRenderer);
|
|
|
|
|
|
@@ -672,10 +679,27 @@ bool CVideoPlayer::playVideo(int x, int y, bool stopOnKey)
|
|
|
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, EVideoType videoType)
|
|
|
{
|
|
|
+ bool scale;
|
|
|
+ bool stopOnKey;
|
|
|
+ bool overlay;
|
|
|
+
|
|
|
+ switch(videoType)
|
|
|
+ {
|
|
|
+ case EVideoType::INTRO:
|
|
|
+ stopOnKey = true;
|
|
|
+ scale = true;
|
|
|
+ overlay = false;
|
|
|
+ break;
|
|
|
+ case EVideoType::SPELLBOOK:
|
|
|
+ default:
|
|
|
+ stopOnKey = false;
|
|
|
+ scale = false;
|
|
|
+ overlay = true;
|
|
|
+ }
|
|
|
open(name, false, true, scale);
|
|
|
- bool ret = playVideo(x, y, stopOnKey);
|
|
|
+ bool ret = playVideo(x, y, stopOnKey, overlay);
|
|
|
close();
|
|
|
return ret;
|
|
|
}
|