Java Code Examples for org.lwjgl.glfw.GLFW#glfwGetKeyName()

The following examples show how to use org.lwjgl.glfw.GLFW#glfwGetKeyName() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: GLFWContextCreator.java    From settlers-remake with MIT License 5 votes vote down vote up
@Override
public void invoke(long window, int key, int scancode, int action, int mods) {
	String name = GLFW.glfwGetKeyName(key, scancode);
	if(name == null) {
		name = keys.get(key);
	}

	if(action == GLFW.GLFW_PRESS) {
		startKeyEvent(name);
	} else if(action == GLFW.GLFW_RELEASE){
		endKeyEvent(name);
	}
}
 
Example 2
Source File: Variables.java    From The-5zig-Mod with MIT License 4 votes vote down vote up
@Override
public String getKeyDisplayStringShort(int key) {
	return key < 0 ? "M" + (key + 101) : (key < 256 ? GLFW.glfwGetKeyName(key, -1) : String.format("%c", (char) (key - 256)).toUpperCase());
}
 
Example 3
Source File: KeyEvent.java    From LWJGUI with MIT License 4 votes vote down vote up
public String getKeyName() {
	return GLFW.glfwGetKeyName(key, scancode);
}