Browse Source

Load Scope font every frame instead of in constructor.

tags/v2.0.1
Andrew Belt 3 years ago
parent
commit
3a2731a832
1 changed files with 4 additions and 2 deletions
  1. +4
    -2
      src/Scope.cpp

+ 4
- 2
src/Scope.cpp View File

@@ -180,7 +180,7 @@ struct Scope : Module {
struct ScopeDisplay : TransparentWidget { struct ScopeDisplay : TransparentWidget {
Scope* module; Scope* module;
int statsFrame = 0; int statsFrame = 0;
std::shared_ptr<Font> font;
std::string fontPath;


struct Stats { struct Stats {
float vpp = 0.f; float vpp = 0.f;
@@ -202,7 +202,7 @@ struct ScopeDisplay : TransparentWidget {
Stats statsX, statsY; Stats statsX, statsY;


ScopeDisplay() { ScopeDisplay() {
font = APP->window->loadFont(asset::plugin(pluginInstance, "res/sudo/Sudo.ttf"));
fontPath = asset::plugin(pluginInstance, "res/sudo/Sudo.ttf");
} }


void drawWaveform(const DrawArgs& args, float* bufferX, float offsetX, float gainX, float* bufferY, float offsetY, float gainY) { void drawWaveform(const DrawArgs& args, float* bufferX, float offsetX, float gainX, float* bufferY, float offsetY, float gainY) {
@@ -265,6 +265,7 @@ struct ScopeDisplay : TransparentWidget {
} }
nvgFill(args.vg); nvgFill(args.vg);


std::shared_ptr<Font> font = APP->window->loadFont(fontPath);
nvgFontSize(args.vg, 9); nvgFontSize(args.vg, 9);
nvgFontFaceId(args.vg, font->handle); nvgFontFaceId(args.vg, font->handle);
nvgFillColor(args.vg, nvgRGBA(0x1e, 0x28, 0x2b, 0xff)); nvgFillColor(args.vg, nvgRGBA(0x1e, 0x28, 0x2b, 0xff));
@@ -273,6 +274,7 @@ struct ScopeDisplay : TransparentWidget {
} }


void drawStats(const DrawArgs& args, Vec pos, const char* title, Stats* stats) { void drawStats(const DrawArgs& args, Vec pos, const char* title, Stats* stats) {
std::shared_ptr<Font> font = APP->window->loadFont(fontPath);
nvgFontSize(args.vg, 13); nvgFontSize(args.vg, 13);
nvgFontFaceId(args.vg, font->handle); nvgFontFaceId(args.vg, font->handle);
nvgTextLetterSpacing(args.vg, -2); nvgTextLetterSpacing(args.vg, -2);


Loading…
Cancel
Save