Constructor
new MicrogameGamepad(gamepad)
Parameters:
Name | Type | Description |
---|---|---|
gamepad |
Gamepad | A gamepad from the Gamepad API |
- Source:
Extends
Members
baseBindings
Bindings to allow input for no matter what.
- Overrides:
- Source:
bindings
Binding of Gamepad API specific controls to key codes.
- Overrides:
- Source:
(private) currBinding
The current set of bindings we’re using from this.bindings. Set in module:input~MicrogameInput#gameInputStartUpdate based on the current game being played.
- Overrides:
- Source:
(private) gamepad
Reference to the gamepad from the Gamepad API
- Source:
(private) inputMatch
Regex to match input values.
- Default Value:
- /(-)?(axes|buttons)(\d)+/
- Source:
(private) sensitivity
How much input do we want to recieve from a gamepad before we translate it into output?
- Source:
(private) stateTracker
What keys/controls are currently being used. Used in module:input~MicrogameInput#update exclusively.
- Overrides:
- Source:
Methods
gameStartInputUpdate(game)
Resets module:input~MicrogameInput#stateTracker and module:input~MicrogameInput#currBinding based on game. If the game’s bindings exist in MicrogameInput.baseBindings, use those. Otherwise, use “all”.
Parameters:
Name | Type | Description |
---|---|---|
game |
string | Current game being played. |
- Overrides:
- Source:
getAnyInput()
- Source:
Returns:
If any input from the gamepad is being pressed.
getInput(control) → {boolean}
Parameters:
Name | Type | Description |
---|---|---|
control |
string |
- Source:
Returns:
if the control is being pressed.
- Type
- boolean
update()
Called by MicrogameInputManager. Updates module:input~MicrogameInput#stateTracker based on inputs it detects.
- Overrides:
- Source:
Returns:
The keys that we're going to be pressing based on our recieved inputs.