Configurable container background

master
Peter Nelson 2013-02-06 19:50:18 +00:00
parent 57e181ba3f
commit d86d43eddd
3 changed files with 6 additions and 5 deletions

View File

@ -56,7 +56,7 @@ void PTapUI::InitWidgets()
scale = 1.0f;
widget = new Container();
widget->back = true;
widget->back = 1;
widget->colour = Colour(1, 1, 1, 1);
widget->w = this->width * scale;
widget->h = this->height * scale;

View File

@ -12,11 +12,12 @@ Container::~Container()
void Container::OnPaint(const PUi *pui) const
{
if (this->back) {
float tw = (float)w / pui->w[TEX_BACKTILE];
float th = (float)h / pui->h[TEX_BACKTILE];
int t = this->back == 1 ? TEX_BACKTILE : TEX_BACKTILE2;
float tw = (float)w / pui->w[t];
float th = (float)h / pui->h[t];
glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, pui->tex[TEX_BACKTILE]);
glBindTexture(GL_TEXTURE_2D, pui->tex[t]);
glBegin(GL_QUADS);
glColor4f(colour.r, colour.g, colour.b, colour.a);
glTexCoord2f(.0, .0);

View File

@ -10,7 +10,7 @@ protected:
public:
Colour colour;
Colour frame;
bool back;
int back;
int padding;
~Container();