Browse Source

Add LedDisplayTextField::bgColor. Display LedDisplay text as a non-tinted light when rack brightness is decreased.

tags/v2.0.0
Andrew Belt 3 years ago
parent
commit
5e22369d2e
2 changed files with 9 additions and 4 deletions
  1. +1
    -0
      include/app/LedDisplay.hpp
  2. +8
    -4
      src/app/LedDisplay.cpp

+ 1
- 0
include/app/LedDisplay.hpp View File

@@ -33,6 +33,7 @@ struct LedDisplayTextField : ui::TextField {
std::string fontPath;
math::Vec textOffset;
NVGcolor color;
NVGcolor bgColor;
LedDisplayTextField();
void draw(const DrawArgs& args) override;
int getTextPosition(math::Vec mousePos) override;


+ 8
- 4
src/app/LedDisplay.cpp View File

@@ -54,6 +54,7 @@ void LedDisplayChoice::draw(const DrawArgs& args) {
}

std::shared_ptr<Font> font = APP->window->loadFont(fontPath);
nvgGlobalAlpha(args.vg, 1.0);
if (font && font->handle >= 0) {
nvgFillColor(args.vg, color);
nvgFontFaceId(args.vg, font->handle);
@@ -88,13 +89,16 @@ void LedDisplayTextField::draw(const DrawArgs& args) {
nvgScissor(args.vg, RECT_ARGS(args.clipBox));

// Background
nvgBeginPath(args.vg);
nvgRoundedRect(args.vg, 0, 0, box.size.x, box.size.y, 5.0);
nvgFillColor(args.vg, nvgRGB(0x00, 0x00, 0x00));
nvgFill(args.vg);
if (bgColor.a > 0.0) {
nvgBeginPath(args.vg);
nvgRoundedRect(args.vg, 0, 0, box.size.x, box.size.y, 5.0);
nvgFillColor(args.vg, nvgRGB(0x00, 0x00, 0x00));
nvgFill(args.vg);
}

// Text
std::shared_ptr<Font> font = APP->window->loadFont(fontPath);
nvgGlobalAlpha(args.vg, 1.0);
if (font && font->handle >= 0) {
bndSetFont(font->handle);



Loading…
Cancel
Save