public class ControllerMappings
extends java.lang.Object
| Modifier and Type | Class and Description |
|---|---|
static class |
ControllerMappings.ControllerAxis |
static class |
ControllerMappings.ControllerButton |
static class |
ControllerMappings.ControllerInput |
protected class |
ControllerMappings.MappedInput
A single input mapping definition for one ConfiguredInput and one Controller
|
protected class |
ControllerMappings.MappedInputs
Input mappings for a single controller.
|
static class |
ControllerMappings.RecordResult |
| Modifier and Type | Field and Description |
|---|---|
float |
analogToDigitalTreshold |
static java.lang.String |
LOG_TAG |
float |
maxAcceptedAnalogValue
some Gamepads report analog axis from .997 to 1.03...
|
| Constructor and Description |
|---|
ControllerMappings() |
| Modifier and Type | Method and Description |
|---|---|
ControllerMappings |
addConfiguredInput(ConfiguredInput configuredInput) |
void |
commitConfig()
call this when configuration is done
|
boolean |
fillFromJson(com.badlogic.gdx.utils.JsonValue json) |
protected ControllerMappings.MappedInputs |
getControllerMapping(com.badlogic.gdx.controllers.Controller controller) |
boolean |
getDefaultMapping(ControllerMappings.MappedInputs defaultMapping,
com.badlogic.gdx.controllers.Controller controller)
use this method to define a default mapping for your controllers.
|
void |
recordButtonsToIgnoreForMapping(com.badlogic.gdx.controllers.Controller controller)
Some Controllers might have buttons or axis that are broken and always report a value.
|
ControllerMappings.RecordResult |
recordMapping(com.badlogic.gdx.controllers.Controller controller,
int configuredInputId)
Record a mapping.
|
void |
resetMappings(com.badlogic.gdx.controllers.Controller controller)
resets mapping for the given controller.
|
com.badlogic.gdx.utils.JsonValue |
toJson() |
public static final java.lang.String LOG_TAG
public float analogToDigitalTreshold
public float maxAcceptedAnalogValue
public com.badlogic.gdx.utils.JsonValue toJson()
public boolean fillFromJson(com.badlogic.gdx.utils.JsonValue json)
protected ControllerMappings.MappedInputs getControllerMapping(com.badlogic.gdx.controllers.Controller controller)
public boolean getDefaultMapping(ControllerMappings.MappedInputs defaultMapping, com.badlogic.gdx.controllers.Controller controller)
The method is only called if mapping for the controller is needed, but not found. Use the given controller object to find out more about the controller.
defaultMapping - Use MappedInputs#putMapping(MappedInput) on this to define default mappingspublic ControllerMappings addConfiguredInput(ConfiguredInput configuredInput)
public void commitConfig()
public void resetMappings(com.badlogic.gdx.controllers.Controller controller)
MappedController will still hold
a reference to the old mapping, so be sure to refresh such references with its
MappedController.refreshMappingCache().
MappedControllerAdapter is not concerned.controller - public void recordButtonsToIgnoreForMapping(com.badlogic.gdx.controllers.Controller controller)
controller - controller to listen topublic ControllerMappings.RecordResult recordMapping(com.badlogic.gdx.controllers.Controller controller, int configuredInputId)
controller - controller to listen toconfiguredInputId - configured button or axis to recordControllerMappings.RecordResult.nothing_done if nothing was done, ControllerMappings.RecordResult.not_added if buttons were
pressed but could not be added, ControllerMappings.RecordResult.need_second_button if axis was mapped to button and next
call must be for an axis is the reverse button, ControllerMappings.RecordResult.not_added_need_button if is waiting for
the second button but no valid was pressed
ControllerMappings.RecordResult.recorded if a button mapping was added