36 lines
684 B
C++
36 lines
684 B
C++
#include <pugl/pugl.h>
|
|
#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;
|
|
|
|
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();
|
|
}
|
|
|