Browse Source

Fonts need to be loaded locally in v2

pull/114/head
Aaron Static 3 years ago
parent
commit
f77fcc0e8c
1 changed files with 6 additions and 3 deletions
  1. +6
    -3
      src/Braids.cpp

+ 6
- 3
src/Braids.cpp View File

@@ -253,10 +253,9 @@ static const std::vector<ShapeInfo> SHAPE_INFOS = {


struct BraidsDisplay : TransparentWidget { struct BraidsDisplay : TransparentWidget {
Braids* module; Braids* module;
std::shared_ptr<Font> font;


BraidsDisplay() { BraidsDisplay() {
font = APP->window->loadFont(asset::plugin(pluginInstance, "res/hdad-segment14-1.002/Segment14.ttf"));
} }


void draw(const DrawArgs& args) override { void draw(const DrawArgs& args) override {
@@ -285,7 +284,11 @@ struct BraidsDisplay : TransparentWidget {
// Background of all segments // Background of all segments
nvgText(args.vg, textPos.x, textPos.y, "~~~~", NULL); nvgText(args.vg, textPos.x, textPos.y, "~~~~", NULL);
nvgFillColor(args.vg, textColor); nvgFillColor(args.vg, textColor);
nvgText(args.vg, textPos.x, textPos.y, SHAPE_INFOS[shape].code.c_str(), NULL);

std::shared_ptr<Font> font = APP->window->loadFont(asset::plugin(pluginInstance, "res/hdad-segment14-1.002/Segment14.ttf"));
if(font){
nvgText(args.vg, textPos.x, textPos.y, SHAPE_INFOS[shape].code.c_str(), NULL);
}
} }
}; };




Loading…
Cancel
Save