mwg API
    Preparing search index...

    Class RebindScreen

    A ready-made rebinding flow over Input's existing bind/keysFor/actionsForKey, the same way IconGrid is a ready-made inventory screen over Inventory rather than something every game builds by hand. confirm on a row starts capturing the next physical key pressed; that capture reads the raw onKey signal rather than a named action, since the whole point is accepting a key nothing is bound to yet.

    Capturing a key replaces that action's entire existing binding, the same way a settings screen's "press a key" always means "this is the key now", not "add one more" - a row shows every key Input.keysFor currently returns, but confirming it always ends with exactly one.

    Pressing the physical Escape key while capturing cancels it rather than binding Escape itself - the same reservation DEFAULT_BINDINGS already makes for 'cancel', and the only way to back out of a capture once started.

    import { RebindScreen } from '@datamoc/mw_games/two-d/ui';

    const screen = new RebindScreen({
    width: 200,
    height: 120,
    actions: ['moveUp', 'moveDown', 'confirm'],
    label: (action) => action, // a game usually maps this to a translated string
    });

    screen.handleAction('confirm'); // starts capturing a new key for the highlighted action
    console.log(screen.isCapturing); // true

    Hierarchy

    • Container
      • RebindScreen
    Index
    • Removes all internal references and listeners as well as removes children from the display list. Do not use a Container after calling destroy.

      Parameters

      • Optionaloptions: DestroyOptions

        Options parameter. A boolean will act as if all options have been set to that value

      Returns void

      container.destroy();
      container.destroy(true);
      container.destroy({ children: true });
      container.destroy({ children: true, texture: true, textureSource: true });