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-11-10 21:33:57 +00:00
|
|
|
// SystemScreensaver.h
|
2020-06-23 18:07:00 +00:00
|
|
|
//
|
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;
|
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-12 16:13:24 +00:00
|
|
|
virtual void goToGame();
|
2020-11-10 21:18:20 +00:00
|
|
|
|
|
|
|
virtual void renderScreensaver();
|
|
|
|
virtual void update(int deltaTime);
|
|
|
|
|
|
|
|
virtual FileData* getCurrentGame() { return mCurrentGame; };
|
2020-11-12 16:13:24 +00:00
|
|
|
virtual void triggerNextGame() { mTriggerNextGame = true; };
|
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);
|
2020-11-11 23:46:59 +00:00
|
|
|
void generateOverlayInfo();
|
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-11 23:46:59 +00:00
|
|
|
Window* mWindow;
|
|
|
|
STATE mState;
|
|
|
|
|
2020-11-10 21:18:20 +00:00
|
|
|
std::vector<FileData*> mImageFiles;
|
|
|
|
std::vector<FileData*> mVideoFiles;
|
|
|
|
std::vector<std::string> mImageCustomFiles;
|
2020-06-23 18:07:00 +00:00
|
|
|
ImageComponent* mImageScreensaver;
|
2020-11-11 23:46:59 +00:00
|
|
|
VideoComponent* mVideoScreensaver;
|
|
|
|
|
2020-06-23 18:07:00 +00:00
|
|
|
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;
|
2020-11-11 23:46:59 +00:00
|
|
|
|
|
|
|
int mTimer;
|
2020-11-12 16:13:24 +00:00
|
|
|
int mMediaSwapTime;
|
|
|
|
bool mTriggerNextGame;
|
2020-11-11 23:46:59 +00:00
|
|
|
bool mHasMediaFiles;
|
|
|
|
float mOpacity;
|
|
|
|
float mDimValue;
|
|
|
|
unsigned char mRectangleFadeIn;
|
|
|
|
unsigned char mTextFadeIn;
|
|
|
|
float mSaturationAmount;
|
|
|
|
|
|
|
|
std::unique_ptr<TextCache> mGameOverlay;
|
|
|
|
std::vector<std::shared_ptr<Font>> mGameOverlayFont;
|
|
|
|
std::vector<float> mGameOverlayRectangleCoords;
|
2016-12-14 08:30:54 +00:00
|
|
|
};
|
2017-10-31 17:12:50 +00:00
|
|
|
|
|
|
|
#endif // ES_APP_SYSTEM_SCREEN_SAVER_H
|