Window.h 1.28 KB
Newer Older
1 2 3
#ifndef _WINDOW_H_
#define _WINDOW_H_

4
#include "GuiComponent.h"
5 6
#include "InputManager.h"
#include <vector>
7
#include "resources/Font.h"
8

9 10
class ViewController;

11 12 13 14 15 16
class Window
{
public:
	Window();
	~Window();

17 18 19
	void pushGui(GuiComponent* gui);
	void removeGui(GuiComponent* gui);
	GuiComponent* peekGui();
20 21 22 23 24

	void input(InputConfig* config, Input input);
	void update(int deltaTime);
	void render();

25
	bool init(unsigned int width = 0, unsigned int height = 0);
Aloshi's avatar
Aloshi committed
26 27
	void deinit();

28 29
	inline InputManager* getInputManager() { return mInputManager; }
	inline ViewController* getViewController() { return mViewController; }
30

31 32
	void normalizeNextUpdate();

33 34 35 36 37
	void setZoomFactor(const float& zoom);
	void setCenterPoint(const Eigen::Vector2f& point);

	void setFadePercent(const float& perc);

38 39 40
	bool getAllowSleep();
	void setAllowSleep(bool sleep);
	
41 42
private:
	InputManager* mInputManager;
43
	ViewController* mViewController;
44
	std::vector<GuiComponent*> mGuiStack;
Aloshi's avatar
Aloshi committed
45 46

	std::vector< std::shared_ptr<Font> > mDefaultFonts;
47 48 49 50 51 52 53

	int mFrameTimeElapsed;
	int mFrameCountElapsed;
	int mAverageDeltaTime;
	std::string mFrameDataString;

	bool mNormalizeNextUpdate;
54 55 56 57 58 59 60 61 62

	float mZoomFactor;
	Eigen::Vector2f mCenterPoint;

	void updateMatrix();
	Eigen::Affine3f mMatrix;

	void postProcess();
	float mFadePercent;
63 64

	bool mAllowSleep;
65 66 67
};

#endif