ES-DE/es-app/src/SystemScreenSaver.h

77 lines
2 KiB
C++

// SPDX-License-Identifier: MIT
//
// EmulationStation Desktop Edition
// SystemScreenSaver.h
//
// Screensaver, supporting the following modes:
// Dim, black, slideshow, video.
//
#ifndef ES_APP_SYSTEM_SCREEN_SAVER_H
#define ES_APP_SYSTEM_SCREEN_SAVER_H
#include "Window.h"
class ImageComponent;
class Sound;
class VideoComponent;
// Screensaver implementation for main window.
class SystemScreenSaver : public Window::ScreenSaver
{
public:
SystemScreenSaver(Window* window);
virtual ~SystemScreenSaver();
virtual void startScreenSaver();
virtual void stopScreenSaver();
virtual void nextGame();
virtual void renderScreenSaver();
virtual bool allowSleep();
virtual void update(int deltaTime);
virtual bool isScreenSaverActive();
virtual FileData* getCurrentGame();
virtual void launchGame();
virtual void resetCounts() { mVideosCounted = false; mImagesCounted = false; };
virtual unsigned int getVideoCount() { return mVideoCount; };
private:
unsigned long countGameListNodes(const char *nodeName);
void countVideos();
void countImages();
void pickGameListNode(unsigned long index, const char *nodeName, std::string& path);
void pickRandomVideo(std::string& path);
void pickRandomGameListImage(std::string& path);
void pickRandomCustomImage(std::string& path);
void input(InputConfig* config, Input input);
enum STATE {
STATE_INACTIVE,
STATE_FADE_OUT_WINDOW,
STATE_FADE_IN_VIDEO,
STATE_SCREENSAVER_ACTIVE
};
bool mVideosCounted;
unsigned long mVideoCount;
VideoComponent* mVideoScreensaver;
bool mImagesCounted;
unsigned long mImageCount;
ImageComponent* mImageScreensaver;
Window* mWindow;
STATE mState;
float mOpacity;
int mTimer;
FileData* mCurrentGame;
FileData* mPreviousGame;
std::string mGameName;
std::string mSystemName;
int mVideoChangeTime;
std::shared_ptr<Sound> mBackgroundAudio;
bool mStopBackgroundAudio;
};
#endif // ES_APP_SYSTEM_SCREEN_SAVER_H