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
|
2022-01-17 17:43:29 +00:00
|
|
|
// Screensaver.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
|
|
|
//
|
|
|
|
|
2022-01-17 17:43:29 +00:00
|
|
|
#ifndef ES_APP_SCREENSAVER_H
|
|
|
|
#define ES_APP_SCREENSAVER_H
|
2016-12-14 08:30:54 +00:00
|
|
|
|
|
|
|
#include "Window.h"
|
2022-01-17 17:43:29 +00:00
|
|
|
#include "resources/Font.h"
|
2016-12-14 08:30:54 +00:00
|
|
|
|
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.
|
2022-01-17 17:43:29 +00:00
|
|
|
class Screensaver : public Window::Screensaver
|
2016-12-14 08:30:54 +00:00
|
|
|
{
|
|
|
|
public:
|
2022-01-17 17:43:29 +00:00
|
|
|
Screensaver();
|
2016-12-14 08:30:54 +00:00
|
|
|
|
2021-07-07 18:03:42 +00:00
|
|
|
virtual bool isScreensaverActive() { return (mState != STATE_INACTIVE); }
|
|
|
|
virtual bool isFallbackScreensaver() { return mFallbackScreensaver; }
|
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);
|
|
|
|
|
2021-07-07 18:03:42 +00:00
|
|
|
virtual FileData* getCurrentGame() { return mCurrentGame; }
|
|
|
|
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
|
|
|
|
2022-03-14 18:51:48 +00:00
|
|
|
Renderer* mRenderer;
|
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;
|
2022-09-16 17:18:43 +00:00
|
|
|
std::unique_ptr<ImageComponent> mImageScreensaver;
|
|
|
|
std::unique_ptr<VideoComponent> mVideoScreensaver;
|
2020-11-11 23:46:59 +00:00
|
|
|
|
2020-06-23 18:07:00 +00:00
|
|
|
FileData* mCurrentGame;
|
2020-07-28 09:10:14 +00:00
|
|
|
FileData* mPreviousGame;
|
2022-09-16 17:18:43 +00:00
|
|
|
std::string mScreensaverType;
|
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;
|
2021-03-18 19:07:07 +00:00
|
|
|
bool mFallbackScreensaver;
|
2020-11-11 23:46:59 +00:00
|
|
|
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
|
|
|
|
2022-01-17 17:43:29 +00:00
|
|
|
#endif // ES_APP_SCREENSAVER_H
|