diff options
| author | Simon Robertshaw <simon@hardwired.org.uk> | 2012-01-08 17:39:03 (GMT) |
|---|---|---|
| committer | Simon Robertshaw <simon@hardwired.org.uk> | 2012-01-08 17:39:03 (GMT) |
| commit | b0ea52690ba56a0d0602ad8674b7e5ab2ba3e778 (patch) | |
| tree | 7d72e0509f4d2643d3be837a337d088ca5949c73 /includes/interface/State.h | |
| download | powder-b0ea52690ba56a0d0602ad8674b7e5ab2ba3e778.zip powder-b0ea52690ba56a0d0602ad8674b7e5ab2ba3e778.tar.gz | |
Initial
Diffstat (limited to 'includes/interface/State.h')
| -rw-r--r-- | includes/interface/State.h | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/includes/interface/State.h b/includes/interface/State.h new file mode 100644 index 0000000..00df199 --- /dev/null +++ b/includes/interface/State.h @@ -0,0 +1,61 @@ +/* + * State.h + * + * Created on: Jan 8, 2012 + * Author: Simon + */ + +#ifndef STATE_H_ +#define STATE_H_ + +#include <vector> + +#include "interface/Component.h" + +namespace ui { + +class State +{ +public: + State(int w, int h); + virtual ~State(); + + bool AllowExclusiveDrawing; //false will not call draw on objects outside of bounds + + virtual void Tick(float dt); + virtual void Draw(void* userdata); + + virtual void OnMouseMove(int x, int y); + virtual void OnMouseDown(int x, int y, unsigned int button); + virtual void OnMouseUp(int x, int y, unsigned int button); + virtual void OnMouseWheel(int x, int y, int d); + virtual void OnKeyPress(int key, bool shift, bool ctrl, bool alt); + virtual void OnKeyRelease(int key, bool shift, bool ctrl, bool alt); + + virtual void Add(Component *child); + virtual void Remove(Component *child); + + inline bool IsFocused(Component* c) { return (c == focusedComponent_); } + inline int GetMouseX() { return mouseX; } + inline int GetMouseY() { return mouseY; } + inline int GetWidth() { return width; } + inline int GetHeight() { return height; } + +protected: + std::vector<Component*> Components; + + int width; + int height; + + int mouseX; + int mouseY; + int mouseXP; + int mouseYP; + +private: + Component* focusedComponent_; + +}; + +} /* namespace ui */ +#endif /* STATE_H_ */ |
