Я могу, а может и не быть полезен / возрождаю здесь мертвую тему, но для любого мошенника Google, я даю вам следующее:
Это мой класс ввода от моего двигателя Zdeva
Итак, вам не нужно загружать весь «движок» ..
package LWJGL;
import org.lwjgl.input.Keyboard;
import org.lwjgl.input.Mouse;
public class Input
{
public static boolean[] mouseButtons = {false, false, false};
public static int[] mousePos = new int[Mouse.getButtonCount()];
public static int[] keysBound = {Keyboard.KEY_A, Keyboard.KEY_B};
/**
* Initializes the input system. Loads keyconfig.
*
*/
public static void init()
{
System.out.println("Initializing input system...");
//Eventually will check for OS, and adjust keys accordingly.
System.out.println("Input system initialized!");
}
/**
* Updates all mouse info, keys bound, and performs actions.
*/
public static void tick()
{
mouseButtons[0] = Mouse.isButtonDown(0);
mouseButtons[1] = Mouse.isButtonDown(1);
mousePos[0] = Mouse.getX();
mousePos[1] = Mouse.getY();
while(Keyboard.next())
{
if(Keyboard.getEventKeyState())
{
doAction(Keyboard.getEventKey(), false);
}
}
for(int key : keysBound)
{
if(Keyboard.isKeyDown(key))
{
doAction(key, true);
}
}
while(Mouse.next())
{
doAction(-1, false);
}
doAction(0, true);
}
/**
* Does the associated action for each key. Called automatically from tick.
* @param key The key to check & perform associated action
*/
public static void doAction(int key, boolean ifRepeat)
{
if(mouseButtons[0])
{
}
if(mouseButtons[1])
{
}
if(key == keysBound[0] & ifRepeat)
{
System.out.println("a");
}
if(key == keysBound[1] & !ifRepeat)
{
System.out.println("b");
}
}
}