Configurable container background
parent
57e181ba3f
commit
d86d43eddd
|
@ -56,7 +56,7 @@ void PTapUI::InitWidgets()
|
||||||
scale = 1.0f;
|
scale = 1.0f;
|
||||||
|
|
||||||
widget = new Container();
|
widget = new Container();
|
||||||
widget->back = true;
|
widget->back = 1;
|
||||||
widget->colour = Colour(1, 1, 1, 1);
|
widget->colour = Colour(1, 1, 1, 1);
|
||||||
widget->w = this->width * scale;
|
widget->w = this->width * scale;
|
||||||
widget->h = this->height * scale;
|
widget->h = this->height * scale;
|
||||||
|
|
|
@ -12,11 +12,12 @@ Container::~Container()
|
||||||
void Container::OnPaint(const PUi *pui) const
|
void Container::OnPaint(const PUi *pui) const
|
||||||
{
|
{
|
||||||
if (this->back) {
|
if (this->back) {
|
||||||
float tw = (float)w / pui->w[TEX_BACKTILE];
|
int t = this->back == 1 ? TEX_BACKTILE : TEX_BACKTILE2;
|
||||||
float th = (float)h / pui->h[TEX_BACKTILE];
|
float tw = (float)w / pui->w[t];
|
||||||
|
float th = (float)h / pui->h[t];
|
||||||
|
|
||||||
glEnable(GL_TEXTURE_2D);
|
glEnable(GL_TEXTURE_2D);
|
||||||
glBindTexture(GL_TEXTURE_2D, pui->tex[TEX_BACKTILE]);
|
glBindTexture(GL_TEXTURE_2D, pui->tex[t]);
|
||||||
glBegin(GL_QUADS);
|
glBegin(GL_QUADS);
|
||||||
glColor4f(colour.r, colour.g, colour.b, colour.a);
|
glColor4f(colour.r, colour.g, colour.b, colour.a);
|
||||||
glTexCoord2f(.0, .0);
|
glTexCoord2f(.0, .0);
|
||||||
|
|
|
@ -10,7 +10,7 @@ protected:
|
||||||
public:
|
public:
|
||||||
Colour colour;
|
Colour colour;
|
||||||
Colour frame;
|
Colour frame;
|
||||||
bool back;
|
int back;
|
||||||
int padding;
|
int padding;
|
||||||
|
|
||||||
~Container();
|
~Container();
|
||||||
|
|
Loading…
Reference in New Issue