Is there a way to get the user input without GUI Listeners or Scanner class? Something like this:
if (Input.isKeyDown(KeyCode.VK_A)) {
// Do something
}
In Unity3D you can get the Users input using this way.
Best regards Morph
Is there a way to get the user input without GUI Listeners or Scanner class? Something like this:
if (Input.isKeyDown(KeyCode.VK_A)) {
// Do something
}
In Unity3D you can get the Users input using this way.
Best regards Morph
Take a look at this page: http://libgdx.badlogicgames.com/nightlies/docs/api/com/badlogic/gdx/Input.Keys.html
You will find what you want.
Hope this helps!
EDIT: The link points to a page that contains an interface created for Input in some backends (desktop, GWT, etc.).
It may be useful for what you want.
import java.awt.event.KeyListener;
import java.awt.event.KeyEvent;
public class KeyPressListener implements KeyListener {
// when a key is pressed
public void keyPressed(KeyEvent e){
// the key you pressed
char k = e.getKeyChar();
// prints out what key you pressed
System.out.println(k);
}
// when a key is typed
public void keyTyped(KeyEvent e){
}
// when a key is released
public void keyReleased(KeyEvent e){
}
}
this will get you keyboard input