I am having trouble getting any kind of input from KeyListener - and can not find any good examples around.
Could some one post a working, simplified & bare bones example on how to get this to work ?
Here is my version - which does nothing useful .
Game Loop
public class GameLoop {
KeyBoard kb;
boolean RUN;
public GameLoop(){
RUN = true;
kb = new KeyBoard();
while(RUN){
System.out.println(kb.getX() );
//dostuff();
}
}
}
KeyBoard
public class KeyBoard implements KeyListener{
int x = 0 ;
public void keyPressed(KeyEvent e) {}
public void keyReleased(KeyEvent e) { x ++;}
public void keyTyped(KeyEvent e) {}
public String getX(){return "" + x ;}
}