2020-09-18 16:40:22 +00:00
|
|
|
// SPDX-License-Identifier: MIT
|
2020-06-23 18:07:00 +00:00
|
|
|
//
|
2020-09-18 16:40:22 +00:00
|
|
|
// EmulationStation Desktop Edition
|
2020-06-23 18:07:00 +00:00
|
|
|
// SystemScreenSaver.h
|
|
|
|
//
|
2020-11-10 21:18:20 +00:00
|
|
|
// Screensaver, supporting the following types:
|
2020-07-27 14:53:54 +00:00
|
|
|
// Dim, black, slideshow, video.
|
2020-06-23 18:07:00 +00:00
|
|
|
//
|
|
|
|
|
2017-10-31 17:12:50 +00:00
|
|
|
#ifndef ES_APP_SYSTEM_SCREEN_SAVER_H
|
|
|
|
#define ES_APP_SYSTEM_SCREEN_SAVER_H
|
2016-12-14 08:30:54 +00:00
|
|
|
|
|
|
|
#include "Window.h"
|
|
|
|
|
2017-09-09 03:45:50 +00:00
|
|
|
class ImageComponent;
|
|
|
|
class Sound;
|
2017-11-01 22:21:10 +00:00
|
|
|
class VideoComponent;
|
2016-12-14 08:30:54 +00:00
|
|
|
|
2020-11-10 21:18:20 +00:00
|
|
|
// Screensaver implementation.
|
|
|
|
class SystemScreensaver : public Window::Screensaver
|
2016-12-14 08:30:54 +00:00
|
|
|
{
|
|
|
|
public:
|
2020-11-10 21:18:20 +00:00
|
|
|
SystemScreensaver(Window* window);
|
|
|
|
virtual ~SystemScreensaver();
|
2016-12-14 08:30:54 +00:00
|
|
|
|
2020-06-23 18:07:00 +00:00
|
|
|
virtual bool allowSleep();
|
2020-11-10 21:18:20 +00:00
|
|
|
virtual bool isScreensaverActive();
|
2017-06-01 20:08:44 +00:00
|
|
|
|
2020-11-10 21:18:20 +00:00
|
|
|
virtual void startScreensaver(bool generateMediaList);
|
|
|
|
virtual void stopScreensaver();
|
|
|
|
virtual void nextGame();
|
2020-06-23 18:07:00 +00:00
|
|
|
virtual void launchGame();
|
2020-11-10 21:18:20 +00:00
|
|
|
|
|
|
|
virtual void renderScreensaver();
|
|
|
|
virtual void update(int deltaTime);
|
|
|
|
|
|
|
|
virtual bool getHasMediaFiles() { return mHasMediaFiles; };
|
|
|
|
virtual FileData* getCurrentGame() { return mCurrentGame; };
|
2016-12-14 08:30:54 +00:00
|
|
|
|
|
|
|
private:
|
2020-11-10 21:18:20 +00:00
|
|
|
void generateImageList();
|
|
|
|
void generateVideoList();
|
|
|
|
void generateCustomImageList();
|
|
|
|
void pickRandomImage(std::string& path);
|
2020-06-23 18:07:00 +00:00
|
|
|
void pickRandomVideo(std::string& path);
|
|
|
|
void pickRandomCustomImage(std::string& path);
|
2016-12-14 08:30:54 +00:00
|
|
|
|
2020-06-23 18:07:00 +00:00
|
|
|
enum STATE {
|
|
|
|
STATE_INACTIVE,
|
|
|
|
STATE_FADE_OUT_WINDOW,
|
|
|
|
STATE_FADE_IN_VIDEO,
|
|
|
|
STATE_SCREENSAVER_ACTIVE
|
|
|
|
};
|
2016-12-14 08:30:54 +00:00
|
|
|
|
2020-11-10 21:18:20 +00:00
|
|
|
std::vector<FileData*> mImageFiles;
|
|
|
|
std::vector<FileData*> mVideoFiles;
|
|
|
|
std::vector<std::string> mImageCustomFiles;
|
|
|
|
bool mHasMediaFiles;
|
2020-06-23 18:07:00 +00:00
|
|
|
VideoComponent* mVideoScreensaver;
|
|
|
|
ImageComponent* mImageScreensaver;
|
|
|
|
Window* mWindow;
|
|
|
|
STATE mState;
|
|
|
|
float mOpacity;
|
|
|
|
int mTimer;
|
|
|
|
FileData* mCurrentGame;
|
2020-07-28 09:10:14 +00:00
|
|
|
FileData* mPreviousGame;
|
2020-11-10 21:18:20 +00:00
|
|
|
std::string mPreviousCustomImage;
|
2020-06-23 18:07:00 +00:00
|
|
|
std::string mGameName;
|
|
|
|
std::string mSystemName;
|
|
|
|
int mVideoChangeTime;
|
2016-12-14 08:30:54 +00:00
|
|
|
};
|
2017-10-31 17:12:50 +00:00
|
|
|
|
|
|
|
#endif // ES_APP_SYSTEM_SCREEN_SAVER_H
|