| 839 | }; |
| 840 | |
| 841 | struct AidaSwitch : app::Switch { |
| 842 | static constexpr const float kSwitchWidth = 15.f; |
| 843 | static constexpr const float kSwitchHeight = 34.f; |
| 844 | |
| 845 | bool inverted = false; |
| 846 | |
| 847 | AidaSwitch() |
| 848 | { |
| 849 | box.size.x = kSwitchWidth; |
| 850 | box.size.y = kSwitchHeight; |
| 851 | } |
| 852 | |
| 853 | void draw(const DrawArgs& args) override |
| 854 | { |
| 855 | engine::ParamQuantity* pq = getParamQuantity(); |
| 856 | |
| 857 | bool checked; |
| 858 | if (pq != nullptr) |
| 859 | checked = inverted ? pq->getValue() <= pq->getMinValue() : pq->getValue() > pq->getMinValue(); |
| 860 | else |
| 861 | checked = true; |
| 862 | |
| 863 | nvgBeginPath(args.vg); |
| 864 | nvgRoundedRect(args.vg, 0, 0, box.size.x, box.size.y, kSwitchWidth/2); |
| 865 | nvgFillColor(args.vg, checked ? nvgRGB(84, 84, 84) : nvgRGB(129, 247, 0)); |
| 866 | nvgFill(args.vg); |
| 867 | |
| 868 | nvgBeginPath(args.vg); |
| 869 | nvgCircle(args.vg, |
| 870 | box.size.x / 2, |
| 871 | checked ? box.size.y/2 + kSwitchHeight/2 - kSwitchWidth/2 |
| 872 | : box.size.y/2 - kSwitchHeight/2 + kSwitchWidth/2, |
| 873 | 6.f); |
| 874 | nvgFillColor(args.vg, checked ? nvgRGB(218, 214, 203) : nvgRGB(24, 112, 4)); |
| 875 | nvgFill(args.vg); |
| 876 | } |
| 877 | }; |
| 878 | |
| 879 | struct AidaWidget : ModuleWidgetWithSideScrews<23> { |
| 880 | static constexpr const uint kPedalMargin = 10; |
nothing calls this directly
no outgoing calls
no test coverage detected