public class JoystickCompatibilityMappings
extends java.lang.Object
All mappings MUST be defined before the joystick support has been initialized in the InputManager.
| Modifier and Type | Method and Description |
|---|---|
static void |
addAxisMapping(java.lang.String stickName,
java.lang.String sourceComponentId,
java.lang.String remapId)
Adds a single Joystick axis or button remapping based on the
joystick's name and axis/button name.
|
static void |
addAxisMapping(java.lang.String stickName,
java.lang.String sourceComponentId,
java.lang.String remapId,
float[] range)
Adds a single Joystick axis or button remapping based on the
joystick's name and axis/button name.
|
static void |
addButtonMapping(java.lang.String stickName,
java.lang.String sourceComponentId,
java.lang.String remapId)
Adds a single Joystick axis or button remapping based on the
joystick's name and axis/button name.
|
static void |
addJoystickNameRegex(java.lang.String regex,
java.lang.String name)
Maps a regular expression to a normalized name for that joystick.
|
static void |
addMapping(java.lang.String stickName,
java.lang.String sourceComponentId,
java.lang.String remapId)
Adds a single Joystick axis or button remapping based on the
joystick's name and axis/button name.
|
static void |
addMappings(java.util.Properties p)
Adds a preconfigured set of mappings in Properties object
form where the names are dot notation
"axis"/"button"/"".
|
protected static java.util.Map<java.lang.String,java.lang.String> |
getButtonMappings(java.lang.String joystickName,
boolean create)
Obtains mappings specific to the joystick buttons
|
static java.util.Map<java.lang.String,java.lang.String> |
getJoystickButtonMappings(java.lang.String joystickName)
Returns a set of Joystick button name remappings if they exist otherwise
it returns an empty map.
|
static java.util.Map<java.lang.String,java.lang.String> |
getJoystickMappings(java.lang.String joystickName)
Returns a set of Joystick axis/button name remappings if they exist otherwise
it returns an empty map.
|
protected static java.util.Map<java.lang.String,java.lang.String> |
getMappings(java.lang.String joystickName,
boolean create) |
protected static java.lang.String |
getNormalizedName(java.lang.String name) |
protected static void |
loadDefaultMappings()
Loads the default compatibility mappings by looking for
joystick-mapping.properties files on the classpath.
|
static void |
loadMappingProperties(java.net.URL u)
Loads a set of compatibility mappings from the property file
specified by the given URL.
|
protected static void |
loadMappings(java.lang.ClassLoader cl,
java.lang.String path) |
static java.lang.String |
remapAxis(java.lang.String joystickName,
java.lang.String componentId)
Takes the original name of an axis, specifically, and returns the new name it will function under.
|
static float |
remapAxisRange(JoystickAxis axis,
float currentValue)
This method will take a "raw" axis value from the system and rescale it based on what the remapper has specified.
|
static java.lang.String |
remapButton(java.lang.String joystickName,
java.lang.String componentId)
Takes the original name of a button, specifically, and returns the new name it will function under.
|
static java.lang.String |
remapComponent(java.lang.String joystickName,
java.lang.String componentId)
Returns the remapped version of the axis/button name if there
is a mapping for it otherwise it returns the original name.
|
protected static java.util.Map<java.lang.String,java.lang.String> getMappings(java.lang.String joystickName,
boolean create)
protected static java.util.Map<java.lang.String,java.lang.String> getButtonMappings(java.lang.String joystickName,
boolean create)
joystickName - - The name of the joystick type to obtain mappings for.create - - If there are no mappings present and this parameter is true, then a new entry for this joystick is created.public static float remapAxisRange(JoystickAxis axis, float currentValue)
axis - - The axis to remap.currentValue - - The raw value the system is outputting, on a scale of -1.0 to 1.0.public static java.lang.String remapAxis(java.lang.String joystickName,
java.lang.String componentId)
joystickName - - The joystick type the axis comes from.componentId - - The system-provided name for the axis.public static java.lang.String remapButton(java.lang.String joystickName,
java.lang.String componentId)
joystickName - - The joystick type the axis comes from.componentId - - The system-provided name for the button.public static java.lang.String remapComponent(java.lang.String joystickName,
java.lang.String componentId)
joystickName - which joystick (not null)componentId - the unmapped axis/button namepublic static java.util.Map<java.lang.String,java.lang.String> getJoystickButtonMappings(java.lang.String joystickName)
joystickName - which joystick (not null)public static java.util.Map<java.lang.String,java.lang.String> getJoystickMappings(java.lang.String joystickName)
joystickName - which joystick (not null)public static void addAxisMapping(java.lang.String stickName,
java.lang.String sourceComponentId,
java.lang.String remapId)
stickName - which joystick (not null)sourceComponentId - the name to be remappedremapId - the remapped namepublic static void addAxisMapping(java.lang.String stickName,
java.lang.String sourceComponentId,
java.lang.String remapId,
float[] range)
stickName - which joystick (not null)sourceComponentId - the name to be remappedremapId - the remapped namerange - the desired range (not null, exactly 2 elements)public static void addButtonMapping(java.lang.String stickName,
java.lang.String sourceComponentId,
java.lang.String remapId)
stickName - which joystick (not null)sourceComponentId - the name to be remappedremapId - the remapped namepublic static void addMapping(java.lang.String stickName,
java.lang.String sourceComponentId,
java.lang.String remapId)
stickName - which joystick (not null)sourceComponentId - the name to be remappedremapId - the remapped namepublic static void addMappings(java.util.Properties p)
p - (not null)public static void addJoystickNameRegex(java.lang.String regex,
java.lang.String name)
regex - the regular expression to be matchedname - the remapped nameprotected static java.lang.String getNormalizedName(java.lang.String name)
public static void loadMappingProperties(java.net.URL u)
throws java.io.IOException
u - the URL of the properties file (not null)java.io.IOException - if an I/O exception occursprotected static void loadMappings(java.lang.ClassLoader cl,
java.lang.String path)
throws java.io.IOException
java.io.IOExceptionprotected static void loadDefaultMappings()