Add M9.8d rebindable engineering controls
SDL-free action/HID-key bindings with conflict validation, a staging editor and a versioned all-or-nothing controls file (ADR-0085). The adapter maps keys through the bindings, releases and drains on rebinding, and captures the chosen key ahead of the toolkit and world. The client adds a Controls panel, key hints, startup loading with a bounded rejection notice, and --controls/--show-controls. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
// M9.8c engineering panels (ADR-0084). Drawn inside Application's overlay callback;
|
||||
// they read presentation copies and report what the user asked for. Only this file
|
||||
// pair and the platform adapter use the toolkit.
|
||||
#include "evo/client/bindings.hpp"
|
||||
#include "evo/client/environment_view.hpp"
|
||||
#include "evo/client/launcher.hpp"
|
||||
#include "evo/client/organism_view.hpp"
|
||||
@@ -25,6 +26,12 @@ struct FormBuffers {
|
||||
void load(const client::ConnectForm& form);
|
||||
[[nodiscard]] client::ConnectForm form() const;
|
||||
};
|
||||
// One key slot of one action in the controls panel.
|
||||
struct ControlSlot {
|
||||
client::Action action{};
|
||||
bool secondary{};
|
||||
friend bool operator==(const ControlSlot&, const ControlSlot&) = default;
|
||||
};
|
||||
struct PanelView {
|
||||
Mode mode{Mode::launcher};
|
||||
const client::Launcher* launcher{};
|
||||
@@ -36,11 +43,19 @@ struct PanelView {
|
||||
const client::UiState* ui{};
|
||||
std::optional<RemoteStatus> remote;
|
||||
const client::OutcomeLog* outcomes{};
|
||||
int visible_organisms{-1}; // -1 when unknown.
|
||||
int visible_organisms{-1}; // -1 when unknown.
|
||||
const client::Bindings* bindings{}; // In force (hints).
|
||||
// Controls panel, drawn while `controls` is set. Edits stay in the draft until Apply.
|
||||
const client::BindingEditor* controls{};
|
||||
std::optional<ControlSlot> capturing; // Waiting for the next key press.
|
||||
std::optional<client::BindingProblem> controls_problem;
|
||||
};
|
||||
struct PanelActions {
|
||||
bool fixture{}, connect{}, cancel{}, retry{}, back{}, ask_disconnect{};
|
||||
std::optional<std::uint64_t> dismiss_notice, confirm_dialog, cancel_dialog;
|
||||
bool open_controls{}, apply_controls{}, reset_controls{}, close_controls{}, cancel_capture{};
|
||||
std::optional<ControlSlot> capture_key;
|
||||
std::optional<client::Action> clear_secondary;
|
||||
};
|
||||
// Draws every panel for this frame. `display` may be changed by the layer selector.
|
||||
[[nodiscard]] PanelActions draw_panels(const PanelView& view, FormBuffers& form,
|
||||
|
||||
Reference in New Issue
Block a user