| 78 | } |
| 79 | |
| 80 | void ScriptTile::bar(int x, int y, int w, const ScriptConsole::Layer& layer) |
| 81 | { |
| 82 | const float frac = ScriptBar::fraction(layer); |
| 83 | |
| 84 | Shapes::fillRound(x, y, w, BAR_H, BAR_H / 2, COLOR_FILL2); |
| 85 | const int fillW = (int)(w * frac); |
| 86 | if (fillW > 0) { |
| 87 | Shapes::fillRound(x, y, std::max(fillW, BAR_H), BAR_H, BAR_H / 2, COLOR_ACCENT); |
| 88 | } |
| 89 | |
| 90 | // An idle slot still says what it is and where it got to, dimmed: a bare |
| 91 | // track with nothing under it reads as a bar that is stuck. |
| 92 | const Color labelColor = layer.active ? COLOR_TEXT2 : COLOR_TEXT3; |
| 93 | const Color rightColor = layer.active ? COLOR_TEXT : COLOR_TEXT3; |
| 94 | |
| 95 | const std::string right = ScriptBar::rightText(layer); |
| 96 | u32 rw = 0, rh = 0; |
| 97 | if (!right.empty()) { |
| 98 | Gfx::GetTextDimensions(NOTE_SIZE, right.c_str(), &rw, &rh); |
| 99 | Gfx::DrawText(NOTE_SIZE, x + w - (int)rw, y + BAR_H + 6, rightColor, right.c_str()); |
| 100 | } |
| 101 | if (!layer.label.empty()) { |
| 102 | Gfx::DrawText(NOTE_SIZE, x, y + BAR_H + 6, labelColor, trimToFit(layer.label, w - (int)rw - 12, NOTE_SIZE).c_str()); |
| 103 | } |
| 104 | } |
| 105 | |
| 106 | size_t ScriptTile::collectBars(const ScriptConsole::ProgressSnapshot& snapshot, ScriptConsole::Layer* out) |
| 107 | { |