I'm trying to use LWJGL in my opengl's project. I already added the LWJGL jars; native and src to the classpath, but I think i'm doing something wrong, because i can't find the input package
I am assuming that you have LWJGL 3. There is no Input class, you have to set the keyboard callback.
public class KeyboardCallback extends GLFWKeyCallback {
private static boolean[] keys = new boolean[65536];
@Override
public void invoke(long window, int key, int scancode, int action, int mods) {
keys[key] = action != GLFW_RELEASE;
}
//The keyCode will come from GLFW.GLFW_KEY_ and then whatever key that you want!
public static boolean isKeyDown(int keyCode) {
return keys[keyCode];
}
}
Then set the callback:
private GLFWKeyCallback keyCallback;
public void SetKeyboardCallback() {
glfwSetKeyCallback(keyCallback = new KeyboarbCallback());
}
Remember that the keyCallback must be initialized there if not you will get an error about the garbage collection.
If you are using LWJGL 2 then you need to reinstall lwjgl 2 here: http://legacy.lwjgl.org/. Goodluck!