From 6961d5089c35cca302afea4c4e857567017536bf Mon Sep 17 00:00:00 2001 From: andreas Date: Tue, 11 Nov 2014 15:58:58 +0100 Subject: [PATCH] ESC Key added for pause testing --- HeatUp/src/de/heatup/ui/KeyBindings.java | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/HeatUp/src/de/heatup/ui/KeyBindings.java b/HeatUp/src/de/heatup/ui/KeyBindings.java index edd1692..d60dbbe 100644 --- a/HeatUp/src/de/heatup/ui/KeyBindings.java +++ b/HeatUp/src/de/heatup/ui/KeyBindings.java @@ -4,6 +4,7 @@ import java.awt.event.KeyAdapter; import java.awt.event.KeyEvent; import de.heatup.mapengine.CollisionHandler; +import de.heatup.testing.GameLoopD; import de.heatup.testing.Player; public class KeyBindings extends KeyAdapter { @@ -12,6 +13,7 @@ public class KeyBindings extends KeyAdapter { private boolean right = false; private boolean up = false; private boolean down = false; + private boolean esc = false; private Player player; public KeyBindings(Player player) { @@ -34,6 +36,9 @@ public class KeyBindings extends KeyAdapter { case KeyEvent.VK_DOWN: down = false; break; + case KeyEvent.VK_ESCAPE: + esc = false; + break; } } @@ -53,6 +58,9 @@ public class KeyBindings extends KeyAdapter { case KeyEvent.VK_DOWN: down = true; break; + case KeyEvent.VK_ESCAPE: + esc = true; + break; } } @@ -90,6 +98,10 @@ public class KeyBindings extends KeyAdapter { } player.animate = true; } + if (isESC()) { + System.out.println("ESC pressed."); + GameLoopD.pause(); + } } public boolean isLeft() { @@ -107,4 +119,7 @@ public class KeyBindings extends KeyAdapter { public boolean isDown() { return down; } + public boolean isESC() { + return esc; + } } \ No newline at end of file