2012-07-19 01:14:17 +00:00
|
|
|
#ifndef _GUICOMPONENT_H_
|
|
|
|
#define _GUICOMPONENT_H_
|
|
|
|
|
2012-07-19 16:13:27 +00:00
|
|
|
#include <vector>
|
|
|
|
#include "Renderer.h"
|
2012-07-20 01:08:29 +00:00
|
|
|
#include "InputManager.h"
|
2012-07-19 16:13:27 +00:00
|
|
|
|
2012-07-19 01:14:17 +00:00
|
|
|
class GuiComponent
|
|
|
|
{
|
|
|
|
public:
|
2012-08-02 01:43:55 +00:00
|
|
|
GuiComponent();
|
|
|
|
virtual ~GuiComponent();
|
|
|
|
|
2012-07-19 16:13:27 +00:00
|
|
|
void render();
|
|
|
|
virtual void onRender() { };
|
2012-08-02 01:43:55 +00:00
|
|
|
virtual void onTick(int deltaTime) { };
|
|
|
|
|
2012-08-02 04:03:15 +00:00
|
|
|
void pause();
|
|
|
|
void resume();
|
|
|
|
virtual void onPause() { };
|
|
|
|
virtual void onResume() { };
|
|
|
|
|
2012-07-20 01:08:29 +00:00
|
|
|
virtual void onInput(InputManager::InputButton button, bool keyDown) { };
|
2012-07-19 16:13:27 +00:00
|
|
|
|
|
|
|
void addChild(GuiComponent* comp);
|
|
|
|
void removeChild(GuiComponent* comp);
|
2012-08-11 04:17:52 +00:00
|
|
|
void clearChildren();
|
2012-07-19 16:13:27 +00:00
|
|
|
unsigned int getChildCount() { return mChildren.size(); }
|
|
|
|
GuiComponent* getChild(unsigned int i) { return mChildren.at(i); }
|
2012-08-02 01:43:55 +00:00
|
|
|
|
|
|
|
static void processTicks(int deltaTime);
|
2012-07-19 16:13:27 +00:00
|
|
|
private:
|
2012-08-02 01:43:55 +00:00
|
|
|
static std::vector<GuiComponent*> sComponentVector;
|
2012-07-19 16:13:27 +00:00
|
|
|
std::vector<GuiComponent*> mChildren;
|
2012-07-19 01:14:17 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|