2020-09-18 16:40:22 +00:00
|
|
|
// SPDX-License-Identifier: MIT
|
2020-06-23 18:07:00 +00:00
|
|
|
//
|
2024-07-10 16:04:40 +00:00
|
|
|
// ES-DE Frontend
|
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"
|
2023-08-20 11:21:11 +00:00
|
|
|
#include "components/ImageComponent.h"
|
|
|
|
#include "components/VideoComponent.h"
|
2022-01-17 17:43:29 +00:00
|
|
|
#include "resources/Font.h"
|
2016-12-14 08:30:54 +00:00
|
|
|
|
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
|
|
|
|
2023-08-20 11:21:11 +00:00
|
|
|
virtual bool isScreensaverActive() { return mScreensaverActive; }
|
2021-07-07 18:03:42 +00:00
|
|
|
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
|
|
|
|
2022-03-14 18:51:48 +00:00
|
|
|
Renderer* mRenderer;
|
2020-11-11 23:46:59 +00:00
|
|
|
Window* mWindow;
|
|
|
|
|
2020-11-10 21:18:20 +00:00
|
|
|
std::vector<FileData*> mImageFiles;
|
|
|
|
std::vector<FileData*> mVideoFiles;
|
2023-08-20 13:28:30 +00:00
|
|
|
std::vector<FileData*> mFilesInventory;
|
2020-11-10 21:18:20 +00:00
|
|
|
std::vector<std::string> mImageCustomFiles;
|
2023-08-20 13:28:30 +00:00
|
|
|
std::vector<std::string> mCustomFilesInventory;
|
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;
|
2023-08-20 11:21:11 +00:00
|
|
|
bool mScreensaverActive;
|
2020-11-12 16:13:24 +00:00
|
|
|
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
|