|
@@ -10,6 +10,7 @@
|
|
|
#pragma once
|
|
|
|
|
|
#include "../lib/Rect.h"
|
|
|
+#include "../lib/filesystem/ResourcePath.h"
|
|
|
|
|
|
struct SDL_Surface;
|
|
|
struct SDL_Texture;
|
|
@@ -17,7 +18,7 @@ struct SDL_Texture;
|
|
|
class IVideoPlayer
|
|
|
{
|
|
|
public:
|
|
|
- virtual bool open(std::string name, bool scale = false)=0; //true - succes
|
|
|
+ virtual bool open(const VideoPath & name, bool scale = false)=0; //true - succes
|
|
|
virtual void close()=0;
|
|
|
virtual bool nextFrame()=0;
|
|
|
virtual void show(int x, int y, SDL_Surface *dst, bool update = true)=0;
|
|
@@ -30,10 +31,10 @@ public:
|
|
|
class IMainVideoPlayer : public IVideoPlayer
|
|
|
{
|
|
|
public:
|
|
|
- std::string fname; //name of current video file (empty if idle)
|
|
|
+ VideoPath fname; //name of current video file (empty if idle)
|
|
|
|
|
|
virtual void update(int x, int y, SDL_Surface *dst, bool forceRedraw, bool update = true){}
|
|
|
- virtual bool openAndPlayVideo(std::string 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)
|
|
|
{
|
|
|
return false;
|
|
|
}
|
|
@@ -49,7 +50,7 @@ public:
|
|
|
bool nextFrame() override {return false;};
|
|
|
void close() override {};
|
|
|
bool wait() override {return false;};
|
|
|
- bool open(std::string name, bool scale = false) override {return false;};
|
|
|
+ bool open(const VideoPath & name, bool scale = false) override {return false;};
|
|
|
};
|
|
|
|
|
|
#ifndef DISABLE_VIDEO
|
|
@@ -85,14 +86,14 @@ class CVideoPlayer : public IMainVideoPlayer
|
|
|
bool doLoop; // loop through video
|
|
|
|
|
|
bool playVideo(int x, int y, bool stopOnKey);
|
|
|
- bool open(std::string fname, bool loop, bool useOverlay = false, bool scale = false);
|
|
|
+ bool open(const VideoPath & fname, bool loop, bool useOverlay = false, bool scale = false);
|
|
|
|
|
|
public:
|
|
|
CVideoPlayer();
|
|
|
~CVideoPlayer();
|
|
|
|
|
|
bool init();
|
|
|
- bool open(std::string fname, bool scale = false) override;
|
|
|
+ bool open(const VideoPath & fname, bool scale = false) override;
|
|
|
void close() override;
|
|
|
bool nextFrame() override; // display next frame
|
|
|
|
|
@@ -101,7 +102,7 @@ public:
|
|
|
void update(int x, int y, SDL_Surface *dst, bool forceRedraw, bool update = true) 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)
|
|
|
- bool openAndPlayVideo(std::string 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) override;
|
|
|
|
|
|
//TODO:
|
|
|
bool wait() override {return false;};
|