diff --git a/src/ChordCV.cpp b/src/ChordCV.cpp index 26d8e46..08198d3 100644 --- a/src/ChordCV.cpp +++ b/src/ChordCV.cpp @@ -116,25 +116,28 @@ struct ChordCVWidget : ModuleWidget { module = _module; } - void draw(const DrawArgs &args) override { - std::shared_ptr font = APP->window->loadFont(asset::plugin(pluginInstance, "res/fonts/PixelOperator.ttf")); - if(font){ - NVGcolor textColor = prepareDisplay(args.vg, &box, 22); - nvgFontFaceId(args.vg, font->handle); - nvgTextLetterSpacing(args.vg, -1.5); - nvgTextAlign(args.vg, NVG_ALIGN_CENTER); - - Vec textPos = Vec(box.size.x/2, 21.0f); - nvgFillColor(args.vg, textColor); - - if (module != NULL){ - get_chord_name(module->root_semi,module->chord_type,module->inverted,module->bass_note,text); - }else{ - snprintf(text, 13, " "); + void drawLayer(const DrawArgs& args, int layer) override { + if (layer == 1) { + std::shared_ptr font = APP->window->loadFont(asset::plugin(pluginInstance, "res/fonts/PixelOperator.ttf")); + if(font){ + NVGcolor textColor = prepareDisplay(args.vg, &box, 22); + nvgFontFaceId(args.vg, font->handle); + nvgTextLetterSpacing(args.vg, -1.5); + nvgTextAlign(args.vg, NVG_ALIGN_CENTER); + + Vec textPos = Vec(box.size.x/2, 21.0f); + nvgFillColor(args.vg, textColor); + + if (module != NULL){ + get_chord_name(module->root_semi,module->chord_type,module->inverted,module->bass_note,text); + }else{ + snprintf(text, 13, " "); + } + + nvgText(args.vg, textPos.x, textPos.y, text, NULL); } - - nvgText(args.vg, textPos.x, textPos.y, text, NULL); } + Widget::drawLayer(args, layer); } }; diff --git a/src/DiatonicCV.cpp b/src/DiatonicCV.cpp index 1a7a75b..0bb9fe2 100644 --- a/src/DiatonicCV.cpp +++ b/src/DiatonicCV.cpp @@ -151,25 +151,28 @@ struct DiatonicCVWidget : ModuleWidget { module = _module; } - void draw(const DrawArgs &args) override { - std::shared_ptr font = APP->window->loadFont(asset::plugin(pluginInstance, "res/fonts/PixelOperator.ttf")); - if(font){ - NVGcolor textColor = prepareDisplay(args.vg, &box, 22); - nvgFontFaceId(args.vg, font->handle); - nvgTextLetterSpacing(args.vg, -1.5); - nvgTextAlign(args.vg, NVG_ALIGN_CENTER); - - Vec textPos = Vec(box.size.x/2, 21.0f); - nvgFillColor(args.vg, textColor); - - if (module != NULL && module->playing_chord.num_notes > 2){ - detect_chord_name_simple(module->playing_chord,text); - }else{ - snprintf(text, 13, " "); + void drawLayer(const DrawArgs& args, int layer) override { + if (layer == 1) { + std::shared_ptr font = APP->window->loadFont(asset::plugin(pluginInstance, "res/fonts/PixelOperator.ttf")); + if(font){ + NVGcolor textColor = prepareDisplay(args.vg, &box, 22); + nvgFontFaceId(args.vg, font->handle); + nvgTextLetterSpacing(args.vg, -1.5); + nvgTextAlign(args.vg, NVG_ALIGN_CENTER); + + Vec textPos = Vec(box.size.x/2, 21.0f); + nvgFillColor(args.vg, textColor); + + if (module != NULL && module->playing_chord.num_notes > 2){ + detect_chord_name_simple(module->playing_chord,text); + }else{ + snprintf(text, 13, " "); + } + + nvgText(args.vg, textPos.x, textPos.y, text, NULL); } - - nvgText(args.vg, textPos.x, textPos.y, text, NULL); } + Widget::drawLayer(args, layer); } }; diff --git a/src/RandomNoteCV.cpp b/src/RandomNoteCV.cpp index 554522b..c182986 100644 --- a/src/RandomNoteCV.cpp +++ b/src/RandomNoteCV.cpp @@ -127,25 +127,28 @@ struct RandomNoteCVWidget : ModuleWidget { module = _module; } - void draw(const DrawArgs &args) override { - std::shared_ptr font = APP->window->loadFont(asset::plugin(pluginInstance, "res/fonts/PixelOperator.ttf")); - if(font){ - NVGcolor textColor = prepareDisplay(args.vg, &box, 22); - nvgFontFaceId(args.vg, font->handle); - nvgTextLetterSpacing(args.vg, -1.5); - nvgTextAlign(args.vg, NVG_ALIGN_CENTER); - - Vec textPos = Vec(box.size.x/2, 21.0f); - nvgFillColor(args.vg, textColor); - - if (module != NULL){ - get_note_name(module->playing_note,text); - }else{ - snprintf(text, 1, " "); + void drawLayer(const DrawArgs& args, int layer) override { + if (layer == 1) { + std::shared_ptr font = APP->window->loadFont(asset::plugin(pluginInstance, "res/fonts/PixelOperator.ttf")); + if(font){ + NVGcolor textColor = prepareDisplay(args.vg, &box, 22); + nvgFontFaceId(args.vg, font->handle); + nvgTextLetterSpacing(args.vg, -1.5); + nvgTextAlign(args.vg, NVG_ALIGN_CENTER); + + Vec textPos = Vec(box.size.x/2, 21.0f); + nvgFillColor(args.vg, textColor); + + if (module != NULL){ + get_note_name(module->playing_note,text); + }else{ + snprintf(text, 1, " "); + } + + nvgText(args.vg, textPos.x, textPos.y, text, NULL); } - - nvgText(args.vg, textPos.x, textPos.y, text, NULL); } + Widget::drawLayer(args, layer); } }; diff --git a/src/ScaleCV.cpp b/src/ScaleCV.cpp index b211c8b..6a01972 100644 --- a/src/ScaleCV.cpp +++ b/src/ScaleCV.cpp @@ -107,25 +107,28 @@ struct ScaleCVWidget : ModuleWidget { module = _module; } - void draw(const DrawArgs &args) override { - std::shared_ptr font = APP->window->loadFont(asset::plugin(pluginInstance, "res/fonts/PixelOperator.ttf")); - if(font){ - NVGcolor textColor = prepareDisplay(args.vg, &box, 22); - nvgFontFaceId(args.vg, font->handle); - nvgTextLetterSpacing(args.vg, -1.5); - nvgTextAlign(args.vg, NVG_ALIGN_CENTER); - - Vec textPos = Vec(box.size.x/2, 21.0f); - nvgFillColor(args.vg, textColor); - - if (module != NULL){ - get_scale_name(module->root_semi,module->mode,text); - }else{ - snprintf(text, 13, " "); + void drawLayer(const DrawArgs& args, int layer) override { + if (layer == 1) { + std::shared_ptr font = APP->window->loadFont(asset::plugin(pluginInstance, "res/fonts/PixelOperator.ttf")); + if(font){ + NVGcolor textColor = prepareDisplay(args.vg, &box, 22); + nvgFontFaceId(args.vg, font->handle); + nvgTextLetterSpacing(args.vg, -1.5); + nvgTextAlign(args.vg, NVG_ALIGN_CENTER); + + Vec textPos = Vec(box.size.x/2, 21.0f); + nvgFillColor(args.vg, textColor); + + if (module != NULL){ + get_scale_name(module->root_semi,module->mode,text); + }else{ + snprintf(text, 13, " "); + } + + nvgText(args.vg, textPos.x, textPos.y, text, NULL); } - - nvgText(args.vg, textPos.x, textPos.y, text, NULL); } + Widget::drawLayer(args, layer); } };