<!DOCTYPE html><htmlclass="default"lang="en"><head><metacharSet="utf-8"/><metahttp-equiv="x-ua-compatible"content="IE=edge"/><title>InputsController | pokemon-rogue-battle</title><metaname="description"content="Documentation for pokemon-rogue-battle"/><metaname="viewport"content="width=device-width, initial-scale=1"/><linkrel="stylesheet"href="../assets/style.css"/><linkrel="stylesheet"href="../assets/highlight.css"/><scriptdefersrc="../assets/main.js"></script><scriptasyncsrc="../assets/icons.js"id="tsd-icons-script"></script><scriptasyncsrc="../assets/search.js"id="tsd-search-script"></script><scriptasyncsrc="../assets/navigation.js"id="tsd-nav-script"></script></head><body><script>document.documentElement.dataset.theme=localStorage.getItem("tsd-theme")||"os";document.body.style.display="none";setTimeout(()=>app?app.showPage():document.body.style.removeProperty("display"),500)</script><headerclass="tsd-page-toolbar"><divclass="tsd-toolbar-contents container"><divclass="table-cell"id="tsd-search"data-base=".."><divclass="field"><labelfor="tsd-search-field"class="tsd-widget tsd-toolbar-icon search no-caption"><svgwidth="16"height="16"viewBox="0 0 16 16"fill="none"><usehref="../assets/icons.svg#icon-search"></use></svg></label><inputtype="text"id="tsd-search-field"aria-label="Search"/></div><divclass="field"><divid="tsd-toolbar-links"></div></div><ulclass="results"><liclass="state loading">Preparing search index...</li><liclass="state failure">The search index is not available</li></ul><ahref="../index.html"class="title">pokemon-rogue-battle</a></div><divclass="table-cell"id="tsd-widgets"><ahref="#"class="tsd-widget tsd-toolbar-icon menu no-caption"data-toggle="menu"aria-label="Menu"><svgwidth="16"height="16"viewBox="0 0 16 16"fill="none"><usehref="../assets/icons.svg#icon-menu"></use></svg></a></div></div></header><divclass="container container-main"><divclass="col-content"><divclass="tsd-page-title"><ulclass="tsd-breadcrumb"><li><ahref="../index.html">pokemon-rogue-battle</a></li><li><ahref="../modules/inputs_controller.html">inputs-controller</a></li><li><ahref="inputs_controller.InputsController.html">InputsController</a></li></ul><h1>Class InputsController</h1></div><sectionclass="tsd-panel tsd-comment"><divclass="tsd-comment tsd-typography"><p>Manages and handles all input controls for the game, including keyboard and gamepad interactions.</p>
</div><divclass="tsd-comment tsd-typography"><h4>Remarks</h4><p>This class is designed to centralize input management across the game. It facilitates the setup,
configuration, and handling of all game inputs, making it easier to manage various input devices
such as keyboards and gamepads. The class provides methods for setting up input devices, handling
their events, and responding to changes in input state (e.g., button presses, releases).</p>
<p>The <code>InputsController</code> class also includes mechanisms to handle game focus events to ensure input
states are correctly reset and managed when the game loses or regains focus, maintaining robust
and responsive control handling throughout the game's lifecycle.</p>
<p>Key responsibilities include:</p>
<ul>
<li>Initializing and configuring gamepad and keyboard controls.</li>
<li>Emitting events related to specific input actions.</li>
<li>Responding to external changes such as gamepad connection/disconnection.</li>
<li>Managing game state transitions in response to input events, particularly focus loss and recovery.</li>
</ul>
<p>Usage of this class is intended to simplify input management across various parts of the game,
providing a unified interface for all input-related interactions.</p>
</div></section></div></details></section></section><sectionclass="tsd-panel-group tsd-member-group"><h2>Constructors</h2><sectionclass="tsd-panel tsd-member"><aid="constructor"class="tsd-anchor"></a><h3class="tsd-anchor-link"><span>constructor</span><ahref="#constructor"aria-label="Permalink"class="tsd-anchor-icon"><svgviewBox="0 0 24 24"><usehref="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ulclass="tsd-signatures"><liclass="tsd-signature tsd-anchor-link"><aid="constructor.new_InputsController"class="tsd-anchor"></a><spanclass="tsd-kind-constructor-signature">new <wbr/>Inputs<wbr/>Controller</span><spanclass="tsd-signature-symbol">(</span><spanclass="tsd-kind-parameter">scene</span><spanclass="tsd-signature-symbol">)</span><spanclass="tsd-signature-symbol">: </span><ahref="inputs_controller.InputsController.html"class="tsd-signature-type tsd-kind-class">InputsController</a><ahref="#constructor.new_InputsController"aria-label="Permalink"class="tsd-anchor-icon"><svgviewBox="0 0 24 24"><usehref="../assets/icons.svg#icon-anchor"></use></svg></a></li><liclass="tsd-description"><divclass="tsd-comment tsd-typography"><p>Initializes a new instance of the game control system, setting up initial state and configurations.</p>
</div><divclass="tsd-parameters"><h4class="tsd-parameters-title">Parameters</h4><ulclass="tsd-parameter-list"><li><span><spanclass="tsd-kind-parameter">scene</span>: <ahref="battle_scene.default.html"class="tsd-signature-type tsd-kind-class">default</a></span><divclass="tsd-comment tsd-typography"><p>The Phaser scene associated with this instance.</p>
</div><divclass="tsd-comment tsd-typography"></div></li></ul></div><h4class="tsd-returns-title">Returns <ahref="inputs_controller.InputsController.html"class="tsd-signature-type tsd-kind-class">InputsController</a></h4><divclass="tsd-comment tsd-typography"><h4>Remarks</h4><p>This constructor initializes the game control system with necessary setups for handling inputs.
It prepares an interactions array indexed by button identifiers and configures default states for each button.
Specific buttons like MENU and STATS are set not to repeat their actions.
It concludes by calling the <code>init</code> method to complete the setup.</p>
</div><divclass="tsd-comment tsd-typography"></div></li><li><span><spanclass="tsd-kind-parameter">settingName</span>: <spanclass="tsd-signature-type">any</span></span><divclass="tsd-comment tsd-typography"><p>The name of the setting to swap.</p>
</div><divclass="tsd-comment tsd-typography"></div></li><li><span><spanclass="tsd-kind-parameter">pressedButton</span>: <spanclass="tsd-signature-type">any</span></span><divclass="tsd-comment tsd-typography"><p>The button that was pressed.</p>
</div><divclass="tsd-comment tsd-typography"></div></li></ul></div><h4class="tsd-returns-title">Returns <spanclass="tsd-signature-type">boolean</span></h4><divclass="tsd-comment tsd-typography"></div><asideclass="tsd-sources"><ul><li>Defined in <ahref="https://github.com/pagefaultgames/pokerogue/blob/538cb3eb5cd5441773d8d35281339c1d77651ffa/src/inputs-controller.ts#L602">src/inputs-controller.ts:602</a></li></ul></aside></li></ul></section><sectionclass="tsd-panel tsd-member"><aid="deactivatePressedKey"class="tsd-anchor"></a><h3class="tsd-anchor-link"><span>deactivate<wbr/>Pressed<wbr/>Key</span><ahref="#deactivatePressedKey"aria-label="Permalink"class="tsd-anchor-icon"><svgviewBox="0 0 24 24"><usehref="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ulclass="tsd-signatures"><liclass="tsd-signature tsd-anchor-link"><aid="deactivatePressedKey.deactivatePressedKey-1"class="tsd-anchor"></a><spanclass="tsd-kind-call-signature">deactivate<wbr/>Pressed<wbr/>Key</span><spanclass="tsd-signature-symbol">(</span><spanclass="tsd-signature-symbol">)</span><spanclass="tsd-signature-symbol">: </span><spanclass="tsd-signature-type">void</span><ahref="#deactivatePressedKey.deactivatePressedKey-1"aria-label="Permalink"class="tsd-anchor-icon"><svgviewBox="0 0 24 24"><usehref="../assets/icons.svg#icon-anchor"></use></svg></a></li><liclass="tsd-description"><divclass="tsd-comment tsd-typography"><p>Deactivates all currently pressed keys.</p>
</div><h4class="tsd-returns-title">Returns <spanclass="tsd-signature-type">void</span></h4><divclass="tsd-comment tsd-typography"></div><asideclass="tsd-sources"><ul><li>Defined in <ahref="https://github.com/pagefaultgames/pokerogue/blob/538cb3eb5cd5441773d8d35281339c1d77651ffa/src/inputs-controller.ts#L525">src/inputs-controller.ts:525</a></li></ul></aside></li></ul></section><sectionclass="tsd-panel tsd-member"><aid="ensureKeyboardIsInit"class="tsd-anchor"></a><h3class="tsd-anchor-link"><span>ensure<wbr/>Keyboard<wbr/>Is<wbr/>Init</span><ahref="#ensureKeyboardIsInit"aria-label="Permalink"class="tsd-anchor-icon"><svgviewBox="0 0 24 24"><usehref="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ulclass="tsd-signatures"><liclass="tsd-signature tsd-anchor-link"><aid="ensureKeyboardIsInit.ensureKeyboardIsInit-1"class="tsd-anchor"></a><spanclass="tsd-kind-call-signature">ensure<wbr/>Keyboard<wbr/>Is<wbr/>Init</span><spanclass="tsd-signature-symbol">(</span><spanclass="tsd-signature-symbol">)</span><spanclass="tsd-signature-symbol">: </span><spanclass="tsd-signature-type">void</span><ahref="#ensureKeyboardIsInit.ensureKeyboardIsInit-1"aria-label="Permalink"class="tsd-anchor-icon"><svgviewBox="0 0 24 24"><usehref="../assets/icons.svg#icon-anchor"></use></svg></a></li><liclass="tsd-description"><divclass="tsd-comment tsd-typography"><p>Ensures the keyboard is initialized by checking if there is an active configuration for the keyboard.
</div><h4class="tsd-returns-title">Returns <spanclass="tsd-signature-type">void</span></h4><divclass="tsd-comment tsd-typography"></div><asideclass="tsd-sources"><ul><li>Defined in <ahref="https://github.com/pagefaultgames/pokerogue/blob/538cb3eb5cd5441773d8d35281339c1d77651ffa/src/inputs-controller.ts#L354">src/inputs-controller.ts:354</a></li></ul></aside></li></ul></section><sectionclass="tsd-panel tsd-member"><aid="gamepadButtonDown"class="tsd-anchor"></a><h3class="tsd-anchor-link"><span>gamepad<wbr/>Button<wbr/>Down</span><ahref="#gamepadButtonDown"aria-label="Permalink"class="tsd-anchor-icon"><svgviewBox="0 0 24 24"><usehref="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ulclass="tsd-signatures"><liclass="tsd-signature tsd-anchor-link"><aid="gamepadButtonDown.gamepadButtonDown-1"class="tsd-anchor"></a><spanclass="tsd-kind-call-signature">gamepad<wbr/>Button<wbr/>Down</span><spanclass="tsd-signature-symbol">(</span><spanclass="tsd-kind-parameter">pad</span>, <spanclass="tsd-kind-parameter">button</span>, <spanclass="tsd-kind-parameter">value</span><spanclass="tsd-signature-symbol">)</span><spanclass="tsd-signature-symbol">: </span><spanclass="tsd-signature-type">void</span><ahref="#gamepadButtonDown.gamepadButtonDown-1"aria-label="Permalink"class="tsd-anchor-icon"><svgviewBox="0 0 24 24"><usehref="../assets/icons.svg#icon-anchor"></use></svg></a></li><liclass="tsd-description"><divclass="tsd-comment tsd-typography"><p>Handles button press events on a gamepad. This method sets the gamepad as chosen on the first input if no gamepad is currently chosen.
It checks if gamepad support is enabled and if the event comes from the chosen gamepad. If so, it maps the button press to a specific
action using a custom configuration, emits an event for the button press, and records the time of the action.</p>
</div><divclass="tsd-parameters"><h4class="tsd-parameters-title">Parameters</h4><ulclass="tsd-parameter-list"><li><span><spanclass="tsd-kind-parameter">pad</span>: <spanclass="tsd-signature-type">Gamepad</span></span><divclass="tsd-comment tsd-typography"><p>The gamepad on which the button was pressed.</p>
</div><divclass="tsd-comment tsd-typography"></div></li><li><span><spanclass="tsd-kind-parameter">button</span>: <spanclass="tsd-signature-type">Button</span></span><divclass="tsd-comment tsd-typography"><p>The specific button that was pressed.</p>
</div><divclass="tsd-comment tsd-typography"></div></li><li><span><spanclass="tsd-kind-parameter">value</span>: <spanclass="tsd-signature-type">number</span></span><divclass="tsd-comment tsd-typography"><p>The intensity or value of the button press, if applicable.</p>
</div><divclass="tsd-comment tsd-typography"></div></li></ul></div><h4class="tsd-returns-title">Returns <spanclass="tsd-signature-type">void</span></h4><divclass="tsd-comment tsd-typography"></div><asideclass="tsd-sources"><ul><li>Defined in <ahref="https://github.com/pagefaultgames/pokerogue/blob/538cb3eb5cd5441773d8d35281339c1d77651ffa/src/inputs-controller.ts#L416">src/inputs-controller.ts:416</a></li></ul></aside></li></ul></section><sectionclass="tsd-panel tsd-member"><aid="gamepadButtonUp"class="tsd-anchor"></a><h3class="tsd-anchor-link"><span>gamepad<wbr/>Button<wbr/>Up</span><ahref="#gamepadButtonUp"aria-label="Permalink"class="tsd-anchor-icon"><svgviewBox="0 0 24 24"><usehref="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ulclass="tsd-signatures"><liclass="tsd-signature tsd-anchor-link"><aid="gamepadButtonUp.gamepadButtonUp-1"class="tsd-anchor"></a><spanclass="tsd-kind-call-signature">gamepad<wbr/>Button<wbr/>Up</span><spanclass="tsd-signature-symbol">(</span><spanclass="tsd-kind-parameter">pad</span>, <spanclass="tsd-kind-parameter">button</span>, <spanclass="tsd-kind-parameter">value</span><spanclass="tsd-signature-symbol">)</span><spanclass="tsd-signature-symbol">: </span><spanclass="tsd-signature-type">void</span><ahref="#gamepadButtonUp.gamepadButtonUp-1"aria-label="Permalink"class="tsd-anchor-icon"><svgviewBox="0 0 24 24"><usehref="../assets/icons.svg#icon-anchor"></use></svg></a></li><liclass="tsd-description"><divclass="tsd-comment tsd-typography"><p>Responds to a button release event on a gamepad by checking if the gamepad is supported and currently chosen.
If conditions are met, it identifies the configured action for the button, emits an event signaling the button release,
and clears the record of the button.</p>
</div><divclass="tsd-parameters"><h4class="tsd-parameters-title">Parameters</h4><ulclass="tsd-parameter-list"><li><span><spanclass="tsd-kind-parameter">pad</span>: <spanclass="tsd-signature-type">Gamepad</span></span><divclass="tsd-comment tsd-typography"><p>The gamepad from which the button was released.</p>
</div><divclass="tsd-comment tsd-typography"></div></li><li><span><spanclass="tsd-kind-parameter">button</span>: <spanclass="tsd-signature-type">Button</span></span><divclass="tsd-comment tsd-typography"><p>The specific button that was released.</p>
</div><divclass="tsd-comment tsd-typography"></div></li><li><span><spanclass="tsd-kind-parameter">value</span>: <spanclass="tsd-signature-type">number</span></span><divclass="tsd-comment tsd-typography"><p>The intensity or value of the button release, if applicable.</p>
</div><divclass="tsd-comment tsd-typography"></div></li></ul></div><h4class="tsd-returns-title">Returns <spanclass="tsd-signature-type">void</span></h4><divclass="tsd-comment tsd-typography"></div><asideclass="tsd-sources"><ul><li>Defined in <ahref="https://github.com/pagefaultgames/pokerogue/blob/538cb3eb5cd5441773d8d35281339c1d77651ffa/src/inputs-controller.ts#L464">src/inputs-controller.ts:464</a></li></ul></aside></li></ul></section><sectionclass="tsd-panel tsd-member"><aid="getActiveConfig"class="tsd-anchor"></a><h3class="tsd-anchor-link"><span>get<wbr/>Active<wbr/>Config</span><ahref="#getActiveConfig"aria-label="Permalink"class="tsd-anchor-icon"><svgviewBox="0 0 24 24"><usehref="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ulclass="tsd-signatures"><liclass="tsd-signature tsd-anchor-link"><aid="getActiveConfig.getActiveConfig-1"class="tsd-anchor"></a><spanclass="tsd-kind-call-signature">get<wbr/>Active<wbr/>Config</span><spanclass="tsd-signature-symbol">(</span><spanclass="tsd-kind-parameter">device</span><spanclass="tsd-signature-symbol">)</span><spanclass="tsd-signature-symbol">: </span><spanclass="tsd-signature-type">any</span><ahref="#getActiveConfig.getActiveConfig-1"aria-label="Permalink"class="tsd-anchor-icon"><svgviewBox="0 0 24 24"><usehref="../assets/icons.svg#icon-anchor"></use></svg></a></li><liclass="tsd-description"><divclass="tsd-comment tsd-typography"><p>Retrieves the active configuration for the currently chosen device.
It checks if a specific device ID is stored in configurations and returns it.</p>
</div><divclass="tsd-parameters"><h4class="tsd-parameters-title">Parameters</h4><ulclass="tsd-parameter-list"><li><span><spanclass="tsd-kind-parameter">device</span>: <ahref="../enums/enums_devices.Device.html"class="tsd-signature-type tsd-kind-enum">Device</a></span></li></ul></div><h4class="tsd-returns-title">Returns <spanclass="tsd-signature-type">any</span></h4><p>InterfaceConfig The configuration object for the active gamepad, or null if not set.</p>
<divclass="tsd-comment tsd-typography"></div><asideclass="tsd-sources"><ul><li>Defined in <ahref="https://github.com/pagefaultgames/pokerogue/blob/538cb3eb5cd5441773d8d35281339c1d77651ffa/src/inputs-controller.ts#L538">src/inputs-controller.ts:538</a></li></ul></aside></li></ul></section><sectionclass="tsd-panel tsd-member"><aid="getConfig"class="tsd-anchor"></a><h3class="tsd-anchor-link"><span>get<wbr/>Config</span><ahref="#getConfig"aria-label="Permalink"class="tsd-anchor-icon"><svgviewBox="0 0 24 24"><usehref="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ulclass="tsd-signatures"><liclass="tsd-signature tsd-anchor-link"><aid="getConfig.getConfig-1"class="tsd-anchor"></a><spanclass="tsd-kind-call-signature">get<wbr/>Config</span><spanclass="tsd-signature-symbol">(</span><spanclass="tsd-kind-parameter">id</span><spanclass="tsd-signature-symbol">)</span><spanclass="tsd-signature-symbol">: </span><ahref="../interfaces/inputs_controller.InterfaceConfig.html"class="tsd-signature-type tsd-kind-interface">InterfaceConfig</a><ahref="#getConfig.getConfig-1"aria-label="Permalink"class="tsd-anchor-icon"><svgviewBox="0 0 24 24"><usehref="../assets/icons.svg#icon-anchor"></use></svg></a></li><liclass="tsd-description"><divclass="tsd-comment tsd-typography"><p>Retrieves the configuration object for a gamepad based on its identifier. The method identifies specific gamepad models
based on substrings in the identifier and returns predefined configurations for recognized models.
If no specific configuration matches, it defaults to a generic gamepad configuration.</p>
</div><divclass="tsd-parameters"><h4class="tsd-parameters-title">Parameters</h4><ulclass="tsd-parameter-list"><li><span><spanclass="tsd-kind-parameter">id</span>: <spanclass="tsd-signature-type">string</span></span><divclass="tsd-comment tsd-typography"><p>The identifier string of the gamepad.</p>
</div><divclass="tsd-comment tsd-typography"></div></li></ul></div><h4class="tsd-returns-title">Returns <ahref="../interfaces/inputs_controller.InterfaceConfig.html"class="tsd-signature-type tsd-kind-interface">InterfaceConfig</a></h4><p>InterfaceConfig The configuration object corresponding to the identified gamepad type.</p>
<divclass="tsd-comment tsd-typography"></div><asideclass="tsd-sources"><ul><li>Defined in <ahref="https://github.com/pagefaultgames/pokerogue/blob/538cb3eb5cd5441773d8d35281339c1d77651ffa/src/inputs-controller.ts#L492">src/inputs-controller.ts:492</a></li></ul></aside></li></ul></section><sectionclass="tsd-panel tsd-member"><aid="getConfigKeyboard"class="tsd-anchor"></a><h3class="tsd-anchor-link"><span>get<wbr/>Config<wbr/>Keyboard</span><ahref="#getConfigKeyboard"aria-label="Permalink"class="tsd-anchor-icon"><svgviewBox="0 0 24 24"><usehref="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ulclass="tsd-signatures"><liclass="tsd-signature tsd-anchor-link"><aid="getConfigKeyboard.getConfigKeyboard-1"class="tsd-anchor"></a><spanclass="tsd-kind-call-signature">get<wbr/>Config<wbr/>Keyboard</span><spanclass="tsd-signature-symbol">(</span><spanclass="tsd-kind-parameter">id</span><spanclass="tsd-signature-symbol">)</span><spanclass="tsd-signature-symbol">: </span><ahref="../interfaces/inputs_controller.InterfaceConfig.html"class="tsd-signature-type tsd-kind-interface">InterfaceConfig</a><ahref="#getConfigKeyboard.getConfigKeyboard-1"aria-label="Permalink"class="tsd-anchor-icon"><svgviewBox="0 0 24 24"><usehref="../assets/icons.svg#icon-anchor"></use></svg></a></li><liclass="tsd-description"><divclass="tsd-comment tsd-typography"><p>Retrieves the configuration object for a keyboard layout based on its identifier.</p>
</div><divclass="tsd-parameters"><h4class="tsd-parameters-title">Parameters</h4><ulclass="tsd-parameter-list"><li><span><spanclass="tsd-kind-parameter">id</span>: <spanclass="tsd-signature-type">string</span></span><divclass="tsd-comment tsd-typography"><p>The identifier string of the keyboard layout.</p>
</div><divclass="tsd-comment tsd-typography"></div></li></ul></div><h4class="tsd-returns-title">Returns <ahref="../interfaces/inputs_controller.InterfaceConfig.html"class="tsd-signature-type tsd-kind-interface">InterfaceConfig</a></h4><p>InterfaceConfig The configuration object corresponding to the identified keyboard layout.</p>
<divclass="tsd-comment tsd-typography"></div><asideclass="tsd-sources"><ul><li>Defined in <ahref="https://github.com/pagefaultgames/pokerogue/blob/538cb3eb5cd5441773d8d35281339c1d77651ffa/src/inputs-controller.ts#L514">src/inputs-controller.ts:514</a></li></ul></aside></li></ul></section><sectionclass="tsd-panel tsd-member"><aid="getGamepadsName"class="tsd-anchor"></a><h3class="tsd-anchor-link"><span>get<wbr/>Gamepads<wbr/>Name</span><ahref="#getGamepadsName"aria-label="Permalink"class="tsd-anchor-icon"><svgviewBox="0 0 24 24"><usehref="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ulclass="tsd-signatures"><liclass="tsd-signature tsd-anchor-link"><aid="getGamepadsName.getGamepadsName-1"class="tsd-anchor"></a><spanclass="tsd-kind-call-signature">get<wbr/>Gamepads<wbr/>Name</span><spanclass="tsd-signature-symbol">(</span><spanclass="tsd-signature-symbol">)</span><spanclass="tsd-signature-symbol">: </span><spanclass="tsd-signature-type">String</span><spanclass="tsd-signature-symbol">[]</span><ahref="#getGamepadsName.getGamepadsName-1"aria-label="Permalink"class="tsd-anchor-icon"><svgviewBox="0 0 24 24"><usehref="../assets/icons.svg#icon-anchor"></use></svg></a></li><liclass="tsd-description"><divclass="tsd-comment tsd-typography"><p>Retrieves the identifiers of all connected gamepads, excluding any that are currently marked as disconnected.</p>
</div><h4class="tsd-returns-title">Returns <spanclass="tsd-signature-type">String</span><spanclass="tsd-signature-symbol">[]</span></h4><p>Array<String> An array of strings representing the IDs of the connected gamepads.</p>
</div><h4class="tsd-returns-title">Returns <spanclass="tsd-signature-type">void</span></h4><divclass="tsd-comment tsd-typography"><h4>Remarks</h4><p>This method configures event listeners for both gamepad and keyboard inputs.
It handles gamepad connections/disconnections and button press events, and ensures keyboard controls are set up.
Additionally, it manages the game's behavior when it loses focus to prevent unwanted game actions during this state.</p>
</div><asideclass="tsd-sources"><ul><li>Defined in <ahref="https://github.com/pagefaultgames/pokerogue/blob/538cb3eb5cd5441773d8d35281339c1d77651ffa/src/inputs-controller.ts#L149">src/inputs-controller.ts:149</a></li></ul></aside></li></ul></section><sectionclass="tsd-panel tsd-member"><aid="initChosenGamepad"class="tsd-anchor"></a><h3class="tsd-anchor-link"><span>init<wbr/>Chosen<wbr/>Gamepad</span><ahref="#initChosenGamepad"aria-label="Permalink"class="tsd-anchor-icon"><svgviewBox="0 0 24 24"><usehref="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ulclass="tsd-signatures"><liclass="tsd-signature tsd-anchor-link"><aid="initChosenGamepad.initChosenGamepad-1"class="tsd-anchor"></a><spanclass="tsd-kind-call-signature">init<wbr/>Chosen<wbr/>Gamepad</span><spanclass="tsd-signature-symbol">(</span><spanclass="tsd-kind-parameter">gamepadName</span><spanclass="tsd-signature-symbol">?</span><spanclass="tsd-signature-symbol">)</span><spanclass="tsd-signature-symbol">: </span><spanclass="tsd-signature-type">void</span><ahref="#initChosenGamepad.initChosenGamepad-1"aria-label="Permalink"class="tsd-anchor-icon"><svgviewBox="0 0 24 24"><usehref="../assets/icons.svg#icon-anchor"></use></svg></a></li><liclass="tsd-description"><divclass="tsd-comment tsd-typography"><p>Initializes the chosen gamepad by setting its identifier in the local storage and updating the UI to reflect the chosen gamepad.
If a gamepad name is provided, it uses that as the chosen gamepad; otherwise, it defaults to the currently chosen gamepad.</p>
</div><divclass="tsd-parameters"><h4class="tsd-parameters-title">Parameters</h4><ulclass="tsd-parameter-list"><li><span><codeclass="tsd-tag ts-flagOptional">Optional</code><spanclass="tsd-kind-parameter">gamepadName</span>: <spanclass="tsd-signature-type">String</span></span><divclass="tsd-comment tsd-typography"><p>Optional parameter to specify the name of the gamepad to initialize as chosen.</p>
</div><divclass="tsd-comment tsd-typography"></div></li></ul></div><h4class="tsd-returns-title">Returns <spanclass="tsd-signature-type">void</span></h4><divclass="tsd-comment tsd-typography"></div><asideclass="tsd-sources"><ul><li>Defined in <ahref="https://github.com/pagefaultgames/pokerogue/blob/538cb3eb5cd5441773d8d35281339c1d77651ffa/src/inputs-controller.ts#L249">src/inputs-controller.ts:249</a></li></ul></aside></li></ul></section><sectionclass="tsd-panel tsd-member"><aid="initChosenLayoutKeyboard"class="tsd-anchor"></a><h3class="tsd-anchor-link"><span>init<wbr/>Chosen<wbr/>Layout<wbr/>Keyboard</span><ahref="#initChosenLayoutKeyboard"aria-label="Permalink"class="tsd-anchor-icon"><svgviewBox="0 0 24 24"><usehref="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ulclass="tsd-signatures"><liclass="tsd-signature tsd-anchor-link"><aid="initChosenLayoutKeyboard.initChosenLayoutKeyboard-1"class="tsd-anchor"></a><spanclass="tsd-kind-call-signature">init<wbr/>Chosen<wbr/>Layout<wbr/>Keyboard</span><spanclass="tsd-signature-symbol">(</span><spanclass="tsd-kind-parameter">layoutKeyboard</span><spanclass="tsd-signature-symbol">?</span><spanclass="tsd-signature-symbol">)</span><spanclass="tsd-signature-symbol">: </span><spanclass="tsd-signature-type">void</span><ahref="#initChosenLayoutKeyboard.initChosenLayoutKeyboard-1"aria-label="Permalink"class="tsd-anchor-icon"><svgviewBox="0 0 24 24"><usehref="../assets/icons.svg#icon-anchor"></use></svg></a></li><liclass="tsd-description"><divclass="tsd-comment tsd-typography"><p>Initializes the chosen keyboard layout by setting its identifier in the local storage and updating the UI to reflect the chosen layout.
If a layout name is provided, it uses that as the chosen layout; otherwise, it defaults to the currently chosen layout.</p>
</div><divclass="tsd-parameters"><h4class="tsd-parameters-title">Parameters</h4><ulclass="tsd-parameter-list"><li><span><codeclass="tsd-tag ts-flagOptional">Optional</code><spanclass="tsd-kind-parameter">layoutKeyboard</span>: <spanclass="tsd-signature-type">String</span></span><divclass="tsd-comment tsd-typography"><p>Optional parameter to specify the name of the keyboard layout to initialize as chosen.</p>
</div><divclass="tsd-comment tsd-typography"></div></li></ul></div><h4class="tsd-returns-title">Returns <spanclass="tsd-signature-type">void</span></h4><divclass="tsd-comment tsd-typography"></div><asideclass="tsd-sources"><ul><li>Defined in <ahref="https://github.com/pagefaultgames/pokerogue/blob/538cb3eb5cd5441773d8d35281339c1d77651ffa/src/inputs-controller.ts#L262">src/inputs-controller.ts:262</a></li></ul></aside></li></ul></section><sectionclass="tsd-panel tsd-member"><aid="injectConfig"class="tsd-anchor"></a><h3class="tsd-anchor-link"><span>inject<wbr/>Config</span><ahref="#injectConfig"aria-label="Permalink"class="tsd-anchor-icon"><svgviewBox="0 0 24 24"><usehref="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ulclass="tsd-signatures"><liclass="tsd-signature tsd-anchor-link"><aid="injectConfig.injectConfig-1"class="tsd-anchor"></a><spanclass="tsd-kind-call-signature">inject<wbr/>Config</span><spanclass="tsd-signature-symbol">(</span><spanclass="tsd-kind-parameter">selectedDevice</span>, <spanclass="tsd-kind-parameter">mappingConfigs</span><spanclass="tsd-signature-symbol">)</span><spanclass="tsd-signature-symbol">: </span><spanclass="tsd-signature-type">void</span><ahref="#injectConfig.injectConfig-1"aria-label="Permalink"class="tsd-anchor-icon"><svgviewBox="0 0 24 24"><usehref="../assets/icons.svg#icon-anchor"></use></svg></a></li><liclass="tsd-description"><divclass="tsd-comment tsd-typography"><p>Injects a custom mapping configuration into the configuration for a specific gamepad.
If the device does not have an existing configuration, it initializes one first.</p>
</div><divclass="tsd-parameters"><h4class="tsd-parameters-title">Parameters</h4><ulclass="tsd-parameter-list"><li><span><spanclass="tsd-kind-parameter">selectedDevice</span>: <spanclass="tsd-signature-type">string</span></span><divclass="tsd-comment tsd-typography"><p>The identifier of the device to configure.</p>
</div><divclass="tsd-comment tsd-typography"></div></li><li><span><spanclass="tsd-kind-parameter">mappingConfigs</span>: <spanclass="tsd-signature-type">any</span></span><divclass="tsd-comment tsd-typography"><p>The mapping configuration to apply to the device.</p>
</div><divclass="tsd-comment tsd-typography"></div></li></ul></div><h4class="tsd-returns-title">Returns <spanclass="tsd-signature-type">void</span></h4><divclass="tsd-comment tsd-typography"></div><asideclass="tsd-sources"><ul><li>Defined in <ahref="https://github.com/pagefaultgames/pokerogue/blob/538cb3eb5cd5441773d8d35281339c1d77651ffa/src/inputs-controller.ts#L393">src/inputs-controller.ts:393</a></li></ul></aside></li></ul></section><sectionclass="tsd-panel tsd-member"><aid="loseFocus"class="tsd-anchor"></a><h3class="tsd-anchor-link"><span>lose<wbr/>Focus</span><ahref="#loseFocus"aria-label="Permalink"class="tsd-anchor-icon"><svgviewBox="0 0 24 24"><usehref="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ulclass="tsd-signatures"><liclass="tsd-signature tsd-anchor-link"><aid="loseFocus.loseFocus-1"class="tsd-anchor"></a><spanclass="tsd-kind-call-signature">lose<wbr/>Focus</span><spanclass="tsd-signature-symbol">(</span><spanclass="tsd-signature-symbol">)</span><spanclass="tsd-signature-symbol">: </span><spanclass="tsd-signature-type">void</span><ahref="#loseFocus.loseFocus-1"aria-label="Permalink"class="tsd-anchor-icon"><svgviewBox="0 0 24 24"><usehref="../assets/icons.svg#icon-anchor"></use></svg></a></li><liclass="tsd-description"><divclass="tsd-comment tsd-typography"><p>Handles actions to take when the game loses focus, such as deactivating pressed keys.</p>
</div><h4class="tsd-returns-title">Returns <spanclass="tsd-signature-type">void</span></h4><divclass="tsd-comment tsd-typography"><h4>Remarks</h4><p>This method is triggered when the game or the browser tab loses focus. It ensures that any keys pressed are deactivated to prevent stuck keys affecting gameplay when the game is not active.</p>
</div><asideclass="tsd-sources"><ul><li>Defined in <ahref="https://github.com/pagefaultgames/pokerogue/blob/538cb3eb5cd5441773d8d35281339c1d77651ffa/src/inputs-controller.ts#L193">src/inputs-controller.ts:193</a></li></ul></aside></li></ul></section><sectionclass="tsd-panel tsd-member"><aid="onDisconnect"class="tsd-anchor"></a><h3class="tsd-anchor-link"><span>on<wbr/>Disconnect</span><ahref="#onDisconnect"aria-label="Permalink"class="tsd-anchor-icon"><svgviewBox="0 0 24 24"><usehref="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ulclass="tsd-signatures"><liclass="tsd-signature tsd-anchor-link"><aid="onDisconnect.onDisconnect-1"class="tsd-anchor"></a><spanclass="tsd-kind-call-signature">on<wbr/>Disconnect</span><spanclass="tsd-signature-symbol">(</span><spanclass="tsd-kind-parameter">thisGamepad</span><spanclass="tsd-signature-symbol">)</span><spanclass="tsd-signature-symbol">: </span><spanclass="tsd-signature-type">void</span><ahref="#onDisconnect.onDisconnect-1"aria-label="Permalink"class="tsd-anchor-icon"><svgviewBox="0 0 24 24"><usehref="../assets/icons.svg#icon-anchor"></use></svg></a></li><liclass="tsd-description"><divclass="tsd-comment tsd-typography"><p>Handles the disconnection of a gamepad by adding its identifier to a list of disconnected gamepads.
This is necessary because Phaser retains memory of previously connected gamepads, and without tracking
disconnections, it would be impossible to determine the connection status of gamepads. This method ensures
that disconnected gamepads are recognized and can be appropriately hidden in the gamepad selection menu.</p>
</div><divclass="tsd-parameters"><h4class="tsd-parameters-title">Parameters</h4><ulclass="tsd-parameter-list"><li><span><spanclass="tsd-kind-parameter">thisGamepad</span>: <spanclass="tsd-signature-type">Gamepad</span></span><divclass="tsd-comment tsd-typography"><p>The gamepad that has been disconnected.</p>
</div><divclass="tsd-comment tsd-typography"></div></li></ul></div><h4class="tsd-returns-title">Returns <spanclass="tsd-signature-type">void</span></h4><divclass="tsd-comment tsd-typography"></div><asideclass="tsd-sources"><ul><li>Defined in <ahref="https://github.com/pagefaultgames/pokerogue/blob/538cb3eb5cd5441773d8d35281339c1d77651ffa/src/inputs-controller.ts#L278">src/inputs-controller.ts:278</a></li></ul></aside></li></ul></section><sectionclass="tsd-panel tsd-member"><aid="onReconnect"class="tsd-anchor"></a><h3class="tsd-anchor-link"><span>on<wbr/>Reconnect</span><ahref="#onReconnect"aria-label="Permalink"class="tsd-anchor-icon"><svgviewBox="0 0 24 24"><usehref="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ulclass="tsd-signatures"><liclass="tsd-signature tsd-anchor-link"><aid="onReconnect.onReconnect-1"class="tsd-anchor"></a><spanclass="tsd-kind-call-signature">on<wbr/>Reconnect</span><spanclass="tsd-signature-symbol">(</span><spanclass="tsd-kind-parameter">thisGamepad</span><spanclass="tsd-signature-symbol">)</span><spanclass="tsd-signature-symbol">: </span><spanclass="tsd-signature-type">void</span><ahref="#onReconnect.onReconnect-1"aria-label="Permalink"class="tsd-anchor-icon"><svgviewBox="0 0 24 24"><usehref="../assets/icons.svg#icon-anchor"></use></svg></a></li><liclass="tsd-description"><divclass="tsd-comment tsd-typography"><p>Updates the tracking of disconnected gamepads when a gamepad is reconnected.
It removes the reconnected gamepad's identifier from the <code>disconnectedGamepads</code> array,
effectively updating its status to connected.</p>
</div><divclass="tsd-parameters"><h4class="tsd-parameters-title">Parameters</h4><ulclass="tsd-parameter-list"><li><span><spanclass="tsd-kind-parameter">thisGamepad</span>: <spanclass="tsd-signature-type">Gamepad</span></span><divclass="tsd-comment tsd-typography"><p>The gamepad that has been reconnected.</p>
</div><divclass="tsd-comment tsd-typography"></div></li></ul></div><h4class="tsd-returns-title">Returns <spanclass="tsd-signature-type">void</span></h4><divclass="tsd-comment tsd-typography"></div><asideclass="tsd-sources"><ul><li>Defined in <ahref="https://github.com/pagefaultgames/pokerogue/blob/538cb3eb5cd5441773d8d35281339c1d77651ffa/src/inputs-controller.ts#L289">src/inputs-controller.ts:289</a></li></ul></aside></li></ul></section><sectionclass="tsd-panel tsd-member"><aid="refreshGamepads"class="tsd-anchor"></a><h3class="tsd-anchor-link"><span>refresh<wbr/>Gamepads</span><ahref="#refreshGamepads"aria-label="Permalink"class="tsd-anchor-icon"><svgviewBox="0 0 24 24"><usehref="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ulclass="tsd-signatures"><liclass="tsd-signature tsd-anchor-link"><aid="refreshGamepads.refreshGamepads-1"class="tsd-anchor"></a><spanclass="tsd-kind-call-signature">refresh<wbr/>Gamepads</span><spanclass="tsd-signature-symbol">(</span><spanclass="tsd-signature-symbol">)</span><spanclass="tsd-signature-symbol">: </span><spanclass="tsd-signature-type">void</span><ahref="#refreshGamepads.refreshGamepads-1"aria-label="Permalink"class="tsd-anchor-icon"><svgviewBox="0 0 24 24"><usehref="../assets/icons.svg#icon-anchor"></use></svg></a></li><liclass="tsd-description"><divclass="tsd-comment tsd-typography"><p>Refreshes and re-indexes the list of connected gamepads.</p>
</div><h4class="tsd-returns-title">Returns <spanclass="tsd-signature-type">void</span></h4><divclass="tsd-comment tsd-typography"><h4>Remarks</h4><p>This method updates the list of gamepads to exclude any that are undefined.
It corrects the index of each gamepad to account for any previously undefined entries,
ensuring that all gamepads are properly indexed and can be accurately referenced within the game.</p>
This method first deactivates any active key presses and then initializes the gamepad settings.</p>
</div><divclass="tsd-parameters"><h4class="tsd-parameters-title">Parameters</h4><ulclass="tsd-parameter-list"><li><span><spanclass="tsd-kind-parameter">gamepad</span>: <spanclass="tsd-signature-type">String</span></span><divclass="tsd-comment tsd-typography"><p>The identifier of the gamepad to set as chosen.</p>
</div><divclass="tsd-comment tsd-typography"></div></li></ul></div><h4class="tsd-returns-title">Returns <spanclass="tsd-signature-type">void</span></h4><divclass="tsd-comment tsd-typography"></div><asideclass="tsd-sources"><ul><li>Defined in <ahref="https://github.com/pagefaultgames/pokerogue/blob/538cb3eb5cd5441773d8d35281339c1d77651ffa/src/inputs-controller.ts#L221">src/inputs-controller.ts:221</a></li></ul></aside></li></ul></section><sectionclass="tsd-panel tsd-member"><aid="setChosenKeyboardLayout"class="tsd-anchor"></a><h3class="tsd-anchor-link"><span>set<wbr/>Chosen<wbr/>Keyboard<wbr/>Layout</span><ahref="#setChosenKeyboardLayout"aria-label="Permalink"class="tsd-anchor-icon"><svgviewBox="0 0 24 24"><usehref="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ulclass="tsd-signatures"><liclass="tsd-signature tsd-anchor-link"><aid="setChosenKeyboardLayout.setChosenKeyboardLayout-1"class="tsd-anchor"></a><spanclass="tsd-kind-call-signature">set<wbr/>Chosen<wbr/>Keyboard<wbr/>Layout</span><spanclass="tsd-signature-symbol">(</span><spanclass="tsd-kind-parameter">layoutKeyboard</span><spanclass="tsd-signature-symbol">)</span><spanclass="tsd-signature-symbol">: </span><spanclass="tsd-signature-type">void</span><ahref="#setChosenKeyboardLayout.setChosenKeyboardLayout-1"aria-label="Permalink"class="tsd-anchor-icon"><svgviewBox="0 0 24 24"><usehref="../assets/icons.svg#icon-anchor"></use></svg></a></li><liclass="tsd-description"><divclass="tsd-comment tsd-typography"><p>Sets the currently chosen keyboard layout and initializes related settings.</p>
</div><divclass="tsd-parameters"><h4class="tsd-parameters-title">Parameters</h4><ulclass="tsd-parameter-list"><li><span><spanclass="tsd-kind-parameter">layoutKeyboard</span>: <spanclass="tsd-signature-type">String</span></span><divclass="tsd-comment tsd-typography"><p>The identifier of the keyboard layout to set as chosen.</p>
</div><divclass="tsd-parameters"><h4class="tsd-parameters-title">Parameters</h4><ulclass="tsd-parameter-list"><li><span><spanclass="tsd-kind-parameter">value</span>: <spanclass="tsd-signature-type">boolean</span></span><divclass="tsd-comment tsd-typography"><p>A boolean indicating whether gamepad support should be enabled (true) or disabled (false).</p>
</div><divclass="tsd-comment tsd-typography"></div></li></ul></div><h4class="tsd-returns-title">Returns <spanclass="tsd-signature-type">void</span></h4><divclass="tsd-comment tsd-typography"><h4>Remarks</h4><p>This method toggles gamepad support. If disabled, it also ensures that all currently pressed gamepad buttons are deactivated to avoid stuck inputs.</p>
It retrieves the names of all connected gamepads, sets up their configurations according to stored or default settings,
and ensures these configurations are saved. If the connected gamepad is the currently chosen one,
it reinitializes the chosen gamepad settings.</p>
</div><divclass="tsd-parameters"><h4class="tsd-parameters-title">Parameters</h4><ulclass="tsd-parameter-list"><li><span><spanclass="tsd-kind-parameter">thisGamepad</span>: <spanclass="tsd-signature-type">Gamepad</span></span><divclass="tsd-comment tsd-typography"><p>The gamepad that is being set up.</p>