public AxisController(string name, bool fullCircle) { _fullCircle = fullCircle; Layout mainLayout = Layout.makeHorizontal(); var nameLabel = new Label(name); nameLabel.area.width = 50; nameLabel.font.normal = Color.white; nameLabel.font.style = FontStyle.Bold; mainLayout.views.add(nameLabel); Layout digitalLayout = Layout.makeHorizontal(); digitalLayout.views.add(new Space()); digitalLayout.views.add(_button("<<<", -15)); digitalLayout.views.add(_button("<<", -5)); digitalLayout.views.add(_button("<", -1)); _info = new Label("0"); _info.area.width = 30; _info.font.alignment = Alignment.Center; _info.font.style = FontStyle.Bold; digitalLayout.views.add(_info); digitalLayout.views.add(_button(">", 1)); digitalLayout.views.add(_button(">>", 5)); digitalLayout.views.add(_button(">>>", 15)); digitalLayout.views.add(new Space()); Layout analogLayout = Layout.makeHorizontal(); _slider = new Slider(-90, 90, 0); _slider.onUpdate = (s => { updateSliderValue(s.value); }); analogLayout.views.add(_slider); Layout controlLayout = Layout.makeVertical(); controlLayout.views.add(digitalLayout); controlLayout.views.add(analogLayout); mainLayout.views.add(controlLayout); Layout switchLayout = Layout.makeVertical(); switchLayout.views.add(new Space(10)); _sideSwitch = new Button("+"); _sideSwitch.area.width = 30; _sideSwitch.area.height = 30; _sideSwitch.onClick = ((b, m) => { onFrontSide = !onFrontSide; if(onFrontSide) b.text = "+"; else b.text = "-"; }); if(_fullCircle) switchLayout.views.add(_sideSwitch); else { Layout placeholder = Layout.makeHorizontal(); placeholder.views.add(new Space(34)); switchLayout.views.add(placeholder); } switchLayout.views.add(new Space()); mainLayout.views.add(new Space(10)); mainLayout.views.add(switchLayout); _view = mainLayout; }
public StatLabel(string name, UpdateHandler onUpdate) { _layout = Layout.makeHorizontal(); Label nameLabel = new Label(name); nameLabel.area.widthExpandable = true; nameLabel.font.alignment = Alignment.UpperLeft; nameLabel.font.normal = Color.white; nameLabel.font.style = FontStyle.Bold; _layout.views.add(nameLabel); _valueLabel = new Label(); _valueLabel.area.width = 150; _layout.views.add(_valueLabel); _updateHandler = onUpdate; }