From 3c20db686c7a1de6891f16a7dbe99cfade4c5315 Mon Sep 17 00:00:00 2001 From: Antoine Date: Fri, 25 Jun 2021 15:36:27 +0200 Subject: [PATCH] debug mode activable dans le code --- src/main/java/gameplay/match/match.java | 33 +++++++++++++++---------- 1 file changed, 20 insertions(+), 13 deletions(-) diff --git a/src/main/java/gameplay/match/match.java b/src/main/java/gameplay/match/match.java index 1e82cc8..57fa093 100644 --- a/src/main/java/gameplay/match/match.java +++ b/src/main/java/gameplay/match/match.java @@ -84,6 +84,7 @@ public class match { private static int rightBoundary; // Debug + public static boolean debugMode=true; public static boolean showP1Hitbox; public static boolean showP2Hitbox; private static List listHitboxObj = new ArrayList<>(); @@ -280,12 +281,6 @@ public class match { /* GUI Setup */ - coordP1 = new UIElementText("objP1: " + objP1.getXPos() + ":" + objP1.getYPos() + " P1: " + p1.getPosX() +":" + p1.getPosY(), 5f, 0f, 0.15f, 70f, engine); - coordP1.setBackground(new Vector3f(0f,0f,0f)); - engine.add_uiElement(coordP1); - coordP2 = new UIElementText("objP2: " + objP2.getXPos() + ":" + objP2.getYPos() + " P1: " + p2.getPosX() +":" + p2.getPosY(), 5f, 0f, 0.1f, 70f, engine); - coordP2.setBackground(new Vector3f(0f,0f,0f)); - engine.add_uiElement(coordP2); // Barre de vie healthBarP1Obj = new HorizontalProgressBar(80f, 8.5f, 0.4f, 100f, p1.getCurrentHP(), p1.getMaxHP(), false); healthBarP1Obj.setShader("/shaders/StylishShaders/BasicNoTexVert.glsl", "/shaders/StylishShaders/HorizontalProgressBarGradientSquareFrag.glsl"); @@ -312,10 +307,18 @@ public class match { // Timer timerUI = new UIElementText(timer + "", 10f, 0.453f, 0.995f, 85f, engine); engine.add_uiElement(timerUI); - // FPS counter - fpsCounter = new UIElementText("Boulevard Combattant", 5f, 0f, 0.04f, 100f, engine); - fpsCounter.setBackground(new Vector3f(0f,0f,0f)); - engine.add_uiElement(fpsCounter); + if(debugMode){ + coordP1 = new UIElementText("objP1: " + objP1.getXPos() + ":" + objP1.getYPos() + " P1: " + p1.getPosX() +":" + p1.getPosY(), 5f, 0f, 0.15f, 70f, engine); + coordP1.setBackground(new Vector3f(0f,0f,0f)); + engine.add_uiElement(coordP1); + coordP2 = new UIElementText("objP2: " + objP2.getXPos() + ":" + objP2.getYPos() + " P1: " + p2.getPosX() +":" + p2.getPosY(), 5f, 0f, 0.1f, 70f, engine); + coordP2.setBackground(new Vector3f(0f,0f,0f)); + engine.add_uiElement(coordP2); + // FPS counter + fpsCounter = new UIElementText("Boulevard Combattant", 5f, 0f, 0.04f, 100f, engine); + fpsCounter.setBackground(new Vector3f(0f,0f,0f)); + engine.add_uiElement(fpsCounter); + } timeStampFpsCounter = System.currentTimeMillis(); //SetTracking engine.setCameraTrackingSF3ThirdStrike(objP1, objP2); @@ -488,8 +491,10 @@ public class match { //Waits the end of 1/60th of a second since start of frame then loops back to start case 23: // GUI update here - coordP1.setText("objP1: " + objP1.getXPos() + ":" + objP1.getYPos() + " P1: " + p1.getPosX() +":" + p1.getPosY()); - coordP2.setText("objP2: " + objP2.getXPos() + ":" + objP2.getYPos() + " P2: " + p2.getPosX() +":" + p2.getPosY()); + if (debugMode){ + coordP1.setText("objP1: " + objP1.getXPos() + ":" + objP1.getYPos() + " P1: " + p1.getPosX() +":" + p1.getPosY()); + coordP2.setText("objP2: " + objP2.getXPos() + ":" + objP2.getYPos() + " P2: " + p2.getPosX() +":" + p2.getPosY()); + } healthBarP1Obj.setCurrent(p1.getCurrentHP()); healthBarP1Obj.setMax(p1.getMaxHP()); healthBarP2Obj.setCurrent(p2.getCurrentHP()); healthBarP2Obj.setMax(p2.getMaxHP()); timerUI.setText(timer + ""); @@ -503,9 +508,11 @@ public class match { frameCounter++; if (System.currentTimeMillis() - timeStampFpsCounter >= 1000){ - fpsCounter.setText("FPS: " + frameCounter); frameCounter = 0; timeStampFpsCounter = System.currentTimeMillis(); + if(debugMode){ + fpsCounter.setText("FPS: " + frameCounter); + } } frameCount++;