| 84 | } |
| 85 | |
| 86 | void Gui::drawProgressBar(float x, float y, float w, float h, float frac, const std::string& leftLabel, const std::string& rightLabel) |
| 87 | { |
| 88 | if (frac > 1.0f) { |
| 89 | frac = 1.0f; |
| 90 | } |
| 91 | if (frac < 0.0f) { |
| 92 | frac = 0.0f; |
| 93 | } |
| 94 | TextPool& text = TextPool::get(); |
| 95 | C2D_DrawRectSolid(x, y, 0.5f, w, h, COLOR_BLACK_MEDIUM); |
| 96 | float fillW = w * frac; |
| 97 | if (fillW > 0) { |
| 98 | C2D_DrawRectSolid(x, y, 0.5f, fillW, h, COLOR_ACCENT); |
| 99 | } |
| 100 | text.draw(leftLabel, x, y + h + 3, 0.42f, COLOR_FAINT); |
| 101 | text.draw(rightLabel, x + w - ceilf(text.width(rightLabel, 0.42f)), y + h + 3, 0.42f, COLOR_TEXT); |
| 102 | } |