make the build hotkey badge legible

The shift glyph U+21E7 was not covered by the UI font and rendered as an
unrecognizable substitute, and the badge sat two points below the button font,
which made it hard to read even where the glyph was fine. Use U+2191, a plain
single-stroke arrow the standard fonts do carry, and draw the badge at the full
button font in bold. It stays dimmed, so it still reads as secondary to the cost.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JcReq7hVk4KUPhTDKWAG7K
This commit is contained in:
2026-08-06 08:27:00 +02:00
parent 8f6815f414
commit af410ee4de
3 changed files with 9 additions and 13 deletions

View File

@@ -557,7 +557,7 @@ The screen is divided into two columns: a main column (75% width) containing the
- **Overlay behavior.** The bar occludes the strip of the game world it covers; the world view itself keeps its full extent and the view's scrolling, ghost rendering, and tile geometry are unaffected (the world is not inset for the bar). The bar is drawn above the pause and deconstruct vignettes (REQ-UI-PAUSE-BORDER, REQ-UI-DECONSTRUCT-BORDER), which keep their full 100-pixel bottom band underneath it, and below the modal dim (REQ-UI-MODAL-DIM), which covers the entire game window including the bar.
- **Input.** Mouse events over the bar are consumed by the bar and never reach the game world: hovering it shows no builder-mode ghost at the tile beneath, and clicking it neither places a building nor changes the selection. Right-clicking the bar does not exit builder mode (REQ-BLD-BUILDER-MODE) or cancel a belt drag (REQ-BLD-BELT-DRAG).
- REQ-UI-BUILD-COST: Each button is **icon-only with a cost**, its face composed of three elements: the button's **hotkey badge** in the top-left corner, the building's icon (REQ-UI-BUILD-ICON) centered below it, and the building block cost centered under the icon, shown with the `building_block` item icon (REQ-UI-BLOCKS-ICON, REQ-UI-ITEM-ICON) to the right of the number in place of the trailing `Blocks` word, e.g. `2` then a small block icon. The building name is not shown on the button; it is shown in the button's hover tooltip instead (REQ-UI-BUILD-TOOLTIP). When no icon file exists for `building_block`, the cost is shown as the bare number. The Deconstruct button (REQ-UI-DECONSTRUCT-BUTTON) has no cost and shows its name as a text caption in the cost's place.
- **Hotkey badge.** The badge names the build hotkey that activates the button (REQ-UI-HOTKEYS), so the player can learn the shortcuts from the bar itself. It is rendered smaller and dimmer than the cost so it reads as secondary. A plain-digit hotkey is shown as the bare digit (`1`, `2`, `3`); a Shift+digit hotkey is shown with the shift glyph prefixed and no separator (`1``6`); the Deconstruct button shows `Q`. A button whose building type has no build hotkey shows no badge and keeps the same face size, so the row stays even.
- **Hotkey badge.** The badge names the build hotkey that activates the button (REQ-UI-HOTKEYS), so the player can learn the shortcuts from the bar itself. It is rendered dimmer than the cost so it reads as secondary, but at the same size and in bold, because a smaller badge is not legible. A plain-digit hotkey is shown as the bare digit (`1`, `2`, `3`); a Shift+digit hotkey is shown with an upwards arrow prefixed and no separator (`1``6`); the Deconstruct button shows `Q`. A button whose building type has no build hotkey shows no badge and keeps the same face size, so the row stays even.
- REQ-UI-BUILD-ICON: Each build button shows an icon. Icons are SVG files loaded at runtime from `data/icons/buildings/` (a sibling of the config directory, read the same way as `visuals.toml`), one file per button named after the building's id (e.g. `belt.svg`, `reprocessing_plant.svg`). The shared Tunnel button (REQ-UI-BUILD-BAR) uses `tunnel_entry.svg`; the Deconstruct button (REQ-UI-DECONSTRUCT-BUTTON) uses `deconstruct.svg`. Each icon is a rounded colored "chip" bearing a white line glyph, the chip color following the building's fill color in `visuals.toml`. A missing icon file leaves the button showing its building name as a text caption in place of the icon, so the button stays identifiable in the icon-only bar (REQ-UI-BUILD-COST); it is not an error.
- REQ-UI-BUILD-TOOLTIP: Each building-type button shows a hover tooltip consisting of the building name followed by the descriptive text defined for that building type in `buildings.toml` (the optional per-building tooltip field). Because the button caption is icon-only (REQ-UI-BUILD-COST), the name is always part of the tooltip; if a building type defines no tooltip text, the tooltip shows the name alone. This tooltip is distinct from the recipe/schematic selection tooltip (REQ-UI-SELECT-TOOLTIP). The Deconstruct button (REQ-UI-DECONSTRUCT-BUTTON) is not a building type and so has no config-defined tooltip; it instead shows its own refund tooltip defined in REQ-UI-DECONSTRUCT-BUTTON.
- REQ-UI-BUILD-DISABLED: Buttons for buildings the player cannot currently afford are shown as disabled. A disabled button's icon (REQ-UI-BUILD-ICON) is rendered in a greyed variant, with its colored chip background recolored grey while the white glyph is retained.

View File

@@ -156,17 +156,11 @@ namespace
const QPixmap& blockIcon, const QFont& font,
const QPalette& palette)
{
// Full button size and bold: at a smaller size the badge was hard to read and
// its arrow glyph illegible. It stays dimmed in both modes instead, so it
// reads as a reminder without competing with the cost.
QFont badgeFont = font;
if (font.pointSize() > 0)
{
badgeFont.setPointSize(qMax(1, font.pointSize() - 2));
}
else if (font.pixelSize() > 0)
{
badgeFont.setPixelSize(qMax(1, font.pixelSize() - 2));
}
// The badge is a reminder, not the button's identity, so it stays dimmed in
// both modes rather than competing with the cost.
badgeFont.setBold(true);
const QColor badgeColor = palette.color(QPalette::Disabled, QPalette::ButtonText);
ButtonFace result;

View File

@@ -56,8 +56,10 @@ QString InputMapper::getBuildHotkeyLabel(BuildingType type)
// Searched out of the binding table above rather than spelled out a second time,
// so a badge can never claim a key the handler does not act on. The shift glyph
// is written as a code point because the sources are not guaranteed to be read
// as UTF-8 by every compiler this builds with.
const QChar shiftGlyph(0x21E7); // U+21E7 UPWARDS WHITE ARROW
// as UTF-8 by every compiler this builds with. A plain stroke arrow rather than
// U+21E7 UPWARDS WHITE ARROW: the standard UI fonts do not all carry the outlined
// shift glyph, and the substitute they fall back to is unreadable at badge size.
const QChar shiftGlyph(0x2191); // U+2191 UPWARDS ARROW
for (int digit = 1; digit <= 9; ++digit)
{
if (buildHotkeyType(digit, false) == type)