diff options
| author | Simon Robertshaw <simon@hardwired.org.uk> | 2012-01-17 20:46:06 (GMT) |
|---|---|---|
| committer | Simon Robertshaw <simon@hardwired.org.uk> | 2012-01-17 20:46:06 (GMT) |
| commit | 4a60b97c700c2f1843b7e99313554cb89fb5da4e (patch) | |
| tree | 3b33ef6f74a4e8a4ff5968a81b9c4c429ccaa7c6 /src/interface/Engine.h | |
| parent | 6273089bf486bf46ad325d72c7290ebb272bd3d8 (diff) | |
| download | powder-4a60b97c700c2f1843b7e99313554cb89fb5da4e.zip powder-4a60b97c700c2f1843b7e99313554cb89fb5da4e.tar.gz | |
Some minor changes
Diffstat (limited to 'src/interface/Engine.h')
| -rw-r--r-- | src/interface/Engine.h | 71 |
1 files changed, 71 insertions, 0 deletions
diff --git a/src/interface/Engine.h b/src/interface/Engine.h new file mode 100644 index 0000000..7bf78f9 --- /dev/null +++ b/src/interface/Engine.h @@ -0,0 +1,71 @@ +#pragma once + +#include <stack> +#include <SDL/SDL.h> +#include "Singleton.h" +#include "Platform.h" +#include "Graphics.h" +#include "Window.h" + +namespace ui +{ + class Window; + + /* class Engine + * + * Controls the User Interface. + * Send user inputs to the Engine and the appropriate controls and components will interact. + */ + class Engine: public Singleton<Engine> + { + public: + Engine(); + ~Engine(); + + void ShowWindow(Window * window); + void CloseWindow(); + + void onMouseMove(int x, int y); + void onMouseClick(int x, int y, unsigned button); + void onMouseUnclick(int x, int y, unsigned button); + void onMouseWheel(int x, int y, int delta); + void onKeyPress(int key, bool shift, bool ctrl, bool alt); + void onKeyRelease(int key, bool shift, bool ctrl, bool alt); + void onResize(int newWidth, int newHeight); + void onClose(); + + void Begin(int width, int height); + inline bool Running() { return running_; } + void Exit(); + + void Tick(float dt); + void Draw(); + + inline int GetMouseX() { return mousex_; } + inline int GetMouseY() { return mousey_; } + inline int GetWidth() { return width_; } + inline int GetHeight() { return height_; } + + inline void SetSize(int width, int height); + + //void SetState(Window* state); + //inline State* GetState() { return state_; } + inline Window* GetWindow() { return state_; } + float FpsLimit; + Graphics * g; + private: + std::stack<Window*> windows; + //Window* statequeued_; + Window* state_; + + bool running_; + + int mousex_; + int mousey_; + int mousexp_; + int mouseyp_; + int width_; + int height_; + }; + +} |
