Add slider colour modifier and active-highlight

master
Peter Nelson 2013-02-03 13:39:34 +00:00
parent 47d1d19a6c
commit 3009f08a76
2 changed files with 12 additions and 9 deletions

View File

@ -89,7 +89,7 @@ void HSlider::OnPaint() const
glBindTexture(GL_TEXTURE_2D, tex->tex[t]);
glBegin(GL_QUADS);
glColor4f(1.0, 0.0, 0.0, 0.5);
if (this->colour.a) glColor4f(colour.r, colour.g, colour.b, colour.a);
glTexCoord2f(0.0, 0.0);
glVertex2f( mx, my);
glTexCoord2f(0.0, 1.0);
@ -196,7 +196,7 @@ void VSlider::OnPaint() const
glBindTexture(GL_TEXTURE_2D, tex->tex[t]);
glBegin(GL_QUADS);
if (big) glColor3f(1.f, 0.f, 0.f);
if (this->colour.a) glColor4f(colour.r, colour.g, colour.b, colour.a);
glTexCoord2f(0.0, 0.0);
glVertex2f( mx, my);
glTexCoord2f(0.0, 1.0);
@ -209,12 +209,14 @@ void VSlider::OnPaint() const
glDisable(GL_TEXTURE_2D);
/* glBegin(GL_QUADS);
glColor4f(0.5f, 0.3f, 0.5f, 0.5f);
glVertex2f( x, y);
glVertex2f( x, h + y);
glVertex2f(w + x, h + y);
glVertex2f(w + x, y);
glEnd();*/
if (this->active) {
glBegin(GL_LINE_LOOP);
glColor4f(1.f, 1.f, 1.0f, 0.25f);
glVertex2f( x + .5f, y + .5f);
glVertex2f( x + .5f, h + y - .5f);
glVertex2f(w + x - .5f, h + y - .5f);
glVertex2f(w + x - .5f, y + .5f);
glEnd();
}
}

View File

@ -2,6 +2,7 @@
#define SLIDER_H
struct Slider : Widget {
Colour colour;
bool big;
};