Browse Source

Move LightButton to Rack SDK.

tags/v2.6.0
Andrew Belt 1 year ago
parent
commit
139055934f
2 changed files with 19 additions and 39 deletions
  1. +1
    -39
      src/Logic.cpp
  2. +18
    -0
      src/plugin.hpp

+ 1
- 39
src/Logic.cpp View File

@@ -99,44 +99,6 @@ struct Logic : Module {
}; };




struct VCVBezelBig : app::SvgSwitch {
VCVBezelBig() {
momentary = true;
addFrame(Svg::load(asset::plugin(pluginInstance, "res/VCVBezelBig.svg")));
}
};


template <typename TBase>
struct VCVBezelLightBig : TBase {
VCVBezelLightBig() {
this->borderColor = color::BLACK_TRANSPARENT;
this->bgColor = color::BLACK_TRANSPARENT;
this->box.size = mm2px(math::Vec(11.1936, 11.1936));
}
};


template <typename TBase, typename TLight = WhiteLight>
struct LightButton : TBase {
app::ModuleLightWidget* light;

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

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


using VCVBezelLightBigWhite = LightButton<VCVBezelBig, VCVBezelLightBig<WhiteLight>>;


struct LogicWidget : ModuleWidget { struct LogicWidget : ModuleWidget {
LogicWidget(Logic* module) { LogicWidget(Logic* module) {
setModule(module); setModule(module);
@@ -147,7 +109,7 @@ struct LogicWidget : ModuleWidget {
addChild(createWidget<ScrewSilver>(Vec(RACK_GRID_WIDTH, RACK_GRID_HEIGHT - RACK_GRID_WIDTH))); addChild(createWidget<ScrewSilver>(Vec(RACK_GRID_WIDTH, RACK_GRID_HEIGHT - RACK_GRID_WIDTH)));
addChild(createWidget<ScrewSilver>(Vec(box.size.x - 2 * RACK_GRID_WIDTH, RACK_GRID_HEIGHT - RACK_GRID_WIDTH))); addChild(createWidget<ScrewSilver>(Vec(box.size.x - 2 * RACK_GRID_WIDTH, RACK_GRID_HEIGHT - RACK_GRID_WIDTH)));


addParam(createLightParamCentered<VCVBezelLightBigWhite>(mm2px(Vec(12.7, 26.755)), module, Logic::B_PARAM, Logic::B_BUTTON_LIGHT));
addParam(createLightParamCentered<LightButton<VCVBezelBig, VCVBezelLightBig<WhiteLight>>>(mm2px(Vec(12.7, 26.755)), module, Logic::B_PARAM, Logic::B_BUTTON_LIGHT));


addInput(createInputCentered<ThemedPJ301MPort>(mm2px(Vec(7.299, 52.31)), module, Logic::A_INPUT)); addInput(createInputCentered<ThemedPJ301MPort>(mm2px(Vec(7.299, 52.31)), module, Logic::A_INPUT));
addInput(createInputCentered<ThemedPJ301MPort>(mm2px(Vec(18.136, 52.31)), module, Logic::B_INPUT)); addInput(createInputCentered<ThemedPJ301MPort>(mm2px(Vec(18.136, 52.31)), module, Logic::B_INPUT));


+ 18
- 0
src/plugin.hpp View File

@@ -118,3 +118,21 @@ struct YellowBlueLight : TBase {
this->addBaseColor(SCHEME_BLUE); this->addBaseColor(SCHEME_BLUE);
} }
}; };


struct VCVBezelBig : app::SvgSwitch {
VCVBezelBig() {
momentary = true;
addFrame(Svg::load(asset::plugin(pluginInstance, "res/VCVBezelBig.svg")));
}
};


template <typename TBase>
struct VCVBezelLightBig : TBase {
VCVBezelLightBig() {
this->borderColor = color::BLACK_TRANSPARENT;
this->bgColor = color::BLACK_TRANSPARENT;
this->box.size = mm2px(math::Vec(11.1936, 11.1936));
}
};

Loading…
Cancel
Save