Initialise widgets and UI on construction.
parent
eb5be86a6e
commit
0fc08cf88f
|
@ -28,6 +28,8 @@ public:
|
||||||
int back;
|
int back;
|
||||||
int padding;
|
int padding;
|
||||||
|
|
||||||
|
Container() : back(0), padding(0) {}
|
||||||
|
|
||||||
~Container();
|
~Container();
|
||||||
|
|
||||||
/* virtual */ Widget *GetWidget(int x, int y);
|
/* virtual */ Widget *GetWidget(int x, int y);
|
||||||
|
|
|
@ -35,6 +35,8 @@ struct PUi : PTextures {
|
||||||
int mx, my, mb, mm;
|
int mx, my, mb, mm;
|
||||||
float scale;
|
float scale;
|
||||||
|
|
||||||
|
PUi() : view(NULL), widget(NULL), tooltip(NULL), active(NULL), mx(0), my(0), mb(0), mm(0), scale(1.f) {}
|
||||||
|
|
||||||
virtual ~PUi();
|
virtual ~PUi();
|
||||||
|
|
||||||
inline void Repaint() { puglPostRedisplay(this->view); }
|
inline void Repaint() { puglPostRedisplay(this->view); }
|
||||||
|
|
|
@ -40,6 +40,8 @@ struct PTextures {
|
||||||
|
|
||||||
FTFont *font;
|
FTFont *font;
|
||||||
|
|
||||||
|
PTextures() : initialised(false) {}
|
||||||
|
|
||||||
void InitTextures();
|
void InitTextures();
|
||||||
void BindTexture(int texture, int width, int height, const unsigned char *data, int format = GL_RGBA);
|
void BindTexture(int texture, int width, int height, const unsigned char *data, int format = GL_RGBA);
|
||||||
};
|
};
|
||||||
|
|
|
@ -25,6 +25,8 @@ struct Rect {
|
||||||
int w;
|
int w;
|
||||||
int h;
|
int h;
|
||||||
|
|
||||||
|
Rect() : x(0), y(0), w(0), h(0) {}
|
||||||
|
|
||||||
inline bool Hit(int hitx, int hity)
|
inline bool Hit(int hitx, int hity)
|
||||||
{
|
{
|
||||||
return hitx >= x && hitx < x + w && hity >= y && hity < y + h;
|
return hitx >= x && hitx < x + w && hity >= y && hity < y + h;
|
||||||
|
@ -34,7 +36,7 @@ struct Rect {
|
||||||
struct Colour {
|
struct Colour {
|
||||||
float r, g, b, a;
|
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) : 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) {}
|
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;
|
bool active;
|
||||||
|
|
||||||
Widget() : port(UINT_MAX) {}
|
Widget() : port(UINT_MAX), min(0.f), max(1.f), value(0.f), active(false) {}
|
||||||
|
|
||||||
virtual ~Widget() {}
|
virtual ~Widget() {}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue