Skip to content

Commit e8c7072

Browse files
committed
Fixes #10
1 parent a5d393c commit e8c7072

4 files changed

Lines changed: 80 additions & 68 deletions

File tree

src/ChordCV.cpp

Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -116,25 +116,28 @@ struct ChordCVWidget : ModuleWidget {
116116
module = _module;
117117
}
118118

119-
void draw(const DrawArgs &args) override {
120-
std::shared_ptr<Font> font = APP->window->loadFont(asset::plugin(pluginInstance, "res/fonts/PixelOperator.ttf"));
121-
if(font){
122-
NVGcolor textColor = prepareDisplay(args.vg, &box, 22);
123-
nvgFontFaceId(args.vg, font->handle);
124-
nvgTextLetterSpacing(args.vg, -1.5);
125-
nvgTextAlign(args.vg, NVG_ALIGN_CENTER);
126-
127-
Vec textPos = Vec(box.size.x/2, 21.0f);
128-
nvgFillColor(args.vg, textColor);
129-
130-
if (module != NULL){
131-
get_chord_name(module->root_semi,module->chord_type,module->inverted,module->bass_note,text);
132-
}else{
133-
snprintf(text, 13, " ");
119+
void drawLayer(const DrawArgs& args, int layer) override {
120+
if (layer == 1) {
121+
std::shared_ptr<Font> font = APP->window->loadFont(asset::plugin(pluginInstance, "res/fonts/PixelOperator.ttf"));
122+
if(font){
123+
NVGcolor textColor = prepareDisplay(args.vg, &box, 22);
124+
nvgFontFaceId(args.vg, font->handle);
125+
nvgTextLetterSpacing(args.vg, -1.5);
126+
nvgTextAlign(args.vg, NVG_ALIGN_CENTER);
127+
128+
Vec textPos = Vec(box.size.x/2, 21.0f);
129+
nvgFillColor(args.vg, textColor);
130+
131+
if (module != NULL){
132+
get_chord_name(module->root_semi,module->chord_type,module->inverted,module->bass_note,text);
133+
}else{
134+
snprintf(text, 13, " ");
135+
}
136+
137+
nvgText(args.vg, textPos.x, textPos.y, text, NULL);
134138
}
135-
136-
nvgText(args.vg, textPos.x, textPos.y, text, NULL);
137139
}
140+
Widget::drawLayer(args, layer);
138141
}
139142

140143
};

src/DiatonicCV.cpp

Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -151,25 +151,28 @@ struct DiatonicCVWidget : ModuleWidget {
151151
module = _module;
152152
}
153153

154-
void draw(const DrawArgs &args) override {
155-
std::shared_ptr<Font> font = APP->window->loadFont(asset::plugin(pluginInstance, "res/fonts/PixelOperator.ttf"));
156-
if(font){
157-
NVGcolor textColor = prepareDisplay(args.vg, &box, 22);
158-
nvgFontFaceId(args.vg, font->handle);
159-
nvgTextLetterSpacing(args.vg, -1.5);
160-
nvgTextAlign(args.vg, NVG_ALIGN_CENTER);
161-
162-
Vec textPos = Vec(box.size.x/2, 21.0f);
163-
nvgFillColor(args.vg, textColor);
164-
165-
if (module != NULL && module->playing_chord.num_notes > 2){
166-
detect_chord_name_simple(module->playing_chord,text);
167-
}else{
168-
snprintf(text, 13, " ");
154+
void drawLayer(const DrawArgs& args, int layer) override {
155+
if (layer == 1) {
156+
std::shared_ptr<Font> font = APP->window->loadFont(asset::plugin(pluginInstance, "res/fonts/PixelOperator.ttf"));
157+
if(font){
158+
NVGcolor textColor = prepareDisplay(args.vg, &box, 22);
159+
nvgFontFaceId(args.vg, font->handle);
160+
nvgTextLetterSpacing(args.vg, -1.5);
161+
nvgTextAlign(args.vg, NVG_ALIGN_CENTER);
162+
163+
Vec textPos = Vec(box.size.x/2, 21.0f);
164+
nvgFillColor(args.vg, textColor);
165+
166+
if (module != NULL && module->playing_chord.num_notes > 2){
167+
detect_chord_name_simple(module->playing_chord,text);
168+
}else{
169+
snprintf(text, 13, " ");
170+
}
171+
172+
nvgText(args.vg, textPos.x, textPos.y, text, NULL);
169173
}
170-
171-
nvgText(args.vg, textPos.x, textPos.y, text, NULL);
172174
}
175+
Widget::drawLayer(args, layer);
173176
}
174177

175178
};

src/RandomNoteCV.cpp

Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -127,25 +127,28 @@ struct RandomNoteCVWidget : ModuleWidget {
127127
module = _module;
128128
}
129129

130-
void draw(const DrawArgs &args) override {
131-
std::shared_ptr<Font> font = APP->window->loadFont(asset::plugin(pluginInstance, "res/fonts/PixelOperator.ttf"));
132-
if(font){
133-
NVGcolor textColor = prepareDisplay(args.vg, &box, 22);
134-
nvgFontFaceId(args.vg, font->handle);
135-
nvgTextLetterSpacing(args.vg, -1.5);
136-
nvgTextAlign(args.vg, NVG_ALIGN_CENTER);
137-
138-
Vec textPos = Vec(box.size.x/2, 21.0f);
139-
nvgFillColor(args.vg, textColor);
140-
141-
if (module != NULL){
142-
get_note_name(module->playing_note,text);
143-
}else{
144-
snprintf(text, 1, " ");
130+
void drawLayer(const DrawArgs& args, int layer) override {
131+
if (layer == 1) {
132+
std::shared_ptr<Font> font = APP->window->loadFont(asset::plugin(pluginInstance, "res/fonts/PixelOperator.ttf"));
133+
if(font){
134+
NVGcolor textColor = prepareDisplay(args.vg, &box, 22);
135+
nvgFontFaceId(args.vg, font->handle);
136+
nvgTextLetterSpacing(args.vg, -1.5);
137+
nvgTextAlign(args.vg, NVG_ALIGN_CENTER);
138+
139+
Vec textPos = Vec(box.size.x/2, 21.0f);
140+
nvgFillColor(args.vg, textColor);
141+
142+
if (module != NULL){
143+
get_note_name(module->playing_note,text);
144+
}else{
145+
snprintf(text, 1, " ");
146+
}
147+
148+
nvgText(args.vg, textPos.x, textPos.y, text, NULL);
145149
}
146-
147-
nvgText(args.vg, textPos.x, textPos.y, text, NULL);
148150
}
151+
Widget::drawLayer(args, layer);
149152
}
150153

151154
};

src/ScaleCV.cpp

Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -107,25 +107,28 @@ struct ScaleCVWidget : ModuleWidget {
107107
module = _module;
108108
}
109109

110-
void draw(const DrawArgs &args) override {
111-
std::shared_ptr<Font> font = APP->window->loadFont(asset::plugin(pluginInstance, "res/fonts/PixelOperator.ttf"));
112-
if(font){
113-
NVGcolor textColor = prepareDisplay(args.vg, &box, 22);
114-
nvgFontFaceId(args.vg, font->handle);
115-
nvgTextLetterSpacing(args.vg, -1.5);
116-
nvgTextAlign(args.vg, NVG_ALIGN_CENTER);
117-
118-
Vec textPos = Vec(box.size.x/2, 21.0f);
119-
nvgFillColor(args.vg, textColor);
120-
121-
if (module != NULL){
122-
get_scale_name(module->root_semi,module->mode,text);
123-
}else{
124-
snprintf(text, 13, " ");
110+
void drawLayer(const DrawArgs& args, int layer) override {
111+
if (layer == 1) {
112+
std::shared_ptr<Font> font = APP->window->loadFont(asset::plugin(pluginInstance, "res/fonts/PixelOperator.ttf"));
113+
if(font){
114+
NVGcolor textColor = prepareDisplay(args.vg, &box, 22);
115+
nvgFontFaceId(args.vg, font->handle);
116+
nvgTextLetterSpacing(args.vg, -1.5);
117+
nvgTextAlign(args.vg, NVG_ALIGN_CENTER);
118+
119+
Vec textPos = Vec(box.size.x/2, 21.0f);
120+
nvgFillColor(args.vg, textColor);
121+
122+
if (module != NULL){
123+
get_scale_name(module->root_semi,module->mode,text);
124+
}else{
125+
snprintf(text, 13, " ");
126+
}
127+
128+
nvgText(args.vg, textPos.x, textPos.y, text, NULL);
125129
}
126-
127-
nvgText(args.vg, textPos.x, textPos.y, text, NULL);
128130
}
131+
Widget::drawLayer(args, layer);
129132
}
130133

131134
};

0 commit comments

Comments
 (0)