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

Method step

src/app/ModuleLightWidget.cpp:19–50  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

17 ModuleLightWidget* lightWidget;
18
19 void step() override {
20 if (lightWidget->module) {
21 engine::LightInfo* lightInfo = lightWidget->getLightInfo();
22 if (!lightInfo)
23 return;
24 // Label
25 std::string name = lightInfo->getName();
26 text = string::f(string::translate("ModuleLightWidget.light"), name);
27 // Description
28 std::string description = lightInfo->getDescription();
29 if (description != "") {
30 text += "\n";
31 text += description;
32 }
33 // Brightness for each color
34 text += "\n";
35 int numColors = lightWidget->getNumColors();
36 for (int colorId = 0; colorId < numColors; colorId++) {
37 if (colorId > 1)
38 text += " ";
39 engine::Light* light = lightWidget->getLight(colorId);
40 float brightness = math::clamp(light->getBrightness(), 0.f, 1.f);
41 text += string::f("% 3.0f%%", brightness * 100.f);
42 }
43 }
44 Tooltip::step();
45 // Position at bottom-right of parameter
46 box.pos = lightWidget->getAbsoluteOffset(lightWidget->box.size).round();
47 // Fit inside parent (copied from Tooltip.cpp)
48 assert(parent);
49 box = box.nudge(parent->box.zeroPos());
50 }
51};
52
53

Callers

nothing calls this directly

Calls 14

translateFunction · 0.85
stepFunction · 0.85
getNumColorsMethod · 0.80
roundMethod · 0.80
getAbsoluteOffsetMethod · 0.80
nudgeMethod · 0.80
zeroPosMethod · 0.80
fFunction · 0.50
clampFunction · 0.50
getLightInfoMethod · 0.45
getNameMethod · 0.45
getDescriptionMethod · 0.45

Tested by

no test coverage detected