|
@@ -1,5 +1,5 @@
|
|
|
/*
|
|
|
- * Copyright (c) 2009-2012 jMonkeyEngine
|
|
|
+ * Copyright (c) 2009-2021 jMonkeyEngine
|
|
|
* All rights reserved.
|
|
|
*
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
@@ -109,10 +109,21 @@ public class GlfwKeyInput implements KeyInput {
|
|
|
charCallback.close();
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * Determine the name of the specified key in the current system language.
|
|
|
+ *
|
|
|
+ * @param jmeKey the keycode from {@link com.jme3.input.KeyInput}
|
|
|
+ * @return the name of the key, or null if unknown
|
|
|
+ */
|
|
|
@Override
|
|
|
public String getKeyName(int jmeKey) {
|
|
|
int glfwKey = GlfwKeyMap.fromJmeKeyCode(jmeKey);
|
|
|
- return glfwGetKeyName(glfwKey, 0);
|
|
|
+ if (glfwKey == GLFW_KEY_UNKNOWN) {
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+
|
|
|
+ String result = glfwGetKeyName(glfwKey, 0);
|
|
|
+ return result;
|
|
|
}
|
|
|
|
|
|
private void initCallbacks() {
|