| 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 |
nothing calls this directly
no test coverage detected