2014-06-20 01:30:09 +00:00
|
|
|
#pragma once
|
2013-04-08 14:41:25 +00:00
|
|
|
|
2013-06-02 15:08:32 +00:00
|
|
|
#include "GuiComponent.h"
|
2013-04-08 14:41:25 +00:00
|
|
|
#include <vector>
|
2013-10-04 23:24:41 +00:00
|
|
|
#include "resources/Font.h"
|
2014-04-18 18:07:32 +00:00
|
|
|
#include "InputManager.h"
|
2013-04-08 14:41:25 +00:00
|
|
|
|
2014-01-25 23:34:29 +00:00
|
|
|
class HelpComponent;
|
2014-03-04 22:48:33 +00:00
|
|
|
class ImageComponent;
|
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;
|
|
|
|
virtual void renderScreenSaver() = 0;
|
|
|
|
virtual bool allowSleep() = 0;
|
|
|
|
virtual void update(int deltaTime) = 0;
|
|
|
|
};
|
|
|
|
|
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-03-25 17:02:28 +00:00
|
|
|
inline int getGuiStackSize() { return 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();
|
|
|
|
|
2013-07-09 10:37:37 +00:00
|
|
|
bool init(unsigned int width = 0, unsigned int height = 0);
|
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
|
|
|
|
2013-12-12 19:48:29 +00:00
|
|
|
void renderLoadingScreen();
|
|
|
|
|
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; }
|
|
|
|
|
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();
|
2016-09-17 13:21:24 +00:00
|
|
|
void renderScreenSaver();
|
2016-12-14 08:30:54 +00:00
|
|
|
void startScreenSaver();
|
|
|
|
void cancelScreenSaver();
|
2016-09-12 11:31:44 +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;
|
|
|
|
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;
|
2017-03-25 17:02:28 +00:00
|
|
|
bool mRenderScreenSaver;
|
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
|
|
|
};
|