Browse Source

Add LightButton to component library.

tags/v2.4.1
Andrew Belt 1 year ago
parent
commit
ded4425620
1 changed files with 10 additions and 7 deletions
  1. +10
    -7
      include/componentlibrary.hpp

+ 10
- 7
include/componentlibrary.hpp View File

@@ -886,23 +886,26 @@ struct VCVLatch : VCVButton {
} }
}; };


/** Looks best with MediumSimpleLight<WhiteLight> or a color of your choice.
*/
template <typename TLight>
struct VCVLightButton : VCVButton {
template <typename TBase, typename TLight = WhiteLight>
struct LightButton : TBase {
app::ModuleLightWidget* light; app::ModuleLightWidget* light;


VCVLightButton() {
LightButton() {
light = new TLight; light = new TLight;
// Move center of light to center of box // Move center of light to center of box
light->box.pos = box.size.div(2).minus(light->box.size.div(2));
addChild(light);
light->box.pos = this->box.size.div(2).minus(light->box.size.div(2));
this->addChild(light);
} }


app::ModuleLightWidget* getLight() { app::ModuleLightWidget* getLight() {
return light; return light;
} }
}; };

template <typename TLight = WhiteLight>
using VCVLightButton = LightButton<VCVButton, TLight>;

/** Deprecated alias */
template <typename TLight> template <typename TLight>
using LEDLightButton = VCVLightButton<TLight>; using LEDLightButton = VCVLightButton<TLight>;




Loading…
Cancel
Save