ES-DE/es-core/src/Window.h

91 lines
2 KiB
C
Raw Normal View History

#pragma once
2013-06-02 15:08:32 +00:00
#include "GuiComponent.h"
#include <vector>
#include "resources/Font.h"
#include "InputManager.h"
class FileData;
class HelpComponent;
class ImageComponent;
class Window
{
public:
class ScreenSaver {
public:
virtual void startScreenSaver() = 0;
virtual void stopScreenSaver() = 0;
virtual void nextVideo() = 0;
virtual void renderScreenSaver() = 0;
virtual bool allowSleep() = 0;
virtual void update(int deltaTime) = 0;
virtual bool isScreenSaverActive() = 0;
virtual FileData* getCurrentGame() = 0;
virtual void launchGame() = 0;
};
Window();
~Window();
2013-06-02 15:08:32 +00:00
void pushGui(GuiComponent* gui);
void removeGui(GuiComponent* gui);
GuiComponent* peekGui();
inline int getGuiStackSize() { return mGuiStack.size(); }
void textInput(const char* text);
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();
void normalizeNextUpdate();
inline bool isSleeping() const { return mSleeping; }
bool getAllowSleep();
void setAllowSleep(bool sleep);
void renderLoadingScreen();
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);
void setScreenSaver(ScreenSaver* screenSaver) { mScreenSaver = screenSaver; }
void startScreenSaver();
void cancelScreenSaver();
void renderScreenSaver();
private:
void onSleep();
void onWake();
// Returns true if at least one component on the stack is processing
bool isProcessing();
HelpComponent* mHelp;
ImageComponent* mBackgroundOverlay;
ScreenSaver* mScreenSaver;
bool mRenderScreenSaver;
2013-06-02 15:08:32 +00:00
std::vector<GuiComponent*> mGuiStack;
std::vector< std::shared_ptr<Font> > mDefaultFonts;
int mFrameTimeElapsed;
int mFrameCountElapsed;
int mAverageDeltaTime;
std::unique_ptr<TextCache> mFrameDataText;
bool mNormalizeNextUpdate;
2013-08-06 13:15:20 +00:00
bool mAllowSleep;
bool mSleeping;
unsigned int mTimeSinceLastInput;
bool mRenderedHelpPrompts;
};