Created
March 25, 2017 14:07
-
-
Save ronnyworm/c55499c510b1d0241b410f7d6baf5f53 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class GearsKeyAdapter extends KeyAdapter { | |
public void keyPressed(KeyEvent e) { | |
int kc = e.getKeyCode(); | |
if(KeyEvent.VK_LEFT == kc) { | |
view_roty -= 1; | |
} else if(KeyEvent.VK_RIGHT == kc) { | |
view_roty += 1; | |
} else if(KeyEvent.VK_UP == kc) { | |
view_rotx -= 1; | |
} else if(KeyEvent.VK_DOWN == kc) { | |
view_rotx += 1; | |
} | |
} | |
} | |
KeyListener gearsKeys = new GearsKeyAdapter(); | |
getContentPane().addKeyListener(gearsKeys); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment