mwg API
    Preparing search index...

    Class SettingsScreen

    A ready-made settings screen over core.Settings: music and sound-effect sliders, a mute checkbox, a zoom slider, one row per game-defined custom descriptor, a controls page (RebindScreen), and a reset-to-defaults row. Every change writes straight through to the Settings it was given, so there is no apply step and no second persistence mechanism.

    Bindings captured on the controls page reach Input directly, bypassing Settings; leaving the page writes them back into it, so a rebind survives a restart. cancel on the main page is left to the caller (a Window closes, typically), reported as false.

    import { Settings } from '@datamoc/mwg/core';
    import { SettingsScreen } from '@datamoc/mwg/two-d/ui';

    const settings = new Settings({ namespace: 'my-game' });
    const screen = new SettingsScreen({
    settings,
    custom: [{ kind: 'boolean', key: 'hints', label: 'Hints' }],
    });

    screen.handleAction('down');
    console.log(screen.selectedRow); // 'sfx'

    Hierarchy

    • Container
      • SettingsScreen
    Index
    • get selectedRow(): string

      the selected main-page row: 'music', 'sfx', 'muted', 'zoom', custom:${key}, 'controls' or 'reset'

      Returns string

    • 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 });
    • Parameters

      • action: string

      Returns boolean

      true when the action was used; cancel on the main page returns false