Browse Source

Draw light-like widgets on layer 1 instead of use nvgGlobalTint().

tags/v2.0.1
Andrew Belt 3 years ago
parent
commit
ac917844c8
4 changed files with 16 additions and 14 deletions
  1. +4
    -4
      src/Octave.cpp
  2. +4
    -4
      src/Quantizer.cpp
  3. +4
    -4
      src/Scope.cpp
  4. +4
    -2
      src/VCA.cpp

+ 4
- 4
src/Octave.cpp View File

@@ -55,7 +55,10 @@ struct Octave : Module {
struct OctaveButton : Widget {
int octave;

void draw(const DrawArgs& args) override {
void drawLayer(const DrawArgs& args, int layer) override {
if (layer != 1)
return;

Vec c = box.size.div(2);

int activeOctave = 0;
@@ -65,9 +68,6 @@ struct OctaveButton : Widget {
if (pq)
activeOctave = std::round(pq->getValue());

// Disable tinting when rack brightness is decreased
nvgGlobalTint(args.vg, color::WHITE);

if (activeOctave == octave) {
// Enabled
nvgBeginPath(args.vg);


+ 4
- 4
src/Quantizer.cpp View File

@@ -124,13 +124,13 @@ struct QuantizerButton : OpaqueWidget {
int note;
Quantizer* module;

void draw(const DrawArgs& args) override {
void drawLayer(const DrawArgs& args, int layer) override {
if (layer != 1)
return;

const float margin = mm2px(1.5);
Rect r = box.zeroPos().grow(Vec(margin, margin / 2).neg());

// Disable tinting when rack brightness is decreased
nvgGlobalTint(args.vg, color::WHITE);

nvgBeginPath(args.vg);
nvgRect(args.vg, RECT_ARGS(r));
if (module ? module->playingNotes[note] : (note == 0)) {


+ 4
- 4
src/Scope.cpp View File

@@ -297,12 +297,12 @@ struct ScopeDisplay : TransparentWidget {
nvgText(args.vg, pos.x + 58 * 2, pos.y, text.c_str(), NULL);
}

void draw(const DrawArgs& args) override {
if (!module)
void drawLayer(const DrawArgs& args, int layer) override {
if (layer != 1)
return;

// Disable tinting when rack brightness is decreased
nvgGlobalTint(args.vg, color::WHITE);
if (!module)
return;

float gainX = std::pow(2.f, std::round(module->params[Scope::X_SCALE_PARAM].getValue())) / 10.f;
float gainY = std::pow(2.f, std::round(module->params[Scope::Y_SCALE_PARAM].getValue())) / 10.f;


+ 4
- 2
src/VCA.cpp View File

@@ -210,9 +210,11 @@ struct VCA_1VUKnob : SliderKnob {
nvgRoundedRect(args.vg, 0, 0, box.size.x, box.size.y, 2.0);
nvgFillColor(args.vg, nvgRGB(0, 0, 0));
nvgFill(args.vg);
}

// Disable tinting when rack brightness is decreased
nvgGlobalTint(args.vg, color::WHITE);
void drawLayer(const DrawArgs& args, int layer) override {
if (layer != 1)
return;

const Vec margin = Vec(3, 3);
Rect r = box.zeroPos().grow(margin.neg());


Loading…
Cancel
Save