|
@@ -36,7 +36,7 @@ import static com.jme3.input.KeyInput.*;
|
|
/**
|
|
/**
|
|
* Translate key codes (from {@link KeyInput}) to descriptive names.
|
|
* Translate key codes (from {@link KeyInput}) to descriptive names.
|
|
*
|
|
*
|
|
- * This class has no static methods, yet it can be instantiated. Here's why:
|
|
|
|
|
|
+ * This class has only static methods, yet it can be instantiated. Here's why:
|
|
*
|
|
*
|
|
* It used to be that there was no static getName() method, so the only way to
|
|
* It used to be that there was no static getName() method, so the only way to
|
|
* get names was to instantiate a KeyNames. As a consequence, we have
|
|
* get names was to instantiate a KeyNames. As a consequence, we have
|
|
@@ -189,6 +189,13 @@ public class KeyNames {
|
|
KEY_NAMES[KEY_UNLABELED] = "Unlabeled";
|
|
KEY_NAMES[KEY_UNLABELED] = "Unlabeled";
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * Obtain a descriptive name for the specified key code. Key codes are
|
|
|
|
+ * defined in {@link KeyInput}.
|
|
|
|
+ *
|
|
|
|
+ * @param keyId a key code (≥0, ≤255)
|
|
|
|
+ * @return the corresponding name, or null if not named
|
|
|
|
+ */
|
|
public static String getName(int keyId) {
|
|
public static String getName(int keyId) {
|
|
return KEY_NAMES[keyId];
|
|
return KEY_NAMES[keyId];
|
|
}
|
|
}
|