mirror of
https://github.com/Heretek-AI/GDevelop.git
synced 2026-07-25 04:15:49 -04:00
119 lines
2.8 KiB
C++
119 lines
2.8 KiB
C++
/**
|
|
|
|
GDevelop - Video Object Extension
|
|
Copyright (c) 2010-2014 Florian Rival (Florian.Rival@gmail.com)
|
|
This project is released under the MIT License.
|
|
*/
|
|
|
|
#ifndef VIDEOWRAPPER_H
|
|
#define VIDEOWRAPPER_H
|
|
class TheoraVideoClip;
|
|
class TheoraVideoManager;
|
|
namespace sf
|
|
{
|
|
class Texture;
|
|
class Sprite;
|
|
}
|
|
#include <iostream>
|
|
|
|
/**
|
|
* \brief VideoWrapper is used to hide implementation details from VideoObject interface.
|
|
*/
|
|
class GD_EXTENSION_API VideoWrapper
|
|
{
|
|
public:
|
|
VideoWrapper();
|
|
virtual ~VideoWrapper();
|
|
/**
|
|
* VideoWrapper have special copy constructor behaviour : It does not copy the video
|
|
* being played.
|
|
*/
|
|
VideoWrapper(const VideoWrapper & other) :
|
|
renderSprite(NULL),
|
|
currentFrameImage(NULL),
|
|
clip(NULL)
|
|
{
|
|
Init(other);
|
|
};
|
|
/**
|
|
* VideoWrapper have special assignement operator behaviour : It does not copy the video
|
|
* being played.
|
|
*/
|
|
VideoWrapper & operator=(const VideoWrapper & other)
|
|
{
|
|
if ( &other != this ) Init(other);
|
|
|
|
return *this;
|
|
}
|
|
|
|
/**
|
|
* Load a new clip.
|
|
*/
|
|
bool Load(std::string filename);
|
|
|
|
/**
|
|
* Return true if the current video clip is valid.
|
|
*/
|
|
bool IsValid() const { return valid; };
|
|
|
|
/**
|
|
* Update current frame image and return it.
|
|
*/
|
|
const sf::Texture & GetNextFrameImage();
|
|
|
|
/**
|
|
* Update video clip time.
|
|
*/
|
|
void UpdateTime(float time);
|
|
|
|
/**
|
|
* Set the looping of the video
|
|
*/
|
|
void SetLooping(bool loop_);
|
|
|
|
/**
|
|
* Go to a certain position in the video.
|
|
*/
|
|
void Seek(float time);
|
|
|
|
/**
|
|
* Pause or unpause the video clip.
|
|
*/
|
|
void SetPause(bool pause);
|
|
|
|
/**
|
|
* Restart video from beginning
|
|
*/
|
|
void Restart();
|
|
|
|
/**
|
|
* Return current position in the video.
|
|
*/
|
|
float GetTimePosition() const;
|
|
|
|
/**
|
|
* Return length of the video.
|
|
*/
|
|
float GetDuration() const;
|
|
|
|
unsigned int GetVolume();
|
|
void SetVolume(unsigned int vol);
|
|
|
|
sf::Sprite & GetRenderSprite() { return *renderSprite; }
|
|
const sf::Sprite & GetRenderSprite() const { return *renderSprite; }
|
|
|
|
private:
|
|
|
|
void Init(const VideoWrapper & other);
|
|
|
|
sf::Sprite * renderSprite; ///<SFML sprite to be displayed
|
|
sf::Texture * currentFrameImage; ///<SFML Texture to be displayed using renderSprite
|
|
TheoraVideoClip * clip; ///< Theora video clip.
|
|
bool started;
|
|
bool valid; ///< True if the clip is valid
|
|
unsigned int volume;
|
|
};
|
|
|
|
#endif // VIDEOWRAPPER_H
|
|
|