2014-06-20 01:30:09 +00:00
|
|
|
#pragma once
|
2017-10-31 17:12:50 +00:00
|
|
|
#ifndef ES_CORE_WINDOW_H
|
|
|
|
#define ES_CORE_WInDOW_H
|
2013-04-08 14:41:25 +00:00
|
|
|
|
2017-11-01 22:21:10 +00:00
|
|
|
#include "HelpPrompt.h"
|
|
|
|
#include "InputConfig.h"
|
2017-09-08 14:49:47 +00:00
|
|
|
#include "Settings.h"
|
2017-11-01 22:21:10 +00:00
|
|
|
|
|
|
|
#include <memory>
|
2013-04-08 14:41:25 +00:00
|
|
|
|
2017-06-01 20:08:44 +00:00
|
|
|
class FileData;
|
2017-11-01 22:21:10 +00:00
|
|
|
class Font;
|
|
|
|
class GuiComponent;
|
2014-01-25 23:34:29 +00:00
|
|
|
class HelpComponent;
|
2014-03-04 22:48:33 +00:00
|
|
|
class ImageComponent;
|
2017-11-01 22:21:10 +00:00
|
|
|
class InputConfig;
|
|
|
|
class TextCache;
|
|
|
|
class Transform4x4f;
|
|
|
|
struct HelpStyle;
|
2013-11-12 23:28:15 +00:00
|
|
|
|
2013-04-08 14:41:25 +00:00
|
|
|
class Window
|
|
|
|
{
|
|
|
|
public:
|
2016-12-14 08:30:54 +00:00
|
|
|
class ScreenSaver {
|
|
|
|
public:
|
|
|
|
virtual void startScreenSaver() = 0;
|
|
|
|
virtual void stopScreenSaver() = 0;
|
2017-06-01 20:08:44 +00:00
|
|
|
virtual void nextVideo() = 0;
|
2016-12-14 08:30:54 +00:00
|
|
|
virtual void renderScreenSaver() = 0;
|
|
|
|
virtual bool allowSleep() = 0;
|
|
|
|
virtual void update(int deltaTime) = 0;
|
2017-06-01 20:08:44 +00:00
|
|
|
virtual bool isScreenSaverActive() = 0;
|
|
|
|
virtual FileData* getCurrentGame() = 0;
|
|
|
|
virtual void launchGame() = 0;
|
2019-02-20 07:33:00 +00:00
|
|
|
virtual void resetCounts() = 0;
|
2016-12-14 08:30:54 +00:00
|
|
|
};
|
|
|
|
|
2017-06-12 16:38:59 +00:00
|
|
|
class InfoPopup {
|
|
|
|
public:
|
2017-10-28 20:24:35 +00:00
|
|
|
virtual void render(const Transform4x4f& parentTrans) = 0;
|
2017-06-12 16:38:59 +00:00
|
|
|
virtual void stop() = 0;
|
|
|
|
virtual ~InfoPopup() {};
|
|
|
|
};
|
|
|
|
|
2013-04-08 14:41:25 +00:00
|
|
|
Window();
|
|
|
|
~Window();
|
|
|
|
|
2013-06-02 15:08:32 +00:00
|
|
|
void pushGui(GuiComponent* gui);
|
|
|
|
void removeGui(GuiComponent* gui);
|
|
|
|
GuiComponent* peekGui();
|
2017-11-17 14:58:52 +00:00
|
|
|
inline int getGuiStackSize() { return (int)mGuiStack.size(); }
|
2013-04-08 14:41:25 +00:00
|
|
|
|
2014-04-18 18:07:32 +00:00
|
|
|
void textInput(const char* text);
|
2013-04-08 14:41:25 +00:00
|
|
|
void input(InputConfig* config, Input input);
|
|
|
|
void update(int deltaTime);
|
|
|
|
void render();
|
|
|
|
|
2017-12-01 17:42:27 +00:00
|
|
|
bool init();
|
2013-04-08 17:40:15 +00:00
|
|
|
void deinit();
|
|
|
|
|
2013-07-17 06:47:02 +00:00
|
|
|
void normalizeNextUpdate();
|
|
|
|
|
2014-06-02 00:14:22 +00:00
|
|
|
inline bool isSleeping() const { return mSleeping; }
|
2013-10-13 21:40:36 +00:00
|
|
|
bool getAllowSleep();
|
|
|
|
void setAllowSleep(bool sleep);
|
2017-03-25 17:02:28 +00:00
|
|
|
|
2019-01-31 20:19:34 +00:00
|
|
|
void renderLoadingScreen(std::string text);
|
2013-12-12 19:48:29 +00:00
|
|
|
|
2014-06-20 01:30:09 +00:00
|
|
|
void renderHelpPromptsEarly(); // used to render HelpPrompts before a fade
|
2014-05-29 20:41:47 +00:00
|
|
|
void setHelpPrompts(const std::vector<HelpPrompt>& prompts, const HelpStyle& style);
|
2014-01-25 23:34:29 +00:00
|
|
|
|
2016-12-14 08:30:54 +00:00
|
|
|
void setScreenSaver(ScreenSaver* screenSaver) { mScreenSaver = screenSaver; }
|
2017-06-12 16:38:59 +00:00
|
|
|
void setInfoPopup(InfoPopup* infoPopup) { delete mInfoPopup; mInfoPopup = infoPopup; }
|
|
|
|
inline void stopInfoPopup() { if (mInfoPopup) mInfoPopup->stop(); };
|
2016-12-14 08:30:54 +00:00
|
|
|
|
2017-06-01 20:08:44 +00:00
|
|
|
void startScreenSaver();
|
2019-04-07 12:54:06 +00:00
|
|
|
bool cancelScreenSaver();
|
2017-06-01 20:08:44 +00:00
|
|
|
void renderScreenSaver();
|
2020-06-07 08:57:49 +00:00
|
|
|
bool isScreenSaverActive() { return mRenderScreenSaver; };
|
2017-06-01 20:08:44 +00:00
|
|
|
|
2013-04-08 14:41:25 +00:00
|
|
|
private:
|
2014-06-02 00:14:22 +00:00
|
|
|
void onSleep();
|
|
|
|
void onWake();
|
|
|
|
|
2016-09-12 11:31:44 +00:00
|
|
|
// Returns true if at least one component on the stack is processing
|
|
|
|
bool isProcessing();
|
2019-02-20 07:33:00 +00:00
|
|
|
|
2014-01-25 23:34:29 +00:00
|
|
|
HelpComponent* mHelp;
|
2014-03-04 22:48:33 +00:00
|
|
|
ImageComponent* mBackgroundOverlay;
|
2016-12-14 08:30:54 +00:00
|
|
|
ScreenSaver* mScreenSaver;
|
2017-06-12 16:38:59 +00:00
|
|
|
InfoPopup* mInfoPopup;
|
2016-12-14 08:30:54 +00:00
|
|
|
bool mRenderScreenSaver;
|
2014-03-04 22:48:33 +00:00
|
|
|
|
2013-06-02 15:08:32 +00:00
|
|
|
std::vector<GuiComponent*> mGuiStack;
|
2013-07-03 07:54:55 +00:00
|
|
|
|
|
|
|
std::vector< std::shared_ptr<Font> > mDefaultFonts;
|
2013-07-17 06:47:02 +00:00
|
|
|
|
|
|
|
int mFrameTimeElapsed;
|
|
|
|
int mFrameCountElapsed;
|
|
|
|
int mAverageDeltaTime;
|
2014-04-12 00:42:04 +00:00
|
|
|
|
|
|
|
std::unique_ptr<TextCache> mFrameDataText;
|
2013-07-17 06:47:02 +00:00
|
|
|
|
|
|
|
bool mNormalizeNextUpdate;
|
2013-08-06 13:15:20 +00:00
|
|
|
|
2013-10-13 21:40:36 +00:00
|
|
|
bool mAllowSleep;
|
2014-06-02 00:14:22 +00:00
|
|
|
bool mSleeping;
|
|
|
|
unsigned int mTimeSinceLastInput;
|
|
|
|
|
2014-05-15 01:58:16 +00:00
|
|
|
bool mRenderedHelpPrompts;
|
2013-04-08 14:41:25 +00:00
|
|
|
};
|
2017-10-31 17:12:50 +00:00
|
|
|
|
|
|
|
#endif // ES_CORE_WINDOW_H
|