Initialise widgets and UI on construction.

master
Peter Nelson 2013-02-09 10:14:14 +00:00
parent eb5be86a6e
commit 0fc08cf88f
4 changed files with 10 additions and 2 deletions

View File

@ -28,6 +28,8 @@ public:
int back;
int padding;
Container() : back(0), padding(0) {}
~Container();
/* virtual */ Widget *GetWidget(int x, int y);

View File

@ -35,6 +35,8 @@ struct PUi : PTextures {
int mx, my, mb, mm;
float scale;
PUi() : view(NULL), widget(NULL), tooltip(NULL), active(NULL), mx(0), my(0), mb(0), mm(0), scale(1.f) {}
virtual ~PUi();
inline void Repaint() { puglPostRedisplay(this->view); }

View File

@ -40,6 +40,8 @@ struct PTextures {
FTFont *font;
PTextures() : initialised(false) {}
void InitTextures();
void BindTexture(int texture, int width, int height, const unsigned char *data, int format = GL_RGBA);
};

View File

@ -25,6 +25,8 @@ struct Rect {
int w;
int h;
Rect() : x(0), y(0), w(0), h(0) {}
inline bool Hit(int hitx, int hity)
{
return hitx >= x && hitx < x + w && hity >= y && hity < y + h;
@ -34,7 +36,7 @@ struct Rect {
struct Colour {
float r, g, b, a;
Colour() {}
Colour() : r(0), g(0), b(0), a(0) {}
Colour(float r, float g, float b) : r(r), g(g), b(b), a(1.f) {}
Colour(float r, float g, float b, float a) : r(r), g(g), b(b), a(a) {}
};
@ -53,7 +55,7 @@ struct Widget : Rect {
bool active;
Widget() : port(UINT_MAX) {}
Widget() : port(UINT_MAX), min(0.f), max(1.f), value(0.f), active(false) {}
virtual ~Widget() {}