Browse Source

Add bgColor to MenuOverlay

tags/v2.0.0
Andrew Belt 3 years ago
parent
commit
cdc44cda71
4 changed files with 16 additions and 5 deletions
  1. +3
    -0
      include/ui/MenuOverlay.hpp
  2. +1
    -0
      src/app/ModuleBrowser.cpp
  3. +1
    -0
      src/app/TipWindow.cpp
  4. +11
    -5
      src/ui/MenuOverlay.cpp

+ 3
- 0
include/ui/MenuOverlay.hpp View File

@@ -9,6 +9,9 @@ namespace ui {

/** Deletes itself from parent when clicked */
struct MenuOverlay : widget::OpaqueWidget {
NVGcolor bgColor;

MenuOverlay();
void draw(const DrawArgs& args) override;
void step() override;
void onButton(const ButtonEvent& e) override;


+ 1
- 0
src/app/ModuleBrowser.cpp View File

@@ -915,6 +915,7 @@ inline void ZoomItem::onAction(const ActionEvent& e) {

widget::Widget* moduleBrowserCreate() {
moduleBrowser::BrowserOverlay* overlay = new moduleBrowser::BrowserOverlay;
overlay->bgColor = nvgRGBAf(0, 0, 0, 0.33);

moduleBrowser::ModuleBrowser* browser = new moduleBrowser::ModuleBrowser;
overlay->addChild(browser);


+ 1
- 0
src/app/TipWindow.cpp View File

@@ -174,6 +174,7 @@ struct TipWindow : widget::OpaqueWidget {

widget::Widget* tipWindowCreate() {
ui::MenuOverlay* overlay = new ui::MenuOverlay;
overlay->bgColor = nvgRGBAf(0, 0, 0, 0.33);

TipWindow* tipWindow = new TipWindow;
overlay->addChild(tipWindow);


+ 11
- 5
src/ui/MenuOverlay.cpp View File

@@ -5,12 +5,18 @@ namespace rack {
namespace ui {


MenuOverlay::MenuOverlay() {
bgColor = nvgRGBA(0, 0, 0, 0);
}


void MenuOverlay::draw(const DrawArgs& args) {
// Translucent background
// nvgBeginPath(args.vg);
// nvgRect(args.vg, 0, 0, VEC_ARGS(box.size));
// nvgFillColor(args.vg, nvgRGBAf(0, 0, 0, 0.33));
// nvgFill(args.vg);
if (bgColor.a > 0.f) {
nvgBeginPath(args.vg);
nvgRect(args.vg, 0, 0, VEC_ARGS(box.size));
nvgFillColor(args.vg, bgColor);
nvgFill(args.vg);
}

OpaqueWidget::draw(args);
}


Loading…
Cancel
Save