add recharge

This commit is contained in:
2026-11-10 19:54:00 +01:00
parent ea0eedc0fb
commit 772d4494e8
30 changed files with 1357 additions and 1073 deletions
+13
View File
@@ -769,6 +769,19 @@ void QSceneRenderer::drawUnitsOverlay(QPainter &painter, const QMatrix4x4 &vMatr
painter.drawRoundedRect(bpFg, 1.5, 1.5);
}
// Recharge bar below military units when recharging
if (unit->config.canAttack() && unit->isRecharging()) {
float rechargePercent = std::max(0.0f, std::min(1.0f, unit->rechargeTimer / unit->config.rechargeTime));
QRectF recBg(headCenter.x() - 14.0f, headCenter.y() - R - 5.5f, 28.0f, 3.5f);
painter.setBrush(QColor(30, 30, 30, 220));
painter.setPen(Qt::NoPen);
painter.drawRoundedRect(recBg, 1.5, 1.5);
QRectF recFg(headCenter.x() - 14.0f, headCenter.y() - R - 5.5f, 28.0f * (1.0f - rechargePercent), 3.5f);
painter.setBrush(QColor(240, 50, 50));
painter.drawRoundedRect(recFg, 1.5, 1.5);
}
// If unit is selected: pulsing selection halo & floating action bubbles
if (unit.get() == selectedUnit) {
float pulse = (std::sin(m_elapsedTimer.elapsed() * 0.008f) + 1.0f) * 0.5f;