add recharge
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user