2016-12-14 08:30:54 +00:00
|
|
|
#pragma once
|
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
|
|
|
|
|
|
|
// Screensaver implementation for main window
|
|
|
|
class SystemScreenSaver : public Window::ScreenSaver
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
SystemScreenSaver(Window* window);
|
|
|
|
virtual ~SystemScreenSaver();
|
|
|
|
|
|
|
|
virtual void startScreenSaver();
|
|
|
|
virtual void stopScreenSaver();
|
2017-06-01 20:08:44 +00:00
|
|
|
virtual void nextVideo();
|
2016-12-14 08:30:54 +00:00
|
|
|
virtual void renderScreenSaver();
|
|
|
|
virtual bool allowSleep();
|
|
|
|
virtual void update(int deltaTime);
|
2017-06-01 20:08:44 +00:00
|
|
|
virtual bool isScreenSaverActive();
|
|
|
|
|
|
|
|
virtual FileData* getCurrentGame();
|
|
|
|
virtual void launchGame();
|
2016-12-14 08:30:54 +00:00
|
|
|
|
|
|
|
private:
|
2017-09-09 03:45:50 +00:00
|
|
|
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);
|
2016-12-14 08:30:54 +00:00
|
|
|
|
2017-06-01 20:08:44 +00:00
|
|
|
void input(InputConfig* config, Input input);
|
|
|
|
|
2016-12-14 08:30:54 +00:00
|
|
|
enum STATE {
|
|
|
|
STATE_INACTIVE,
|
|
|
|
STATE_FADE_OUT_WINDOW,
|
|
|
|
STATE_FADE_IN_VIDEO,
|
|
|
|
STATE_SCREENSAVER_ACTIVE
|
|
|
|
};
|
|
|
|
|
|
|
|
private:
|
2017-09-09 03:45:50 +00:00
|
|
|
bool mVideosCounted;
|
|
|
|
unsigned long mVideoCount;
|
|
|
|
VideoComponent* mVideoScreensaver;
|
|
|
|
bool mImagesCounted;
|
|
|
|
unsigned long mImageCount;
|
|
|
|
ImageComponent* mImageScreensaver;
|
2016-12-14 08:30:54 +00:00
|
|
|
Window* mWindow;
|
|
|
|
STATE mState;
|
|
|
|
float mOpacity;
|
|
|
|
int mTimer;
|
2017-06-01 20:08:44 +00:00
|
|
|
FileData* mCurrentGame;
|
|
|
|
std::string mGameName;
|
2017-08-02 19:56:33 +00:00
|
|
|
std::string mSystemName;
|
2017-08-23 08:21:31 +00:00
|
|
|
int mVideoChangeTime;
|
2017-09-09 03:45:50 +00:00
|
|
|
std::shared_ptr<Sound> mBackgroundAudio;
|
|
|
|
bool mStopBackgroundAudio;
|
2016-12-14 08:30:54 +00:00
|
|
|
};
|
2017-10-31 17:12:50 +00:00
|
|
|
|
|
|
|
#endif // ES_APP_SYSTEM_SCREEN_SAVER_H
|