Members
(private) captureNextCallback
Callback to call after an input is recieved. Set in module:input~MicrogameInputManager#captureNextInput.
- Source:
(private) defaultBindingStrings :Object:.<string:, string:>
Default dictionary of how arrow key presses are controlled by bindings.
Type:
- Default Value:
- getBindingsStrings("all")
- Source:
- See:
(readonly) defaultBindingStrings
- Source:
(private) defaultBindingStringsByBindingName :Object:.<string:, string:>
Default list of how arrow key presses are controlled by bindings.
Type:
- Default Value:
- getBindingsStringsByBindingName("all")
- Source:
- See:
(private) defaultBindings :Object:.<string:, Map:.<string:, type:>>
Default bindings for controls.
Set in constructor.
Type:
- Default Value:
- getBindings("all")
- Source:
- See:
-
- getAllBindings("all")
gameTarget :Element
The current iframe to target.
Type:
- Element
- Source:
(private) keysDown :Set
The keys currently being pressed.
Type:
- Set
- Source:
(private) microgameInputs
List of all input methods.
- Default Value:
- {"keyboard": new MicrogameKeyboard()};
- Source:
Methods
addBinding(game, bindingName, binding)
Parameters:
Name | Type | Description |
---|---|---|
game |
string | Game Name |
bindingName |
string | The arrow key to bind to as what's pressed when binding is pressed (it's confusing, I'm sorry) |
binding |
Object | The control pressed to add as a binding. Grabbed from module:input~MicrogameInput from children's getAnyInput function. |
- Source:
cancelCaptureInput()
captureNextInput(callback)
Parameters:
Name | Type | Description |
---|---|---|
callback |
function | To call in module:input~MicrogameInputManager#updateInput |
clearBindings(game, bindingName)
Clear all the bindings for a given game and direction.
Parameters:
Name | Type | Description |
---|---|---|
game |
string | Game Name |
bindingName |
string | Direction (ArrowUp, ArrowLeft, etc.) |
- Source:
gameStartInputUpdate(game)
Calls gameStartInput update on all the child module:input~MicrogameInputs.
Sets the current game target to send inputs to.
Called by MicrogameJam#gameStarted.
Parameters:
Name | Type | Description |
---|---|---|
game |
string | Game Name |
- Source:
getAllBindings(game) → {Object:.<string:, Map:.<string:, type:>>}
Parameters:
Name | Type | Description |
---|---|---|
game |
string | Game Name |
- Source:
Returns:
A dictionary of bindings by the keys to press. Each binding associates with a map that associates with a specific control (i.e., an input from module:input~MicrogameInput) and the associated type of module:input~MicrogameInput.
getAnyInput() → {Object}
From all of module:input~MicrogameInputManager#microgameInputs, check if any controls are being pressed from one.
- Source:
Returns:
A given control, or null if no input is down.
- Type
- Object
getBindingsStrings(game) → {Object:.<string:, string:>}
Parameters:
Name | Type | Description |
---|---|---|
game |
string | Game Name |
- Source:
Returns:
Dictionary of how arrow key presses relate to input bindings (i.e., what bindings represent what arrow key presses, but in reverse.)
getBindingsStringsByBindingName(game) → {Object:.<string:, string:>}
Like module:input~MicrogameInputManager#getBindingsStrings, except meant to be formatted in a more display friendly format. Used exclusively by module:optionsmanager.
Parameters:
Name | Type | Description |
---|---|---|
game |
string | Game Name |
- Source:
Returns:
Dictionary of how arrow key presses relate to input bindings (i.e., what bindings represent what arrow key presses, but in reverse.)
hasAdjustedBindings(game) → {boolean}
Does the current game differ from our default bindings?
Parameters:
Name | Type | Description |
---|---|---|
game |
string | Game Name |
- Source:
Returns:
- Type
- boolean
hasBinding(game, binding) → {boolean}
Parameters:
Name | Type | Description |
---|---|---|
game |
string | Game Name |
binding |
Object | The control that's been pressed. |
- Source:
Returns:
Is this control bound somewhere?
- Type
- boolean
resetBindings(game, bindingName)
Reset a game's bindings to their default values.
Parameters:
Name | Type | Description |
---|---|---|
game |
string | Game Name |
bindingName |
string | Direction (ArrowUp, ArrowLeft, etc.) |
- Source:
setBindingFromOption(game, direction, option)
Called exclusively by module:optionsmanager.OptionsManager.
Parameters:
- Source:
updateInput()
Run every frame or so by MicrogameJam#update.
- Source:
(static) pressKey(key, isDown)
Press a key to the active game.
Parameters:
Name | Type | Description |
---|---|---|
key |
string | Keycode |
isDown |
boolean | Are we pressing up or down? |
- Source: