input display toggleable with i key

This commit is contained in:
Antoine 2021-06-25 18:38:22 +02:00
parent 3799a7549b
commit 2000ac6a30
2 changed files with 19 additions and 4 deletions

View File

@ -29,9 +29,10 @@ public class KeyboardInput extends GLFWKeyCallback {
match.showP1Hitbox = !match.showP1Hitbox; match.showP1Hitbox = !match.showP1Hitbox;
match.showP2Hitbox = !match.showP2Hitbox; match.showP2Hitbox = !match.showP2Hitbox;
} }
else if(key == GLFW_KEY_D && action == GLFW_PRESS){ else if(key == GLFW_KEY_D && action == GLFW_PRESS)
match.debugToggle(); match.debugToggle();
} else if(key == GLFW_KEY_I && action == GLFW_PRESS)
match.inputP1Toggle();
} }
public static boolean isKeyDown(int keyCode) { public static boolean isKeyDown(int keyCode) {

View File

@ -123,7 +123,7 @@ public class match {
objP1.getShadow().translate(new Vector3f(0f,p1.getPosY(),0)); objP1.getShadow().translate(new Vector3f(0f,p1.getPosY(),0));
objP2.getShadow().translate(new Vector3f(0f,p2.getPosY(),0)); objP2.getShadow().translate(new Vector3f(0f,p2.getPosY(),0));
// Crée l'InputList // Crée l'InputList
if(showInputListP1){ if (showInputListP1){
inputListP1 = new UIInputList(inputsP1, 10f, 0f, 0.85f, 110f, engine); inputListP1 = new UIInputList(inputsP1, 10f, 0f, 0.85f, 110f, engine);
engine.add_uiElement(inputListP1); engine.add_uiElement(inputListP1);
inputListP1.init(); inputListP1.init();
@ -150,7 +150,7 @@ public class match {
} }
engine.remove_uiElement(matchWon); engine.remove_uiElement(matchWon);
if(showInputListP1){ if(inputListP1 != null){
engine.remove_uiElement(inputListP1); 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;
}
}
} }