| 6 | |
| 7 | |
| 8 | MeterPanel::MeterPanel(const std::string& name, float low, float high, float current) { |
| 9 | this->name = name; |
| 10 | this->low = low; |
| 11 | this->high = high; |
| 12 | this->current = current; |
| 13 | |
| 14 | RGBA4f c1, c2; |
| 15 | |
| 16 | setFill(GLPanel::GLPANEL_FILL_NONE); |
| 17 | |
| 18 | bgPanel.setBorderPx(1); |
| 19 | bgPanel.setCoordinateSystem(GLPanel::GLPANEL_Y_UP); |
| 20 | bgPanel.setFill(GLPanel::GLPANEL_FILL_GRAD_X); |
| 21 | |
| 22 | levelPanel.setBorderPx(0); |
| 23 | levelPanel.setMarginPx(1); |
| 24 | |
| 25 | setPanelLevel(current, levelPanel); |
| 26 | levelPanel.setFill(GLPanel::GLPANEL_FILL_GRAD_BAR_X); |
| 27 | levelPanel.setBlend(GL_ONE, GL_ONE); |
| 28 | |
| 29 | bgPanel.addChild(&levelPanel); |
| 30 | |
| 31 | setPanelLevel(current, highlightPanel); |
| 32 | highlightPanel.setBorderPx(0); |
| 33 | highlightPanel.setMarginPx(1); |
| 34 | highlightPanel.setFill(GLPanel::GLPANEL_FILL_GRAD_BAR_X); |
| 35 | highlightPanel.setBlend(GL_ONE, GL_ONE); |
| 36 | highlightPanel.visible = false; |
| 37 | c1 = RGBA4f(0.3f,0.3f,0.3f,1.0f); |
| 38 | c2 = RGBA4f(0.65f,0.65f,0.65f,1.0f); |
| 39 | highlightPanel.setFillColor(c1, c2); |
| 40 | |
| 41 | bgPanel.addChild(&highlightPanel); |
| 42 | |
| 43 | addChild(&bgPanel); |
| 44 | |
| 45 | labelPanel.setSize(1.0f, 0.1f); |
| 46 | labelPanel.setPosition(0.0, 1.0); |
| 47 | labelPanel.setText(name,GLFont::GLFONT_ALIGN_CENTER, GLFont::GLFONT_ALIGN_CENTER, true); |
| 48 | labelPanel.setFill(GLPanel::GLPANEL_FILL_NONE); |
| 49 | |
| 50 | addChild(&labelPanel); |
| 51 | |
| 52 | valuePanel.setSize(1.0f, 0.1f); |
| 53 | valuePanel.setPosition(0.0, -1.0); |
| 54 | |
| 55 | setValueLabel(std::to_string(int(current))); |
| 56 | valuePanel.setFill(GLPanel::GLPANEL_FILL_NONE); |
| 57 | |
| 58 | addChild(&valuePanel); |
| 59 | } |
| 60 | |
| 61 | MeterPanel::~MeterPanel() = default; |
| 62 |
nothing calls this directly
no test coverage detected