use of spacegraph.space2d.widget.tab.ButtonSet in project narchy by automenta.
the class Sketch2DBitmap method menu.
@Override
public Surface menu() {
ButtonSet<ColorToggle> colorMenu = new ButtonSet<>(ButtonSet.Mode.One, // black
new ColorToggle(0f, 0, 0), // red
new ColorToggle(1f, 0, 0), // orange
new ColorToggle(1f, 0.5f, 0), // yellow
new ColorToggle(0.75f, 0.75f, 0), // green
new ColorToggle(0f, 1, 0), // blue
new ColorToggle(0f, 0, 1), // purple
new ColorToggle(1f, 0, 1), // gray
new ColorToggle(0.5f, 0.5f, 0.5f), // white
new ColorToggle(1f, 1, 1));
colorMenu.on((cc, e) -> {
if (e) {
color(cc.r, cc.g, cc.b);
}
});
Surface toolMenu = grid(new XYSlider().on((_width, _alpha) -> {
brushWidth = Util.lerp(_width, 0.1f, 3f);
brushAlpha = Util.lerp(_alpha, 0.1f, 3f);
}).set(0.5f, 0.75f));
return grid(colorMenu, toolMenu);
}
use of spacegraph.space2d.widget.tab.ButtonSet in project narchy by automenta.
the class AutoSurface method newSwitch.
private ButtonSet newSwitch(EnumParam x) {
ToggleButton[] b = ((EnumSet<?>) EnumSet.allOf(x.klass)).stream().map(e -> {
CheckBox tb = new CheckBox(e.name());
tb.on((c, enabled) -> {
if (enabled)
x.set(e);
});
return tb;
}).toArray(ToggleButton[]::new);
ButtonSet s = new ButtonSet(ButtonSet.Mode.One, b);
return s;
}
Aggregations