[LWJGL3 2D教程]#4按键

按键很简单,如果K按下,就会输出“K press“

while (!glfwWindowShouldClose(window)) {
    glfwPollEvents();

    if (glfwGetKey(window, GLFW_KEY_K) == GLFW_TRUE) {
        System.out.println("K press");
    }
}

如果鼠标左键按下,就会输出“MouseLeft press“

while (!glfwWindowShouldClose(window)) {
    glfwPollEvents();

    if (glfwGetMouseButton(window, GLFW_MOUSE_BUTTON_LEFT) == GLFW_TRUE) {
        System.out.println("MouseLeft press");
    }
}