diff --git a/Source/LcdDisplay.cpp b/Source/LcdDisplay.cpp index 077173f..2225221 100644 --- a/Source/LcdDisplay.cpp +++ b/Source/LcdDisplay.cpp @@ -6,29 +6,24 @@ LcdDisplay::LcdDisplay() startTimerHz (30); } -juce::Font LcdDisplay::getMonoFont() const -{ - return juce::Font (juce::FontOptions { juce::Font::getDefaultMonospacedFontName(), - (float) kCharH - 1.0f, juce::Font::plain }); -} - void LcdDisplay::rasterize (juce::uint32 c) { if (c >= 256 || glyphCache[c].cached) return; - juce::Image img (juce::Image::ARGB, kCharW * 2, kCharH * 2, true); + juce::Image img (juce::Image::ARGB, kRasterW, kRasterH, true); { juce::Graphics g (img); g.setColour (juce::Colours::white); - g.setFont (getMonoFont()); + g.setFont (juce::Font (juce::FontOptions { juce::Font::getDefaultMonospacedFontName(), + 14.0f, juce::Font::plain })); juce::String s; s << (juce_wchar) c; - g.drawText (s, img.getBounds().removeFromBottom (kCharH * 2 - 2), + g.drawText (s, img.getBounds().removeFromBottom (kRasterH - 2), juce::Justification::centredBottom, false); } - const float sx = (float) img.getWidth() / (float) kCharW; - const float sy = (float) img.getHeight() / (float) kCharH; + const float sx = (float) kRasterW / 5.0f; + const float sy = (float) kRasterH / 8.0f; for (int row = 0; row < 8; ++row) glyphCache[c].rows[row] = 0; @@ -41,8 +36,8 @@ void LcdDisplay::rasterize (juce::uint32 c) int count = 0, total = 0; int px0 = (int) (col * sx); int py0 = (int) (row * sy); - int px1 = juce::jmin ((int) ((col + 1) * sx), img.getWidth() - 1); - int py1 = juce::jmin ((int) ((row + 1) * sy), img.getHeight() - 1); + int px1 = juce::jmin ((int) ((col + 1) * sx) - 1, kRasterW - 1); + int py1 = juce::jmin ((int) ((row + 1) * sy) - 1, kRasterH - 1); for (int y = py0; y <= py1; ++y) for (int x = px0; x <= px1; ++x) { @@ -85,25 +80,20 @@ void LcdDisplay::clear() void LcdDisplay::paint (juce::Graphics& g) { - const float cw = (float) kCharW; - const float ch = (float) kCharH; const float w = (float) getWidth(); const float h = (float) getHeight(); const juce::Colour bgCol (0xFF0D1A05); - const juce::Colour gridCol (0xFF15260A); const juce::Colour pixOn (0xFF4AE038); const juce::Colour pixOnDim (0xFF1E3A12); const juce::Colour pixOff (0xFF0F1C07); g.fillAll (bgCol); - g.setColour (gridCol); - float totalW = (float) kCols * cw; - float totalH = (float) kRows * ch; - float ox = (w - totalW) / 2.0f; - float oy = (h - totalH) / 2.0f; - g.fillRect (ox - 1.0f, oy - 1.0f, totalW + 2.0f, totalH + 2.0f); + float cw = w / (float) kCols; + float ch = h / (float) kRows; + float ox = 0.0f; + float oy = 0.0f; bool blinkOn = cursorVisible && ((int) (juce::Time::getMillisecondCounterHiRes() / 400.0) % 2 == 0); @@ -122,6 +112,11 @@ void LcdDisplay::paint (juce::Graphics& g) g.setColour (pixOff); g.fillRect (cx + 0.5f, cy + 0.5f, cw - 1.0f, ch - 1.0f); + float padX = cw * 0.12f; + float padY = ch * 0.1f; + float gw = cw - padX * 2.0f; + float gh = ch - padY * 2.0f; + for (int gRow = 0; gRow < 8; ++gRow) { uint8_t bits = glyph[gRow]; @@ -130,13 +125,13 @@ void LcdDisplay::paint (juce::Graphics& g) { if (bits & (1u << (4 - gCol))) { - float px = cx + 1.0f + (float) gCol * (cw - 2.0f) / 5.0f; - float py = cy + 1.0f + (float) gRow * (ch - 2.0f) / 9.0f; - float pw = (cw - 2.0f) / 5.0f - 0.5f; - float ph = (ch - 2.0f) / 9.0f - 0.3f; + float px = cx + padX + (float) gCol * gw / 5.0f; + float py = cy + padY + (float) gRow * gh / 8.0f; + float pw = gw / 5.0f - 0.5f; + float ph = gh / 8.0f - 0.4f; g.setColour (pixOnDim); - g.fillRect (px - 0.4f, py - 0.3f, pw + 0.8f, ph + 0.6f); + g.fillRect (px - 0.6f, py - 0.4f, pw + 1.2f, ph + 0.8f); g.setColour (pixOn); g.fillRect (px, py, pw, ph); } @@ -146,10 +141,10 @@ void LcdDisplay::paint (juce::Graphics& g) if (blinkOn && col == cursorCol && row == cursorRow) { g.setColour (pixOn); - g.fillRect (cx + 1.0f, cy + ch - 3.0f, cw - 2.0f, 2.0f); + g.fillRect (cx + padX, cy + ch - padY - ch * 0.22f, cw - padX * 2.0f, ch * 0.18f); } } } } -void LcdDisplay::timerCallback() { repaint(); } \ No newline at end of file +void LcdDisplay::timerCallback() { repaint(); } diff --git a/Source/LcdDisplay.h b/Source/LcdDisplay.h index f960636..379af74 100644 --- a/Source/LcdDisplay.h +++ b/Source/LcdDisplay.h @@ -19,8 +19,8 @@ public: private: void timerCallback() override; - static constexpr int kCharW = 6; - static constexpr int kCharH = 9; + static constexpr int kRasterW = 12; + static constexpr int kRasterH = 18; juce::String lines[kRows]; int cursorCol = 0; diff --git a/Source/PluginEditor.cpp b/Source/PluginEditor.cpp index 862940c..f93c68e 100644 --- a/Source/PluginEditor.cpp +++ b/Source/PluginEditor.cpp @@ -50,7 +50,7 @@ void SM26AudioProcessorEditor::setupKnobs() knobSliders[i].setRange (0.0, 1.0, 0.001); knobSliders[i].setColour (juce::Slider::rotarySliderFillColourId, juce::Colour (0xFF3A8A28)); knobSliders[i].setColour (juce::Slider::rotarySliderOutlineColourId, juce::Colour (0xFF1A2E0A)); - knobSliders[i].setColour (juce::Slider::thumbColourId, juce::Colour (0xFFE0E0C0)); + knobSliders[i].setColour (juce::Slider::thumbColourId, juce::Colours::transparentBlack); knobSliders[i].addListener (this); addAndMakeVisible (knobSliders[i]); @@ -473,10 +473,10 @@ void SM26AudioProcessorEditor::resized() knobValueLabels[i].setBounds ((int) x, (int) (knobsY + knobSize + 18), (int) knobSize, 14); } - float navSize = 36.0f; - float navGap = 4.0f; + float navSize = 30.0f; + float navGap = 3.0f; float navCenterX = totalW / 2.0f; - float navCenterY = totalH - 48.0f; + float navCenterY = totalH - 90.0f; navUp.setBounds ((int) (navCenterX - navSize / 2), (int) (navCenterY - navSize - navGap), (int) navSize, (int) navSize); @@ -492,7 +492,7 @@ void SM26AudioProcessorEditor::resized() navEsc.setBounds ((int) (navCenterX + navGap), (int) (navCenterY + navSize + navGap), (int) navSize, (int) navSize); - lcd.setBounds (14, 36, (int) totalW - 28, (int) totalH - 190); + lcd.setBounds (14, 42, (int) totalW - 28, 150); footer.setBounds (8, (int) totalH - 22, (int) totalW - 16, 16); }