Since input manager throws an exception when trying

to delete non-existent mappings, and since I'm loathe
to change this behavior even though I kind of don't
agree with it...
instead, I've added a hasMapping() method so that
callers can avoid deleting non-existant mappings
without having to do all of their own book-keeping.


git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@9164 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
3.0
PSp..om 13 years ago
parent d440f70d92
commit e7f0a5ad91
  1. 13
      engine/src/core/com/jme3/input/InputManager.java

@ -543,6 +543,19 @@ public class InputManager implements RawInputListener {
} }
} }
/**
* Returns true if this InputManager has a mapping registered
* for the given mappingName.
*
* @param mappingName The mapping name to check.
*
* @see InputManager#addMapping(java.lang.String, com.jme3.input.controls.Trigger[])
* @see InputManager#deleteMapping(java.lang.String)
*/
public boolean hasMapping(String mappingName) {
return mappings.containsKey(mappingName);
}
/** /**
* Deletes a mapping from receiving trigger events. * Deletes a mapping from receiving trigger events.
* *

Loading…
Cancel
Save