Add demolish-mode vignette
This commit is contained in:
@@ -427,6 +427,7 @@ The screen is divided into two columns: a main column (75% width) containing the
|
||||
- REQ-UI-BOSS-STATUS: The header bar displays, to the left of the speed buttons, the current boss wave counter (REQ-WAV-BOSS-COUNTER) and the time remaining on the boss countdown (REQ-WAV-BOSS-COUNTDOWN). The boss wave counter is shown as `Boss Wave #<x>` and the countdown as `Next boss: <M:SS>`, where `<M:SS>` is the remaining seconds formatted as whole minutes and two-digit seconds. Both values update continuously as the simulation runs.
|
||||
- REQ-UI-SPEED: The game speed controls in the header bar are buttons for 0×, 0.5×, 1×, 2×, and 10× speed. The currently active speed is shown as selected. All game simulation (production, movement, threat accumulation, wave timing) scales with the selected speed. 0× pauses the game.
|
||||
- REQ-UI-PAUSE-BORDER: While the game is paused (speed 0×, whether set via the speed controls (REQ-UI-SPEED), the Space toggle (REQ-UI-HOTKEYS), or an auto-pausing modal), a vignette border is drawn around the edges of the game world view to make the paused state hard to miss. The border is black and fades in the alpha channel from fully transparent at its inner (center-facing) edge to 50% opacity at the viewport edge, over a thickness of 100 pixels (capped at half the smaller viewport dimension on very small views).
|
||||
- REQ-UI-DEMOLISH-BORDER: While demolish mode is active (REQ-UI-DEMOLISH-BUTTON, REQ-UI-HOTKEYS), a vignette border is drawn around the edges of the game world view to signal the mode, matching the geometry of the paused-state vignette (REQ-UI-PAUSE-BORDER): a 100-pixel thickness (capped at half the smaller viewport dimension on very small views) with the four sides meeting along mitred corner diagonals. It fades in the alpha channel from fully transparent at its inner (center-facing) edge to the demolish tint color at the viewport edge. The color — including its alpha, which sets the peak opacity at the viewport edge — is read from `visuals.toml [overlays].demolish_tint`, the same demolish-mode color used for the hover tint. The border is presentation-only and has no effect on the simulation. If the game is both paused and in demolish mode, both vignettes are drawn and compose over each other.
|
||||
- REQ-UI-EXPAND-BUTTON: The header bar shows an asteroid expansion button captioned `Expand: <x> Blocks`, where `<x>` is the current expansion cost computed from `world.toml [expansion].cost_building_blocks_formula` at the current number of purchased expansions (REQ-EXP-COST). Clicking the button unlocks the next asteroid expansion (REQ-EXP-UNLOCK, REQ-GW-ASTEROID-EXPAND), spending that many building blocks from the global stock. The button is disabled when the player cannot currently afford the cost (consistent with REQ-UI-BUILD-DISABLED). The caption updates as the cost changes with each purchased expansion.
|
||||
- REQ-UI-WORLD-SIZE: The game world view occupies the full height below the header bar in the main column (75% of the screen width).
|
||||
- REQ-UI-PANEL-COLUMN: The side panel column occupies 25% of the screen width and the full screen height. It is divided into three equal-height panels stacked top to bottom: selected building panel (top), build button grid (middle), and blueprint panel (bottom).
|
||||
|
||||
@@ -433,6 +433,7 @@ void GameWorldView::paintGL()
|
||||
drawOverlays(painter);
|
||||
drawScreenSpace(painter);
|
||||
drawPauseBorder(painter);
|
||||
drawDemolishBorder(painter);
|
||||
drawReplayOverlay(painter);
|
||||
}
|
||||
|
||||
@@ -1700,15 +1701,27 @@ void GameWorldView::drawScreenSpace(QPainter& /*painter*/)
|
||||
void GameWorldView::drawPauseBorder(QPainter& painter)
|
||||
{
|
||||
if (m_gameSpeedMultiplier > 0.0) { return; }
|
||||
drawVignetteBorder(painter, QColor(0, 0, 0, 128)); // 50% black at the edge
|
||||
}
|
||||
|
||||
void GameWorldView::drawDemolishBorder(QPainter& painter)
|
||||
{
|
||||
if (!m_demolishMode) { return; }
|
||||
// Reuse the demolish overlay color (with its configured alpha) as the edge color.
|
||||
drawVignetteBorder(painter, m_visuals->overlays.demolishTint);
|
||||
}
|
||||
|
||||
void GameWorldView::drawVignetteBorder(QPainter& painter, const QColor& edgeColor)
|
||||
{
|
||||
// Border thickness in pixels, capped so it never exceeds half the viewport on
|
||||
// very small windows (which would leave no un-darkened center).
|
||||
// very small windows (which would leave no un-tinted center).
|
||||
const qreal borderPx = std::min<qreal>(
|
||||
100.0, std::min(width(), height()) / 2.0);
|
||||
if (borderPx <= 0.0) { return; }
|
||||
|
||||
const QColor edge(0, 0, 0, 128); // 50% black at the viewport edge
|
||||
const QColor inner(0, 0, 0, 0); // fully transparent toward the center
|
||||
const QColor& edge = edgeColor; // full color (and alpha) at the viewport edge
|
||||
QColor inner = edgeColor;
|
||||
inner.setAlpha(0); // same color, fully transparent toward the center
|
||||
|
||||
const qreal w = width();
|
||||
const qreal h = height();
|
||||
|
||||
@@ -131,10 +131,18 @@ private:
|
||||
void drawBeams(QPainter& painter);
|
||||
void drawOverlays(QPainter& painter);
|
||||
void drawScreenSpace(QPainter& painter);
|
||||
// Vignette-style border shown while the game is paused (speed 0x) to make the
|
||||
// paused state hard to miss: a black frame whose alpha fades from 50% at the
|
||||
// viewport edges to 0% toward the center.
|
||||
// Vignette-style border shown while the game is paused (speed 0x, REQ-UI-PAUSE-BORDER)
|
||||
// to make the paused state hard to miss: a black frame whose alpha fades from 50% at
|
||||
// the viewport edges to 0% toward the center.
|
||||
void drawPauseBorder(QPainter& painter);
|
||||
// Vignette-style border shown while demolish mode is active (REQ-UI-DEMOLISH-BORDER),
|
||||
// tinted with the demolish overlay color (including its configured alpha) from
|
||||
// visuals.toml instead of black.
|
||||
void drawDemolishBorder(QPainter& painter);
|
||||
// Shared drawing for the pause/demolish vignettes: a mitred picture-frame border
|
||||
// whose alpha fades from `edgeColor` (with its own alpha) at the viewport edge to
|
||||
// fully transparent toward the center.
|
||||
void drawVignetteBorder(QPainter& painter, const QColor& edgeColor);
|
||||
void drawReplayOverlay(QPainter& painter);
|
||||
|
||||
float getTilePx() const;
|
||||
|
||||
Reference in New Issue
Block a user