MCPcopy Create free account
hub / github.com/VCVRack/Rack / draw

Method draw

src/ui/Label.cpp:15–35  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

13}
14
15void Label::draw(const DrawArgs& args) {
16 // TODO
17 // Custom font sizes do not work with right or center alignment
18 float x;
19 switch (alignment) {
20 default:
21 case LEFT_ALIGNMENT: {
22 x = 0.0;
23 } break;
24 case RIGHT_ALIGNMENT: {
25 x = box.size.x - bndLabelWidth(args.vg, -1, text.c_str());
26 } break;
27 case CENTER_ALIGNMENT: {
28 x = (box.size.x - bndLabelWidth(args.vg, -1, text.c_str())) / 2.0;
29 } break;
30 }
31
32 nvgTextLineHeight(args.vg, lineHeight);
33 NVGcolor colorActual = (color.a > 0.f) ? color : bndGetTheme()->regularTheme.textColor;
34 bndIconLabelValue(args.vg, x, 0.0, box.size.x, box.size.y, -1, colorActual, BND_LEFT, fontSize, text.c_str(), NULL);
35}
36
37
38} // namespace ui

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected