Skip to content

Integrate the controls mapper into each Lobby game #197

Description

@cnotv

Context

PR #196 added a standalone Controls Mapper at /tests/ControlsMapper. That view is exclusively for testing the mapper and stays as-is — games do not use it.

Goal

Add a per-game controls-mapping dialog — a modal in the same style as the lobby wizard (GameLobbyWizard) — that lets the player configure that game's key/gamepad/faux-pad bindings before playing. Each game opens its own dialog with its own action set, and the resulting mapping drives that game's createControls.

Scope

  • Build a reusable controls-mapping dialog (wizard-style modal), reusing the mapper's config components (ControlsMapperBindings, ControlsMapperStyle, presets) — not the standalone /tests/ControlsMapper view.
  • The dialog is per game: it receives the game's action list and current mapping, and returns/persists the configured mapping for that game.
  • Open the dialog from each game's lobby (e.g. a "Controls" entry in the lobby wizard / settings).
  • Persist the per-game mapping (localStorage keyed by game) and load it on init, falling back to the game's default KEYBOARD_MAPPING.
  • Apply the configured mapping to the game's createControls (via mapping / setMapping), including the on-screen faux-pad / touch buttons.
  • Keep the standalone /tests/ControlsMapper view unchanged (testing only).
  • Flatten .lobby__game-card: remove border/box-shadow at rest, keep the border on focus (flat LobbyUI consistency).

Reference

  • Reusable config pieces: src/components/ControlsMapper/*, src/stores/controlsMapper.ts
  • Wizard/dialog pattern: src/components/GameLobbyWizard.vue, src/components/LobbyUI/* (e.g. LobbyUIConfirm for the modal shell)
  • Package API: @webgamekit/controls (getMapping, setMapping, assignBinding, createDefaultMapping, savePresets/loadPresets)
  • Per-game input pattern: createControls({ mapping }) + KEYBOARD_MAPPING in each game's config.ts

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions