diff --git a/src/main/java/engine/input/KeyboardInput.java b/src/main/java/engine/input/KeyboardInput.java index 96c75e7..960a37d 100644 --- a/src/main/java/engine/input/KeyboardInput.java +++ b/src/main/java/engine/input/KeyboardInput.java @@ -29,9 +29,10 @@ public class KeyboardInput extends GLFWKeyCallback { match.showP1Hitbox = !match.showP1Hitbox; match.showP2Hitbox = !match.showP2Hitbox; } - else if(key == GLFW_KEY_D && action == GLFW_PRESS){ + else if(key == GLFW_KEY_D && action == GLFW_PRESS) match.debugToggle(); - } + else if(key == GLFW_KEY_I && action == GLFW_PRESS) + match.inputP1Toggle(); } public static boolean isKeyDown(int keyCode) { diff --git a/src/main/java/gameplay/match/match.java b/src/main/java/gameplay/match/match.java index 27ae659..4eeefb6 100644 --- a/src/main/java/gameplay/match/match.java +++ b/src/main/java/gameplay/match/match.java @@ -123,7 +123,7 @@ public class match { objP1.getShadow().translate(new Vector3f(0f,p1.getPosY(),0)); objP2.getShadow().translate(new Vector3f(0f,p2.getPosY(),0)); // Crée l'InputList - if(showInputListP1){ + if (showInputListP1){ inputListP1 = new UIInputList(inputsP1, 10f, 0f, 0.85f, 110f, engine); engine.add_uiElement(inputListP1); inputListP1.init(); @@ -150,7 +150,7 @@ public class match { } engine.remove_uiElement(matchWon); - if(showInputListP1){ + if(inputListP1 != null){ engine.remove_uiElement(inputListP1); } @@ -963,4 +963,18 @@ public class match { } } + public static void inputP1Toggle(){ + if (showInputListP1){ + if (inputListP1 != null){ + engine.remove_uiElement(inputListP1); + } + showInputListP1 = false; + } else { + inputListP1 = new UIInputList(inputsP1, 10f, 0f, 0.85f, 110f, engine); + engine.add_uiElement(inputListP1); + inputListP1.init(); + showInputListP1 = true; + } + } + }