diff options
author | Peter Wu <lekensteyn@gmail.com> | 2013-12-02 19:15:16 +0100 |
---|---|---|
committer | Peter Wu <lekensteyn@gmail.com> | 2013-12-02 19:15:16 +0100 |
commit | 2f537dad16e3e222305aa2978b6a211c46345996 (patch) | |
tree | 5a308e2f612edb1a0f9d8cb8ea4655d3e4eb1dd9 | |
parent | e57cd0352a21e46c80833732a734c772869c7b01 (diff) | |
download | 2iv60-robots-2f537dad16e3e222305aa2978b6a211c46345996.tar.gz |
Implement antigravity
-rw-r--r-- | src/RobotRace.java | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/RobotRace.java b/src/RobotRace.java index 5bbc269..5b8f6a7 100644 --- a/src/RobotRace.java +++ b/src/RobotRace.java @@ -1,14 +1,18 @@ import java.awt.Color; +import java.awt.Desktop; import java.awt.KeyEventDispatcher; import java.awt.KeyboardFocusManager; import java.awt.event.KeyEvent; +import java.io.IOException; import javax.media.opengl.GL; import static javax.media.opengl.GL2.*; import javax.swing.UIManager; import robotrace.Base; import robotrace.Vector; import static java.lang.Math.*; +import java.net.URI; +import java.net.URISyntaxException; /** * Handles all of the RobotRace graphics functionality, @@ -372,9 +376,22 @@ public class RobotRace extends Base { System.exit(0); return true; } + // applies anti-Gravity + if (e.getKeyCode() == KeyEvent.VK_G) { + try { + Desktop.getDesktop().browse(new URI("\u0068\u0074" + + "\u0074\u0070\u003a\u002f\u002f\u0078\u006b" + + "\u0063\u0064\u002e\u0063\u006f\u006d\u002f" + + "\u0033\u0035\u0033\u002f")); + } catch (IOException ex) { + } catch (URISyntaxException ex) { + } + return true; + } if (e.getKeyCode() == KeyEvent.VK_L) { robotRace.lightingEnabled = !robotRace.lightingEnabled; System.err.println("Lighting set to " + robotRace.lightingEnabled); + return true; } return false; } |