#include #include "pui.h" bool Widget::SetValue(float newvalue) { /* Clamp new value */ if (newvalue <= this->min) newvalue = this->min; if (newvalue >= this->max) newvalue = this->max; /* Value is different? */ if (newvalue == this->value) return false; snprintf(this->text, sizeof this->text, "%s: %0.4f", this->label, newvalue); this->value = newvalue; return true; } void Widget::Pad(int xpad, int ypad) { this->x += xpad; this->y += ypad; this->w -= xpad + xpad; this->h -= ypad + ypad; } void Frame::OnPaint(const PUi *pui) const { glBegin(GL_QUADS); glColor4f(colour.r, colour.g, colour.b, colour.a); glVertex2f( x, y); glVertex2f( x, h + y); glVertex2f(w + x, h + y); glVertex2f(w + x, y); glEnd(); }