show the available controls in a panel over the world
The panel decides nothing about what the controls are: it asks the same resolver the key handling and the mouse dispatch ask, and renders each badge from the binding that resolver matches. A chip cannot claim a key that does nothing, and a label cannot describe a click that does something else, because neither is written here. Display text is the one part that is not shared -- lib/core says what is available and what triggers it, ControlActionText.cpp says what it is called. That split is why the table can stay free of UI strings and still be the single source of the pairing. It refreshes on a timer rather than by subscribing. Two things that change a row -- a belt drag starting, the ghost crossing a transfer target -- happen on mouse movement and publish nothing, and they must still show while the game is paused, so there is no event and no tick to hang it on. Resolving is comparing two vectors of enums, and the rebuild is skipped unless they differ. Left edge, bottom-aligned in the same band the selection panel is confined to, so it clears the build bar's strip and never meets the panel on the opposite edge. Clicking the heading collapses it. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01YHcUerKAZKWNvSKJxYKbnG
This commit is contained in:
26
src/ui/ControlActionText.h
Normal file
26
src/ui/ControlActionText.h
Normal file
@@ -0,0 +1,26 @@
|
||||
#pragma once
|
||||
|
||||
#include <QString>
|
||||
|
||||
#include "ControlAction.h"
|
||||
|
||||
// What the player is shown for the actions and bindings declared in ControlAction.h
|
||||
// (REQ-UI-CONTROLS-CONTENT). Kept out of lib/core deliberately: that file decides what
|
||||
// is available and what triggers it, this one decides what it is called, and only this
|
||||
// half is presentation.
|
||||
//
|
||||
// A badge is rendered from the binding it belongs to rather than written beside it, so
|
||||
// what the panel shows on a chip is what the resolver actually matches. When bindings
|
||||
// become player-configurable, this is the only place that has to learn to spell a
|
||||
// rebound key.
|
||||
|
||||
// The chip text for one binding: "Ctrl+V", "LMB drag", "RMB".
|
||||
QString getControlBindingBadge(const ControlBinding& binding);
|
||||
|
||||
// What the action is called in this context. A few actions are named for their
|
||||
// situation rather than their implementation -- one exit action reads "Exit placement"
|
||||
// in a placement mode and "Exit deconstruct mode" in deconstruct mode.
|
||||
QString getControlActionLabel(ControlAction action, const ControlContext& context);
|
||||
|
||||
// The heading, in the upper case the card shows it in (REQ-UI-CONTROLS-CARD).
|
||||
QString getControlContextName(ControlContextKind kind);
|
||||
Reference in New Issue
Block a user