From e7f0a5ad917a4ba3e273de671e8abaab7efa689c Mon Sep 17 00:00:00 2001 From: "PSp..om" Date: Fri, 17 Feb 2012 03:56:41 +0000 Subject: [PATCH] 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 --- engine/src/core/com/jme3/input/InputManager.java | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/engine/src/core/com/jme3/input/InputManager.java b/engine/src/core/com/jme3/input/InputManager.java index 0706c0ded..23f29887f 100644 --- a/engine/src/core/com/jme3/input/InputManager.java +++ b/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. *