From 51733a2e6a41d56a66feda4baef67a0eaf916ab6 Mon Sep 17 00:00:00 2001 From: Antoine Date: Tue, 1 Jun 2021 19:51:01 +0200 Subject: [PATCH] Wildcard import --- src/engine/input/GamepadInput.java | 49 +++++++++++++++--------------- 1 file changed, 25 insertions(+), 24 deletions(-) diff --git a/src/engine/input/GamepadInput.java b/src/engine/input/GamepadInput.java index 2e9d055..33302da 100644 --- a/src/engine/input/GamepadInput.java +++ b/src/engine/input/GamepadInput.java @@ -5,6 +5,7 @@ import java.nio.FloatBuffer; import engine.Engine; +import static engine.input.inputVariables.*; import static org.lwjgl.glfw.GLFW.*; /* Buttons 0 : Croix / A @@ -106,50 +107,50 @@ public class GamepadInput { // A B X Y - buttonA_pressed = gamepadButton.get(inputVariables.buttonA) == 1; - buttonB_pressed = gamepadButton.get(inputVariables.buttonB) == 1; - buttonY_pressed = gamepadButton.get(inputVariables.buttonY) == 1; - buttonX_pressed = gamepadButton.get(inputVariables.buttonX) == 1; + buttonA_pressed = gamepadButton.get(buttonA) == 1; + buttonB_pressed = gamepadButton.get(buttonB) == 1; + buttonY_pressed = gamepadButton.get(buttonY) == 1; + buttonX_pressed = gamepadButton.get(buttonX) == 1; // LB RB - LB_pressed = gamepadButton.get(inputVariables.LB) == 1; - RB_pressed = gamepadButton.get(inputVariables.RB) == 1; + LB_pressed = gamepadButton.get(LB) == 1; + RB_pressed = gamepadButton.get(RB) == 1; //start select - start_pressed = gamepadButton.get(inputVariables.start) == 1; - select_pressed = gamepadButton.get(inputVariables.select) == 1; + start_pressed = gamepadButton.get(start) == 1; + select_pressed = gamepadButton.get(select) == 1; //R & L JoystickClick - R_JoyClick_pressed = gamepadButton.get(inputVariables.R_JoystickClick) == 1; - L_JoyClick_pressed = gamepadButton.get(inputVariables.L_JoystickClick) == 1; + R_JoyClick_pressed = gamepadButton.get(R_JoystickClick) == 1; + L_JoyClick_pressed = gamepadButton.get(L_JoystickClick) == 1; //up, down, left, right - up_pressed = gamepadButton.get(inputVariables.up) == 1; - down_pressed = gamepadButton.get(inputVariables.down) == 1; - left_pressed = gamepadButton.get(inputVariables.left) == 1; - right_pressed = gamepadButton.get(inputVariables.right) == 1; + up_pressed = gamepadButton.get(up) == 1; + down_pressed = gamepadButton.get(down) == 1; + left_pressed = gamepadButton.get(left) == 1; + right_pressed = gamepadButton.get(right) == 1; //Left Joystick - leftJoyRight = gamepadAxes.get(inputVariables.leftJoyX_Axe) > 0.1; - leftJoyLeft = gamepadAxes.get(inputVariables.leftJoyX_Axe) < -0.1; - leftJoyDown = gamepadAxes.get(inputVariables.leftJoyY_Axe) > 0.1; - leftJoyUp = gamepadAxes.get(inputVariables.leftJoyY_Axe) < -0.1; + leftJoyRight = gamepadAxes.get(leftJoyX_Axe) > 0.1; + leftJoyLeft = gamepadAxes.get(leftJoyX_Axe) < -0.1; + leftJoyDown = gamepadAxes.get(leftJoyY_Axe) > 0.1; + leftJoyUp = gamepadAxes.get(leftJoyY_Axe) < -0.1; //Right Joystick - rightJoyRight = gamepadAxes.get(inputVariables.rightJoyX_Axe) > 0.1; - rightJoyLeft = gamepadAxes.get(inputVariables.rightJoyX_Axe) < -0.1; - rightJoyDown = gamepadAxes.get(inputVariables.rightJoyY_Axe) > 0.1; - rightJoyUp = gamepadAxes.get(inputVariables.rightJoyY_Axe) < -0.1; + rightJoyRight = gamepadAxes.get(rightJoyX_Axe) > 0.1; + rightJoyLeft = gamepadAxes.get(rightJoyX_Axe) < -0.1; + rightJoyDown = gamepadAxes.get(rightJoyY_Axe) > 0.1; + rightJoyUp = gamepadAxes.get(rightJoyY_Axe) < -0.1; //LT RT - LT_pressed = gamepadButton.get(inputVariables.LT) == 1; - RT_pressed = gamepadButton.get(inputVariables.RT) == 1; + LT_pressed = gamepadButton.get(LT) == 1; + RT_pressed = gamepadButton.get(RT) == 1; } public boolean checkPressed(int keyCode){