Package com.jme3.input
Class JoystickCompatibilityMappings
java.lang.Object
com.jme3.input.JoystickCompatibilityMappings
Provides compatibility mapping to different joysticks
 that both report their name in a unique way and require
 remapping to achieve a proper default layout.
 
All mappings MUST be defined before the joystick support has been initialized in the InputManager.
- 
Method SummaryModifier and TypeMethodDescriptionstatic voidaddAxisMapping(String stickName, String sourceComponentId, String remapId) Adds a single Joystick axis or button remapping based on the joystick's name and axis/button name.static voidaddAxisMapping(String stickName, String sourceComponentId, String remapId, float[] range) Adds a single Joystick axis or button remapping based on the joystick's name and axis/button name.static voidaddButtonMapping(String stickName, String sourceComponentId, String remapId) Adds a single Joystick axis or button remapping based on the joystick's name and axis/button name.static voidaddJoystickNameRegex(String regex, String name) Maps a regular expression to a normalized name for that joystick.static voidaddMapping(String stickName, String sourceComponentId, String remapId) Adds a single Joystick axis or button remapping based on the joystick's name and axis/button name.static voidAdds a preconfigured set of mappings in Properties object form where the names are dot notation "axis"/"button"/"".getButtonMappings(String joystickName, boolean create) Obtains mappings specific to the joystick buttonsgetJoystickButtonMappings(String joystickName) Returns a set of Joystick button name remappings if they exist otherwise it returns an empty map.getJoystickMappings(String joystickName) Returns a set of Joystick axis/button name remappings if they exist otherwise it returns an empty map.getMappings(String joystickName, boolean create) protected static StringgetNormalizedName(String name) protected static voidLoads the default compatibility mappings by looking for joystick-mapping.properties files on the classpath.static voidLoads a set of compatibility mappings from the property file specified by the given URL.protected static voidloadMappings(String path) static StringTakes the original name of an axis, specifically, and returns the new name it will function under.static floatremapAxisRange(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 StringremapButton(String joystickName, String componentId) Takes the original name of a button, specifically, and returns the new name it will function under.static StringremapComponent(String joystickName, String componentId) Returns the remapped version of the axis/button name if there is a mapping for it otherwise it returns the original name.
- 
Method Details- 
getMappings
- 
getButtonMappingsObtains mappings specific to the joystick buttons- Parameters:
- 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.
- Returns:
- The various button remappings for the requested joystick, or null of there are none.
 
- 
remapAxisRangeThis method will take a "raw" axis value from the system and rescale it based on what the remapper has specified. For example, if the remapper specified an axis to be scaled to [0.0,1.0], then a raw value of -0.5 would be converted to 0.25.- Parameters:
- axis- - The axis to remap.
- currentValue- - The raw value the system is outputting, on a scale of -1.0 to 1.0.
- Returns:
- The new value that will be provided to listeners, on a scale specified by the remappings file.
 
- 
remapAxisTakes the original name of an axis, specifically, and returns the new name it will function under.- Parameters:
- joystickName- - The joystick type the axis comes from.
- componentId- - The system-provided name for the axis.
- Returns:
- The new name for the axis, or just componentId if no remapping was provided.
 
- 
remapButtonTakes the original name of a button, specifically, and returns the new name it will function under.- Parameters:
- joystickName- - The joystick type the axis comes from.
- componentId- - The system-provided name for the button.
- Returns:
- The new name for the button, or just componentId if no remapping was provided.
 
- 
remapComponentReturns the remapped version of the axis/button name if there is a mapping for it otherwise it returns the original name.- Parameters:
- joystickName- which joystick (not null)
- componentId- the unmapped axis/button name
- Returns:
- the resulting axis/button name
 
- 
getJoystickButtonMappingsReturns a set of Joystick button name remappings if they exist otherwise it returns an empty map.- Parameters:
- joystickName- which joystick (not null)
- Returns:
- an unmodifiable map
 
- 
getJoystickMappingsReturns a set of Joystick axis/button name remappings if they exist otherwise it returns an empty map.- Parameters:
- joystickName- which joystick (not null)
- Returns:
- an unmodifiable map
 
- 
addAxisMappingAdds a single Joystick axis or button remapping based on the joystick's name and axis/button name. The "remap" value will be used instead.- Parameters:
- stickName- which joystick (not null)
- sourceComponentId- the name to be remapped
- remapId- the remapped name
 
- 
addAxisMappingpublic static void addAxisMapping(String stickName, String sourceComponentId, String remapId, float[] range) Adds a single Joystick axis or button remapping based on the joystick's name and axis/button name. The "remap" value will be used instead.- Parameters:
- stickName- which joystick (not null)
- sourceComponentId- the name to be remapped
- remapId- the remapped name
- range- the desired range (not null, exactly 2 elements)
 
- 
addButtonMappingAdds a single Joystick axis or button remapping based on the joystick's name and axis/button name. The "remap" value will be used instead.- Parameters:
- stickName- which joystick (not null)
- sourceComponentId- the name to be remapped
- remapId- the remapped name
 
- 
addMappingAdds a single Joystick axis or button remapping based on the joystick's name and axis/button name. The "remap" value will be used instead.- Parameters:
- stickName- which joystick (not null)
- sourceComponentId- the name to be remapped
- remapId- the remapped name
 
- 
addMappingsAdds a preconfigured set of mappings in Properties object form where the names are dot notation "axis"/"button"/"". "joystick"."axis/button name" and the values are the remapped component name. This calls addMapping(stickName, sourceComponent, remap) for every property that it is able to parse.- Parameters:
- p- (not null)
 
- 
addJoystickNameRegexMaps a regular expression to a normalized name for that joystick.- Parameters:
- regex- the regular expression to be matched
- name- the remapped name
 
- 
getNormalizedName
- 
loadMappingPropertiesLoads a set of compatibility mappings from the property file specified by the given URL.- Parameters:
- u- the URL of the properties file (not null)
- Throws:
- IOException- if an I/O exception occurs
 
- 
loadMappings- Throws:
- IOException
 
- 
loadDefaultMappingsprotected static void loadDefaultMappings()Loads the default compatibility mappings by looking for joystick-mapping.properties files on the classpath.
 
-