pokerogue/main/classes/inputs_controller.InputsController.html

205 lines
74 KiB
HTML
Raw Normal View History

2024-05-31 14:57:14 +01:00
<!DOCTYPE html><html class="default" lang="en"><head><meta charSet="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>InputsController | pokemon-rogue-battle</title><meta name="description" content="Documentation for pokemon-rogue-battle"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="../assets/style.css"/><link rel="stylesheet" href="../assets/highlight.css"/><script defer src="../assets/main.js"></script><script async src="../assets/icons.js" id="tsd-icons-script"></script><script async src="../assets/search.js" id="tsd-search-script"></script><script async src="../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><header class="tsd-page-toolbar"><div class="tsd-toolbar-contents container"><div class="table-cell" id="tsd-search" data-base=".."><div class="field"><label for="tsd-search-field" class="tsd-widget tsd-toolbar-icon search no-caption"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><use href="../assets/icons.svg#icon-search"></use></svg></label><input type="text" id="tsd-search-field" aria-label="Search"/></div><div class="field"><div id="tsd-toolbar-links"></div></div><ul class="results"><li class="state loading">Preparing search index...</li><li class="state failure">The search index is not available</li></ul><a href="../index.html" class="title">pokemon-rogue-battle</a></div><div class="table-cell" id="tsd-widgets"><a href="#" class="tsd-widget tsd-toolbar-icon menu no-caption" data-toggle="menu" aria-label="Menu"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><use href="../assets/icons.svg#icon-menu"></use></svg></a></div></div></header><div class="container container-main"><div class="col-content"><div class="tsd-page-title"><ul class="tsd-breadcrumb"><li><a href="../index.html">pokemon-rogue-battle</a></li><li><a href="../modules/inputs_controller.html">inputs-controller</a></li><li><a href="inputs_controller.InputsController.html">InputsController</a></li></ul><h1>Class InputsController</h1></div><section class="tsd-panel tsd-comment"><div class="tsd-comment tsd-typography"><p>Manages and handles all input controls for the game, including keyboard and gamepad interactions.</p>
</div><div class="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&#39;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>
2024-05-31 15:32:22 +01:00
</div></section><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/pagefaultgames/pokerogue/blob/6c4b60a2faca4f52fd83808e1bd6c331aa98a2c3/src/inputs-controller.ts#L50">src/inputs-controller.ts:50</a></li></ul></aside><section class="tsd-panel-group tsd-index-group"><section class="tsd-panel tsd-index-panel"><details class="tsd-index-content tsd-index-accordion" open><summary class="tsd-accordion-summary tsd-index-summary"><h5 class="tsd-index-heading uppercase" role="button" aria-expanded="false" tabIndex="0"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><use href="../assets/icons.svg#icon-chevronSmall"></use></svg> Index</h5></summary><div class="tsd-accordion-details"><section class="tsd-index-section"><h3 class="tsd-index-heading">Constructors</h3><div class="tsd-index-list"><a href="inputs_controller.InputsController.html#constructor" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-512"></use></svg><span>constructor</span></a>
2024-05-31 14:57:14 +01:00
</div></section><section class="tsd-index-section"><h3 class="tsd-index-heading">Properties</h3><div class="tsd-index-list"><a href="inputs_controller.InputsController.html#buttonKeys" class="tsd-index-link tsd-is-private"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-1024"></use></svg><span>button<wbr/>Keys</span></a>
<a href="inputs_controller.InputsController.html#buttonLock" class="tsd-index-link tsd-is-private"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-1024"></use></svg><span>button<wbr/>Lock</span></a>
<a href="inputs_controller.InputsController.html#buttonLock2" class="tsd-index-link tsd-is-private"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-1024"></use></svg><span>button<wbr/>Lock2</span></a>
<a href="inputs_controller.InputsController.html#events" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-1024"></use></svg><span>events</span></a>
<a href="inputs_controller.InputsController.html#gamepadSupport" class="tsd-index-link tsd-is-private"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-1024"></use></svg><span>gamepad<wbr/>Support</span></a>
<a href="inputs_controller.InputsController.html#gamepads" class="tsd-index-link tsd-is-private"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-1024"></use></svg><span>gamepads</span></a>
<a href="inputs_controller.InputsController.html#interactions" class="tsd-index-link tsd-is-private"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-1024"></use></svg><span>interactions</span></a>
<a href="inputs_controller.InputsController.html#player" class="tsd-index-link tsd-is-private"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-1024"></use></svg><span>player</span></a>
<a href="inputs_controller.InputsController.html#scene" class="tsd-index-link tsd-is-private"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-1024"></use></svg><span>scene</span></a>
<a href="inputs_controller.InputsController.html#time" class="tsd-index-link tsd-is-private"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-1024"></use></svg><span>time</span></a>
</div></section><section class="tsd-index-section"><h3 class="tsd-index-heading">Methods</h3><div class="tsd-index-list"><a href="inputs_controller.InputsController.html#deactivatePressedKey" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>deactivate<wbr/>Pressed<wbr/>Key</span></a>
<a href="inputs_controller.InputsController.html#delLastProcessedMovementTime" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>del<wbr/>Last<wbr/>Processed<wbr/>Movement<wbr/>Time</span></a>
<a href="inputs_controller.InputsController.html#gamepadButtonDown" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>gamepad<wbr/>Button<wbr/>Down</span></a>
<a href="inputs_controller.InputsController.html#gamepadButtonUp" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>gamepad<wbr/>Button<wbr/>Up</span></a>
<a href="inputs_controller.InputsController.html#getActionGamepadMapping" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>get<wbr/>Action<wbr/>Gamepad<wbr/>Mapping</span></a>
<a href="inputs_controller.InputsController.html#init" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>init</span></a>
<a href="inputs_controller.InputsController.html#isButtonLocked" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>is<wbr/>Button<wbr/>Locked</span></a>
<a href="inputs_controller.InputsController.html#listenInputKeyboard" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>listen<wbr/>Input<wbr/>Keyboard</span></a>
<a href="inputs_controller.InputsController.html#loseFocus" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>lose<wbr/>Focus</span></a>
<a href="inputs_controller.InputsController.html#mapGamepad" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>map<wbr/>Gamepad</span></a>
<a href="inputs_controller.InputsController.html#refreshGamepads" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>refresh<wbr/>Gamepads</span></a>
<a href="inputs_controller.InputsController.html#releaseButtonLock" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>release<wbr/>Button<wbr/>Lock</span></a>
<a href="inputs_controller.InputsController.html#repeatInputDurationJustPassed" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>repeat<wbr/>Input<wbr/>Duration<wbr/>Just<wbr/>Passed</span></a>
<a href="inputs_controller.InputsController.html#setButtonLock" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>set<wbr/>Button<wbr/>Lock</span></a>
<a href="inputs_controller.InputsController.html#setGamepadSupport" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>set<wbr/>Gamepad<wbr/>Support</span></a>
<a href="inputs_controller.InputsController.html#setLastProcessedMovementTime" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>set<wbr/>Last<wbr/>Processed<wbr/>Movement<wbr/>Time</span></a>
<a href="inputs_controller.InputsController.html#setupGamepad" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>setup<wbr/>Gamepad</span></a>
<a href="inputs_controller.InputsController.html#setupKeyboardControls" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>setup<wbr/>Keyboard<wbr/>Controls</span></a>
<a href="inputs_controller.InputsController.html#update" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>update</span></a>
</div></section></div></details></section></section><section class="tsd-panel-group tsd-member-group"><h2>Constructors</h2><section class="tsd-panel tsd-member"><a id="constructor" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>constructor</span><a href="#constructor" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class="tsd-signature tsd-anchor-link"><a id="constructor.new_InputsController" class="tsd-anchor"></a><span class="tsd-kind-constructor-signature">new <wbr/>Inputs<wbr/>Controller</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">scene</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a href="inputs_controller.InputsController.html" class="tsd-signature-type tsd-kind-class">InputsController</a><a href="#constructor.new_InputsController" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-comment tsd-typography"><p>Initializes a new instance of the game control system, setting up initial state and configurations.</p>
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">scene</span>: <a href="battle_scene.default.html" class="tsd-signature-type tsd-kind-class">default</a></span><div class="tsd-comment tsd-typography"><p>The Phaser scene associated with this instance.</p>
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <a href="inputs_controller.InputsController.html" class="tsd-signature-type tsd-kind-class">InputsController</a></h4><div class="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>
2024-05-31 15:32:22 +01:00
</div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/pagefaultgames/pokerogue/blob/6c4b60a2faca4f52fd83808e1bd6c331aa98a2c3/src/inputs-controller.ts#L75">src/inputs-controller.ts:75</a></li></ul></aside></li></ul></section></section><section class="tsd-panel-group tsd-member-group"><h2>Properties</h2><section class="tsd-panel tsd-member tsd-is-private"><a id="buttonKeys" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><code class="tsd-tag ts-flagPrivate">Private</code> <span>button<wbr/>Keys</span><a href="#buttonKeys" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><div class="tsd-signature"><span class="tsd-kind-property">button<wbr/>Keys</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Key</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">[]</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/pagefaultgames/pokerogue/blob/6c4b60a2faca4f52fd83808e1bd6c331aa98a2c3/src/inputs-controller.ts#L51">src/inputs-controller.ts:51</a></li></ul></aside></section><section class="tsd-panel tsd-member tsd-is-private"><a id="buttonLock" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><code class="tsd-tag ts-flagPrivate">Private</code> <span>button<wbr/>Lock</span><a href="#buttonLock" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><div class="tsd-signature"><span class="tsd-kind-property">button<wbr/>Lock</span><span class="tsd-signature-symbol">:</span> <a href="../enums/enums_buttons.Button.html" class="tsd-signature-type tsd-kind-enum">Button</a></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/pagefaultgames/pokerogue/blob/6c4b60a2faca4f52fd83808e1bd6c331aa98a2c3/src/inputs-controller.ts#L55">src/inputs-controller.ts:55</a></li></ul></aside></section><section class="tsd-panel tsd-member tsd-is-private"><a id="buttonLock2" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><code class="tsd-tag ts-flagPrivate">Private</code> <span>button<wbr/>Lock2</span><a href="#buttonLock2" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><div class="tsd-signature"><span class="tsd-kind-property">button<wbr/>Lock2</span><span class="tsd-signature-symbol">:</span> <a href="../enums/enums_buttons.Button.html" class="tsd-signature-type tsd-kind-enum">Button</a></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/pagefaultgames/pokerogue/blob/6c4b60a2faca4f52fd83808e1bd6c331aa98a2c3/src/inputs-controller.ts#L56">src/inputs-controller.ts:56</a></li></ul></aside></section><section class="tsd-panel tsd-member"><a id="events" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>events</span><a href="#events" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><div class="tsd-signature"><span class="tsd-kind-property">events</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">EventEmitter</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/pagefaultgames/pokerogue/blob/6c4b60a2faca4f52fd83808e1bd6c331aa98a2c3/src/inputs-controller.ts#L62">src/inputs-controller.ts:62</a></li></ul></aside></section><section class="tsd-panel tsd-member tsd-is-private"><a id="gamepadSupport" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><code class="tsd-tag ts-flagPrivate">Private</code> <span>gamepad<wbr/>Support</span><a href="#gamepadSupport" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><div class="tsd-signature"><span class="tsd-kind-property">gamepad<wbr/>Support</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">boolean</span><span class="t
2024-05-31 14:57:14 +01:00
</div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4><div class="tsd-comment tsd-typography"><h4>Remarks</h4><p>This method is used to reset the state of all buttons within the <code>interactions</code> dictionary,
effectively deactivating any currently pressed keys. It performs the following actions:</p>
<ul>
<li>Releases button locks for predefined buttons (<code>buttonLock</code> and <code>buttonLock2</code>), allowing them
to be pressed again or properly re-initialized in future interactions.</li>
<li>Iterates over all possible button values obtained via <code>Utils.getEnumValues(Button)</code>, and for
each button:<ul>
<li>Checks if the button is currently registered in the <code>interactions</code> dictionary.</li>
<li>Resets <code>pressTime</code> to null, indicating that there is no ongoing interaction.</li>
<li>Sets <code>isPressed</code> to false, marking the button as not currently active.</li>
<li>Clears the <code>source</code> field, removing the record of which device the button press came from.</li>
</ul>
</li>
</ul>
<p>This method is typically called when needing to ensure that all inputs are neutralized.</p>
2024-05-31 15:32:22 +01:00
</div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/pagefaultgames/pokerogue/blob/6c4b60a2faca4f52fd83808e1bd6c331aa98a2c3/src/inputs-controller.ts#L526">src/inputs-controller.ts:526</a></li></ul></aside></li></ul></section><section class="tsd-panel tsd-member"><a id="delLastProcessedMovementTime" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>del<wbr/>Last<wbr/>Processed<wbr/>Movement<wbr/>Time</span><a href="#delLastProcessedMovementTime" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class="tsd-signature tsd-anchor-link"><a id="delLastProcessedMovementTime.delLastProcessedMovementTime-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">del<wbr/>Last<wbr/>Processed<wbr/>Movement<wbr/>Time</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">button</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span><a href="#delLastProcessedMovementTime.delLastProcessedMovementTime-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-comment tsd-typography"><p>Clears the last interaction for a specified button.</p>
2024-05-31 14:57:14 +01:00
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">button</span>: <a href="../enums/enums_buttons.Button.html" class="tsd-signature-type tsd-kind-enum">Button</a></span><div class="tsd-comment tsd-typography"><p>The button for which to clear the interaction.</p>
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4><div class="tsd-comment tsd-typography"><h4>Remarks</h4><p>This method resets the interaction details of the button, allowing it to be processed as a new input when pressed again.
If the button is not registered in the <code>interactions</code> dictionary, this method returns immediately, otherwise:</p>
<ul>
<li><code>pressTime</code> is cleared. This was previously storing the timestamp of when the button was initially pressed.</li>
<li><code>isPressed</code> is set to false, indicating that the button is no longer being pressed.</li>
<li><code>source</code> is set to null, which had been indicating the device from which the button input was originating.</li>
</ul>
<p>It releases the button lock, which prevents the button from being processed repeatedly until it&#39;s explicitly released.</p>
2024-05-31 15:32:22 +01:00
</div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/pagefaultgames/pokerogue/blob/6c4b60a2faca4f52fd83808e1bd6c331aa98a2c3/src/inputs-controller.ts#L498">src/inputs-controller.ts:498</a></li></ul></aside></li></ul></section><section class="tsd-panel tsd-member"><a id="gamepadButtonDown" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>gamepad<wbr/>Button<wbr/>Down</span><a href="#gamepadButtonDown" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class="tsd-signature tsd-anchor-link"><a id="gamepadButtonDown.gamepadButtonDown-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">gamepad<wbr/>Button<wbr/>Down</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">pad</span>, <span class="tsd-kind-parameter">button</span>, <span class="tsd-kind-parameter">value</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span><a href="#gamepadButtonDown.gamepadButtonDown-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-comment tsd-typography"><p>Handles the &#39;down&#39; event for gamepad buttons, emitting appropriate events and updating the interaction state.</p>
2024-05-31 14:57:14 +01:00
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">pad</span>: <span class="tsd-signature-type">Gamepad</span></span><div class="tsd-comment tsd-typography"><p>The gamepad on which the button press occurred.</p>
</div><div class="tsd-comment tsd-typography"></div></li><li><span><span class="tsd-kind-parameter">button</span>: <span class="tsd-signature-type">Button</span></span><div class="tsd-comment tsd-typography"><p>The button that was pressed.</p>
</div><div class="tsd-comment tsd-typography"></div></li><li><span><span class="tsd-kind-parameter">value</span>: <span class="tsd-signature-type">number</span></span><div class="tsd-comment tsd-typography"><p>The value associated with the button press, typically indicating pressure or degree of activation.</p>
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4><div class="tsd-comment tsd-typography"><h4>Remarks</h4><p>This method is triggered when a gamepad button is pressed. If gamepad support is enabled, it:</p>
<ul>
<li>Retrieves the current gamepad action mapping.</li>
<li>Checks if the pressed button is mapped to a game action.</li>
<li>If mapped, emits an &#39;input_down&#39; event with the controller type and button action, and updates the interaction of this button.</li>
</ul>
2024-05-31 15:32:22 +01:00
</div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/pagefaultgames/pokerogue/blob/6c4b60a2faca4f52fd83808e1bd6c331aa98a2c3/src/inputs-controller.ts#L278">src/inputs-controller.ts:278</a></li></ul></aside></li></ul></section><section class="tsd-panel tsd-member"><a id="gamepadButtonUp" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>gamepad<wbr/>Button<wbr/>Up</span><a href="#gamepadButtonUp" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class="tsd-signature tsd-anchor-link"><a id="gamepadButtonUp.gamepadButtonUp-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">gamepad<wbr/>Button<wbr/>Up</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">pad</span>, <span class="tsd-kind-parameter">button</span>, <span class="tsd-kind-parameter">value</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span><a href="#gamepadButtonUp.gamepadButtonUp-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-comment tsd-typography"><p>Handles the &#39;up&#39; event for gamepad buttons, emitting appropriate events and clearing the interaction state.</p>
2024-05-31 14:57:14 +01:00
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">pad</span>: <span class="tsd-signature-type">Gamepad</span></span><div class="tsd-comment tsd-typography"><p>The gamepad on which the button release occurred.</p>
</div><div class="tsd-comment tsd-typography"></div></li><li><span><span class="tsd-kind-parameter">button</span>: <span class="tsd-signature-type">Button</span></span><div class="tsd-comment tsd-typography"><p>The button that was released.</p>
</div><div class="tsd-comment tsd-typography"></div></li><li><span><span class="tsd-kind-parameter">value</span>: <span class="tsd-signature-type">number</span></span><div class="tsd-comment tsd-typography"><p>The value associated with the button release, typically indicating pressure or degree of deactivation.</p>
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4><div class="tsd-comment tsd-typography"><h4>Remarks</h4><p>This method is triggered when a gamepad button is released. If gamepad support is enabled, it:</p>
<ul>
<li>Retrieves the current gamepad action mapping.</li>
<li>Checks if the released button is mapped to a game action.</li>
<li>If mapped, emits an &#39;input_up&#39; event with the controller type and button action, and clears the interaction for this button.</li>
</ul>
2024-05-31 15:32:22 +01:00
</div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/pagefaultgames/pokerogue/blob/6c4b60a2faca4f52fd83808e1bd6c331aa98a2c3/src/inputs-controller.ts#L306">src/inputs-controller.ts:306</a></li></ul></aside></li></ul></section><section class="tsd-panel tsd-member"><a id="getActionGamepadMapping" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>get<wbr/>Action<wbr/>Gamepad<wbr/>Mapping</span><a href="#getActionGamepadMapping" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class="tsd-signature tsd-anchor-link"><a id="getActionGamepadMapping.getActionGamepadMapping-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">get<wbr/>Action<wbr/>Gamepad<wbr/>Mapping</span><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a href="../interfaces/inputs_controller.ActionGamepadMapping.html" class="tsd-signature-type tsd-kind-interface">ActionGamepadMapping</a><a href="#getActionGamepadMapping.getActionGamepadMapping-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-comment tsd-typography"><p>Retrieves the current gamepad mapping for in-game actions.</p>
2024-05-31 14:57:14 +01:00
</div><h4 class="tsd-returns-title">Returns <a href="../interfaces/inputs_controller.ActionGamepadMapping.html" class="tsd-signature-type tsd-kind-interface">ActionGamepadMapping</a></h4><p>An object mapping gamepad buttons to in-game actions based on the player&#39;s current gamepad configuration.</p>
<div class="tsd-comment tsd-typography"><h4>Remarks</h4><p>This method constructs a mapping of gamepad buttons to in-game action buttons according to the player&#39;s
current gamepad configuration. If no configuration is available, it returns an empty mapping.
The mapping includes directional controls, action buttons, and system commands among others,
adjusted for any custom settings such as swapped action buttons.</p>
2024-05-31 15:32:22 +01:00
</div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/pagefaultgames/pokerogue/blob/6c4b60a2faca4f52fd83808e1bd6c331aa98a2c3/src/inputs-controller.ts#L239">src/inputs-controller.ts:239</a></li></ul></aside></li></ul></section><section class="tsd-panel tsd-member"><a id="init" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>init</span><a href="#init" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class="tsd-signature tsd-anchor-link"><a id="init.init-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">init</span><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span><a href="#init.init-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-comment tsd-typography"><p>Sets up event handlers and initializes gamepad and keyboard controls.</p>
2024-05-31 14:57:14 +01:00
</div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4><div class="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&#39;s behavior when it loses focus to prevent unwanted game actions during this state.</p>
2024-05-31 15:32:22 +01:00
</div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/pagefaultgames/pokerogue/blob/6c4b60a2faca4f52fd83808e1bd6c331aa98a2c3/src/inputs-controller.ts#L101">src/inputs-controller.ts:101</a></li></ul></aside></li></ul></section><section class="tsd-panel tsd-member"><a id="isButtonLocked" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>is<wbr/>Button<wbr/>Locked</span><a href="#isButtonLocked" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class="tsd-signature tsd-anchor-link"><a id="isButtonLocked.isButtonLocked-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">is<wbr/>Button<wbr/>Locked</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">button</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">boolean</span><a href="#isButtonLocked.isButtonLocked-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-comment tsd-typography"><p>Checks if a specific button is currently locked.</p>
2024-05-31 14:57:14 +01:00
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">button</span>: <a href="../enums/enums_buttons.Button.html" class="tsd-signature-type tsd-kind-enum">Button</a></span><div class="tsd-comment tsd-typography"><p>The button to check for a lock status.</p>
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">boolean</span></h4><p><code>true</code> if the button is either of the two potentially locked buttons (<code>buttonLock</code> or <code>buttonLock2</code>), otherwise <code>false</code>.</p>
<div class="tsd-comment tsd-typography"><h4>Remarks</h4><p>This method is used to determine if a given button is currently prevented from being processed due to a lock.
It checks against two separate lock variables, allowing for up to two buttons to be locked simultaneously.</p>
2024-05-31 15:32:22 +01:00
</div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/pagefaultgames/pokerogue/blob/6c4b60a2faca4f52fd83808e1bd6c331aa98a2c3/src/inputs-controller.ts#L548">src/inputs-controller.ts:548</a></li></ul></aside></li></ul></section><section class="tsd-panel tsd-member"><a id="listenInputKeyboard" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>listen<wbr/>Input<wbr/>Keyboard</span><a href="#listenInputKeyboard" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class="tsd-signature tsd-anchor-link"><a id="listenInputKeyboard.listenInputKeyboard-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">listen<wbr/>Input<wbr/>Keyboard</span><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span><a href="#listenInputKeyboard.listenInputKeyboard-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-comment tsd-typography"><p>Sets up event listeners for keyboard inputs on all registered keys.</p>
2024-05-31 14:57:14 +01:00
</div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4><div class="tsd-comment tsd-typography"><h4>Remarks</h4><p>This method iterates over an array of keyboard button rows (<code>this.buttonKeys</code>), adding &#39;down&#39; and &#39;up&#39;
event listeners for each key. These listeners handle key press and release actions respectively.</p>
<ul>
<li><p><strong>Key Down Event</strong>: When a key is pressed down, the method emits an &#39;input_down&#39; event with the button
and the source (&#39;keyboard&#39;). It also records the time and state of the key press by calling
<code>setLastProcessedMovementTime</code>.</p>
</li>
<li><p><strong>Key Up Event</strong>: When a key is released, the method emits an &#39;input_up&#39; event similarly, specifying the button
and source. It then clears the recorded press time and state by calling
<code>delLastProcessedMovementTime</code>.</p>
</li>
</ul>
<p>This setup ensures that each key on the keyboard is monitored for press and release events,
and that these events are properly communicated within the system.</p>
2024-05-31 15:32:22 +01:00
</div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/pagefaultgames/pokerogue/blob/6c4b60a2faca4f52fd83808e1bd6c331aa98a2c3/src/inputs-controller.ts#L394">src/inputs-controller.ts:394</a></li></ul></aside></li></ul></section><section class="tsd-panel tsd-member"><a id="loseFocus" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>lose<wbr/>Focus</span><a href="#loseFocus" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class="tsd-signature tsd-anchor-link"><a id="loseFocus.loseFocus-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">lose<wbr/>Focus</span><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span><a href="#loseFocus.loseFocus-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-comment tsd-typography"><p>Handles actions to take when the game loses focus, such as deactivating pressed keys.</p>
2024-05-31 14:57:14 +01:00
</div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4><div class="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>
2024-05-31 15:32:22 +01:00
</div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/pagefaultgames/pokerogue/blob/6c4b60a2faca4f52fd83808e1bd6c331aa98a2c3/src/inputs-controller.ts#L135">src/inputs-controller.ts:135</a></li></ul></aside></li></ul></section><section class="tsd-panel tsd-member"><a id="mapGamepad" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>map<wbr/>Gamepad</span><a href="#mapGamepad" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class="tsd-signature tsd-anchor-link"><a id="mapGamepad.mapGamepad-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">map<wbr/>Gamepad</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">id</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a href="../interfaces/inputs_controller.GamepadConfig.html" class="tsd-signature-type tsd-kind-interface">GamepadConfig</a><a href="#mapGamepad.mapGamepad-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-comment tsd-typography"><p>Maps a gamepad ID to a specific gamepad configuration based on the ID&#39;s characteristics.</p>
2024-05-31 14:57:14 +01:00
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">id</span>: <span class="tsd-signature-type">string</span></span><div class="tsd-comment tsd-typography"><p>The gamepad ID string, typically representing a unique identifier for a gamepad model or make.</p>
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <a href="../interfaces/inputs_controller.GamepadConfig.html" class="tsd-signature-type tsd-kind-interface">GamepadConfig</a></h4><p>A <code>GamepadConfig</code> object corresponding to the identified gamepad model.</p>
<div class="tsd-comment tsd-typography"><h4>Remarks</h4><p>This function analyzes the provided gamepad ID and matches it to a predefined configuration based on known identifiers:</p>
<ul>
<li>If the ID includes both &#39;081f&#39; and &#39;e401&#39;, it is identified as an unlicensed SNES gamepad.</li>
<li>If the ID contains &#39;xbox&#39; and &#39;360&#39;, it is identified as an Xbox 360 gamepad.</li>
<li>If the ID contains &#39;054c&#39;, it is identified as a DualShock gamepad.</li>
<li>If the ID includes both &#39;057e&#39; and &#39;2009&#39;, it is identified as a Pro controller gamepad.
If no specific identifiers are recognized, a generic gamepad configuration is returned.</li>
</ul>
2024-05-31 15:32:22 +01:00
</div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/pagefaultgames/pokerogue/blob/6c4b60a2faca4f52fd83808e1bd6c331aa98a2c3/src/inputs-controller.ts#L429">src/inputs-controller.ts:429</a></li></ul></aside></li></ul></section><section class="tsd-panel tsd-member"><a id="refreshGamepads" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>refresh<wbr/>Gamepads</span><a href="#refreshGamepads" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class="tsd-signature tsd-anchor-link"><a id="refreshGamepads.refreshGamepads-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">refresh<wbr/>Gamepads</span><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span><a href="#refreshGamepads.refreshGamepads-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-comment tsd-typography"><p>Refreshes and re-indexes the list of connected gamepads.</p>
2024-05-31 14:57:14 +01:00
</div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4><div class="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>
2024-05-31 15:32:22 +01:00
</div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/pagefaultgames/pokerogue/blob/6c4b60a2faca4f52fd83808e1bd6c331aa98a2c3/src/inputs-controller.ts#L217">src/inputs-controller.ts:217</a></li></ul></aside></li></ul></section><section class="tsd-panel tsd-member"><a id="releaseButtonLock" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>release<wbr/>Button<wbr/>Lock</span><a href="#releaseButtonLock" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class="tsd-signature tsd-anchor-link"><a id="releaseButtonLock.releaseButtonLock-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">release<wbr/>Button<wbr/>Lock</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">button</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span><a href="#releaseButtonLock.releaseButtonLock-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-comment tsd-typography"><p>Releases a lock on a specific button, allowing it to be processed again.</p>
2024-05-31 14:57:14 +01:00
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">button</span>: <a href="../enums/enums_buttons.Button.html" class="tsd-signature-type tsd-kind-enum">Button</a></span><div class="tsd-comment tsd-typography"><p>The button whose lock is to be released.</p>
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4><div class="tsd-comment tsd-typography"><h4>Remarks</h4><p>This method checks both lock variables (<code>buttonLock</code> and <code>buttonLock2</code>).
If either lock matches the specified button, that lock is cleared.
This action frees the button to be processed again, ensuring it can respond to new inputs.</p>
2024-05-31 15:32:22 +01:00
</div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/pagefaultgames/pokerogue/blob/6c4b60a2faca4f52fd83808e1bd6c331aa98a2c3/src/inputs-controller.ts#L588">src/inputs-controller.ts:588</a></li></ul></aside></li></ul></section><section class="tsd-panel tsd-member"><a id="repeatInputDurationJustPassed" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>repeat<wbr/>Input<wbr/>Duration<wbr/>Just<wbr/>Passed</span><a href="#repeatInputDurationJustPassed" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class="tsd-signature tsd-anchor-link"><a id="repeatInputDurationJustPassed.repeatInputDurationJustPassed-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">repeat<wbr/>Input<wbr/>Duration<wbr/>Just<wbr/>Passed</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">button</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">boolean</span><a href="#repeatInputDurationJustPassed.repeatInputDurationJustPassed-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-comment tsd-typography"><p>repeatInputDurationJustPassed returns true if</p>
2024-05-31 14:57:14 +01:00
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">button</span>: <a href="../enums/enums_buttons.Button.html" class="tsd-signature-type tsd-kind-enum">Button</a></span><div class="tsd-comment tsd-typography"><p>has been held down long
enough to fire a repeated input. A button must claim the buttonLock before
firing a repeated input - this is to prevent multiple buttons from firing repeatedly.</p>
2024-05-31 15:32:22 +01:00
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">boolean</span></h4><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/pagefaultgames/pokerogue/blob/6c4b60a2faca4f52fd83808e1bd6c331aa98a2c3/src/inputs-controller.ts#L450">src/inputs-controller.ts:450</a></li></ul></aside></li></ul></section><section class="tsd-panel tsd-member"><a id="setButtonLock" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>set<wbr/>Button<wbr/>Lock</span><a href="#setButtonLock" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class="tsd-signature tsd-anchor-link"><a id="setButtonLock.setButtonLock-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">set<wbr/>Button<wbr/>Lock</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">button</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span><a href="#setButtonLock.setButtonLock-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-comment tsd-typography"><p>Sets a lock on a given button if it is not already locked.</p>
2024-05-31 14:57:14 +01:00
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">button</span>: <a href="../enums/enums_buttons.Button.html" class="tsd-signature-type tsd-kind-enum">Button</a></span><div class="tsd-comment tsd-typography"><p>The button to lock.</p>
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4><div class="tsd-comment tsd-typography"><h4>Remarks</h4><p>This method ensures that a button is not processed multiple times inadvertently.
It checks if the button is already locked by either of the two lock variables (<code>buttonLock</code> or <code>buttonLock2</code>).
If not, it locks the button using the first available lock variable.
This mechanism allows for up to two buttons to be locked at the same time.</p>
2024-05-31 15:32:22 +01:00
</div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/pagefaultgames/pokerogue/blob/6c4b60a2faca4f52fd83808e1bd6c331aa98a2c3/src/inputs-controller.ts#L563">src/inputs-controller.ts:563</a></li></ul></aside></li></ul></section><section class="tsd-panel tsd-member"><a id="setGamepadSupport" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>set<wbr/>Gamepad<wbr/>Support</span><a href="#setGamepadSupport" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class="tsd-signature tsd-anchor-link"><a id="setGamepadSupport.setGamepadSupport-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">set<wbr/>Gamepad<wbr/>Support</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">value</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span><a href="#setGamepadSupport.setGamepadSupport-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-comment tsd-typography"><p>Enables or disables support for gamepad input.</p>
2024-05-31 14:57:14 +01:00
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">value</span>: <span class="tsd-signature-type">boolean</span></span><div class="tsd-comment tsd-typography"><p>A boolean indicating whether gamepad support should be enabled (true) or disabled (false).</p>
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4><div class="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>
2024-05-31 15:32:22 +01:00
</div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/pagefaultgames/pokerogue/blob/6c4b60a2faca4f52fd83808e1bd6c331aa98a2c3/src/inputs-controller.ts#L147">src/inputs-controller.ts:147</a></li></ul></aside></li></ul></section><section class="tsd-panel tsd-member"><a id="setLastProcessedMovementTime" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>set<wbr/>Last<wbr/>Processed<wbr/>Movement<wbr/>Time</span><a href="#setLastProcessedMovementTime" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class="tsd-signature tsd-anchor-link"><a id="setLastProcessedMovementTime.setLastProcessedMovementTime-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">set<wbr/>Last<wbr/>Processed<wbr/>Movement<wbr/>Time</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">button</span>, <span class="tsd-kind-parameter">source</span><span class="tsd-signature-symbol">?</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span><a href="#setLastProcessedMovementTime.setLastProcessedMovementTime-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-comment tsd-typography"><p>This method updates the interaction state to reflect that the button is pressed.</p>
2024-05-31 14:57:14 +01:00
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">button</span>: <a href="../enums/enums_buttons.Button.html" class="tsd-signature-type tsd-kind-enum">Button</a></span><div class="tsd-comment tsd-typography"><p>The button for which to set the interaction.</p>
</div><div class="tsd-comment tsd-typography"></div></li><li><span><span class="tsd-kind-parameter">source</span>: <span class="tsd-signature-type">String</span><span class="tsd-signature-symbol"> = &quot;keyboard&quot;</span></span><div class="tsd-comment tsd-typography"><p>The source of the input (defaults to &#39;keyboard&#39;). This helps identify the origin of the input, especially useful in environments with multiple input devices.</p>
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4><div class="tsd-comment tsd-typography"><h4>Remarks</h4><p>This method is responsible for updating the interaction state of a button within the <code>interactions</code> dictionary. If the button is not already registered, this method returns immediately.
When invoked, it performs the following updates:</p>
<ul>
<li><code>pressTime</code>: Sets this to the current time, representing when the button was initially pressed.</li>
<li><code>isPressed</code>: Marks the button as currently being pressed.</li>
<li><code>source</code>: Identifies the source device of the input, which can vary across different hardware (e.g., keyboard, gamepad).</li>
</ul>
<p>Additionally, this method locks the button (by calling <code>setButtonLock</code>) to prevent it from being re-processed until it is released, ensuring that each press is handled distinctly.</p>
2024-05-31 15:32:22 +01:00
</div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/pagefaultgames/pokerogue/blob/6c4b60a2faca4f52fd83808e1bd6c331aa98a2c3/src/inputs-controller.ts#L474">src/inputs-controller.ts:474</a></li></ul></aside></li></ul></section><section class="tsd-panel tsd-member"><a id="setupGamepad" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>setup<wbr/>Gamepad</span><a href="#setupGamepad" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class="tsd-signature tsd-anchor-link"><a id="setupGamepad.setupGamepad-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">setup<wbr/>Gamepad</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">thisGamepad</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span><a href="#setupGamepad.setupGamepad-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-comment tsd-typography"><p>Configures a gamepad for use based on its device ID.</p>
2024-05-31 14:57:14 +01:00
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">thisGamepad</span>: <span class="tsd-signature-type">Gamepad</span></span><div class="tsd-comment tsd-typography"><p>The gamepad to set up.</p>
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4><div class="tsd-comment tsd-typography"><h4>Remarks</h4><p>This method initializes a gamepad by mapping its ID to a predefined configuration.
It updates the player&#39;s gamepad mapping based on the identified configuration, ensuring
that the gamepad controls are correctly mapped to in-game actions.</p>
2024-05-31 15:32:22 +01:00
</div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/pagefaultgames/pokerogue/blob/6c4b60a2faca4f52fd83808e1bd6c331aa98a2c3/src/inputs-controller.ts#L203">src/inputs-controller.ts:203</a></li></ul></aside></li></ul></section><section class="tsd-panel tsd-member"><a id="setupKeyboardControls" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>setup<wbr/>Keyboard<wbr/>Controls</span><a href="#setupKeyboardControls" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class="tsd-signature tsd-anchor-link"><a id="setupKeyboardControls.setupKeyboardControls-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">setup<wbr/>Keyboard<wbr/>Controls</span><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span><a href="#setupKeyboardControls.setupKeyboardControls-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-comment tsd-typography"><p>Configures keyboard controls for the game, mapping physical keys to game actions.</p>
2024-05-31 14:57:14 +01:00
</div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4><div class="tsd-comment tsd-typography"><h4>Remarks</h4><p>This method sets up keyboard bindings for game controls using Phaser&#39;s <code>KeyCodes</code>. Each game action, represented
by a button in the <code>Button</code> enum, is associated with one or more physical keys. For example, movement actions
(up, down, left, right) are mapped to both arrow keys and WASD keys. Actions such as submit, cancel, and other
game-specific functions are mapped to appropriate keys like Enter, Space, etc.</p>
<p>The method does the following:</p>
<ul>
<li>Defines a <code>keyConfig</code> object that associates each <code>Button</code> enum value with an array of <code>KeyCodes</code>.</li>
<li>Iterates over all values of the <code>Button</code> enum to set up these key bindings within the Phaser game scene.</li>
<li>For each button, it adds the respective keys to the game&#39;s input system and stores them in <code>this.buttonKeys</code>.</li>
<li>Additional configurations for mobile or alternative input schemes are stored in <code>mobileKeyConfig</code>.</li>
</ul>
<p>Post-setup, it initializes touch controls (if applicable) and starts listening for keyboard inputs using
<code>listenInputKeyboard</code>, ensuring that all configured keys are actively monitored for player interactions.</p>
2024-05-31 15:32:22 +01:00
</div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/pagefaultgames/pokerogue/blob/6c4b60a2faca4f52fd83808e1bd6c331aa98a2c3/src/inputs-controller.ts#L339">src/inputs-controller.ts:339</a></li></ul></aside></li></ul></section><section class="tsd-panel tsd-member"><a id="update" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>update</span><a href="#update" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class="tsd-signature tsd-anchor-link"><a id="update.update-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">update</span><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span><a href="#update.update-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-comment tsd-typography"><p>Updates the interaction handling by processing input states.
2024-05-31 14:57:14 +01:00
This method gives priority to certain buttons by reversing the order in which they are checked.</p>
</div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4><div class="tsd-comment tsd-typography"><h4>Remarks</h4><p>The method iterates over all possible buttons, checking for specific conditions such as:</p>
<ul>
<li>If the button is registered in the <code>interactions</code> dictionary.</li>
<li>If the button has been held down long enough.</li>
<li>If the button is currently pressed.</li>
</ul>
<p>Special handling is applied if gamepad support is disabled but a gamepad source is still triggering inputs,
preventing potential infinite loops by removing the last processed movement time for the button.</p>
2024-05-31 15:32:22 +01:00
</div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/pagefaultgames/pokerogue/blob/6c4b60a2faca4f52fd83808e1bd6c331aa98a2c3/src/inputs-controller.ts#L170">src/inputs-controller.ts:170</a></li></ul></aside></li></ul></section></section></div><div class="col-sidebar"><div class="page-menu"><div class="tsd-navigation settings"><details class="tsd-index-accordion"><summary class="tsd-accordion-summary"><h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Settings</h3></summary><div class="tsd-accordion-details"><div class="tsd-filter-visibility"><h4 class="uppercase">Member Visibility</h4><form><ul id="tsd-filter-options"><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-protected" name="protected"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Protected</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-private" name="private"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Private</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-inherited" name="inherited" checked/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Inherited</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-external" name="external"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>External</span></label></li></ul></form></div><div class="tsd-theme-toggle"><h4 class="uppercase">Theme</h4><select id="tsd-theme"><option value="os">OS</option><option value="light">Light</option><option value="dark">Dark</option></select></div></div></details></div><details open class="tsd-index-accordion tsd-page-navigation"><summary class="tsd-accordion-summary"><h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>On This Page</h3></summary><div class="tsd-accordion-details"><a href="#constructor" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-512"></use></svg><span>constructor</span></a><a href="#buttonKeys" class="tsd-is-private"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-1024"></use></svg><span>button<wbr/>Keys</span></a><a href="#buttonLock" class="tsd-is-private"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-1024"></use></svg><span>button<wbr/>Lock</span></a><a href="#buttonLock2" class="tsd-is-private"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-1024"></use></svg><span>button<wbr/>Lock2</span></a><a href="#events" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-1024"></use></svg><span>events</span></a><a href="