Exemplo n.º 1
0
 bool checkbox(const rect & r, bool & value)
 {
     bool changed = false;
     if (click && r.contains(cursor))
     {
         value = !value;
         changed = true;
     }
     fill_rect(r, { 1, 1, 1 });
     fill_rect(r.shrink(1), { 0.5, 0.5, 0.5 });
     if (value) fill_rect(r.shrink(3), { 1, 1, 1 });
     return changed;
 }
Exemplo n.º 2
0
 bool button(const rect & r, const std::string & label)
 {
     fill_rect(r, { 1, 1, 1 });
     fill_rect(r.shrink(2), r.contains(cursor) ? (mouse_down ? color{ 0.3f, 0.3f, 0.3f } : color{ 0.4f, 0.4f, 0.4f }) : color{ 0.5f, 0.5f, 0.5f });
     glColor3f(1, 1, 1);
     draw_text(r.x0 + 4, r.y1 - 8, label.c_str());
     return click && r.contains(cursor);
 }