Simplification des conditionnels de gamepadInput.java

This commit is contained in:
Antoine 2021-06-01 16:11:36 +02:00
parent 8682d99578
commit b276f1eca4

View File

@ -83,98 +83,50 @@ public class gamepadInput{
// A B X Y // A B X Y
if (gamepadButton.get(ButtonA)==1 ) { buttonA_pressed = gamepadButton.get(ButtonA) == 1;
buttonA_pressed = true; buttonB_pressed = gamepadButton.get(ButtonB) == 1;
}else buttonA_pressed = false; buttonY_pressed = gamepadButton.get(ButtonY) == 1;
if (gamepadButton.get(ButtonB)==1 ) { buttonX_pressed = gamepadButton.get(ButtonX) == 1;
buttonB_pressed = true;
}else buttonB_pressed = false;
if (gamepadButton.get(ButtonY)==1 ) {
buttonY_pressed = true;
}else buttonY_pressed = false;
if (gamepadButton.get(ButtonX)==1 ) {
buttonX_pressed = true;
}else buttonX_pressed = false;
// LB RB // LB RB
if (gamepadButton.get(LB)==1 ) { LB_pressed = gamepadButton.get(LB) == 1;
LB_pressed = true; RB_pressed = gamepadButton.get(RB) == 1;
}else LB_pressed = false;
if (gamepadButton.get(RB)==1 ) {
RB_pressed = true;
}else RB_pressed = false;
//start select //start select
if (gamepadButton.get(start)==1 ) { start_pressed = gamepadButton.get(start) == 1;
start_pressed = true; select_pressed = gamepadButton.get(select) == 1;
}else start_pressed = false;
if (gamepadButton.get(select)==1 ) {
select_pressed = true;
}else select_pressed = false;
//R & L JoystickClick //R & L JoystickClick
if (gamepadButton.get(R_JoyClick)==1 ) { R_JoyClick_pressed = gamepadButton.get(R_JoyClick) == 1;
R_JoyClick_pressed = true; L_JoyClick_pressed = gamepadButton.get(L_JoyClick) == 1;
}else R_JoyClick_pressed = false;
if (gamepadButton.get(L_JoyClick)==1 ) {
L_JoyClick_pressed = true;
}else L_JoyClick_pressed = false;
//up, down, left, right //up, down, left, right
if (gamepadButton.get(up)==1 ) { up_pressed = gamepadButton.get(up) == 1;
up_pressed = true; down_pressed = gamepadButton.get(down) == 1;
}else up_pressed = false; left_pressed = gamepadButton.get(left) == 1;
if (gamepadButton.get(down)==1 ) { right_pressed = gamepadButton.get(right) == 1;
down_pressed = true;
}else down_pressed = false;
if (gamepadButton.get( left)==1 ) {
left_pressed = true;
}else left_pressed = false;
if (gamepadButton.get(right)==1 ) {
right_pressed = true;
}else right_pressed = false;
//Left Joystick //Left Joystick
if (gamepadAxes.get(leftJoyX_Axe)> 0.1 ) { leftJoyRight = gamepadAxes.get(leftJoyX_Axe) > 0.1;
leftJoyRight = true; leftJoyLeft = gamepadAxes.get(leftJoyX_Axe) < -0.1;
}else leftJoyRight = false; leftJoyDown = gamepadAxes.get(leftJoyY_Axe) > 0.1;
if (gamepadAxes.get(leftJoyX_Axe)<-0.1 ) { leftJoyUp = gamepadAxes.get(leftJoyY_Axe) < -0.1;
leftJoyLeft = true;
}else leftJoyLeft = false;
if (gamepadAxes.get(leftJoyY_Axe)> 0.1 ) {
leftJoyDown = true;
}else leftJoyDown = false;
if (gamepadAxes.get(leftJoyY_Axe)<-0.1 ) {
leftJoyUp = true;
}else leftJoyUp = false;
//Right Joystick //Right Joystick
if (gamepadAxes.get(rightJoyX_Axe)> 0.1 ) { rightJoyRight = gamepadAxes.get(rightJoyX_Axe) > 0.1;
rightJoyRight = true; rightJoyLeft = gamepadAxes.get(rightJoyX_Axe) < -0.1;
}else rightJoyRight = false; rightJoyDown = gamepadAxes.get(rightJoyY_Axe) > 0.1;
if (gamepadAxes.get(rightJoyX_Axe)<-0.1 ) { rightJoyUp = gamepadAxes.get(rightJoyY_Axe) < -0.1;
rightJoyLeft = true;
}else rightJoyLeft = false;
if (gamepadAxes.get(rightJoyY_Axe)> 0.1 ) {
rightJoyDown = true;
}else rightJoyDown = false;
if (gamepadAxes.get(rightJoyY_Axe)<-0.1 ) {
rightJoyUp = true;
}else rightJoyUp = false;
//LT RT //LT RT
if (gamepadButton.get(LT)==1 ) { LT_pressed = gamepadButton.get(LT) == 1;
LT_pressed = true; RT_pressed = gamepadButton.get(RT) == 1;
}else LT_pressed = false;
if (gamepadButton.get(RT)==1 ) {
RT_pressed = true;
}else RT_pressed = false;