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
if (gamepadButton.get(ButtonA)==1 ) {
buttonA_pressed = true;
}else buttonA_pressed = false;
if (gamepadButton.get(ButtonB)==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;
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
if (gamepadButton.get(LB)==1 ) {
LB_pressed = true;
}else LB_pressed = false;
if (gamepadButton.get(RB)==1 ) {
RB_pressed = true;
}else RB_pressed = false;
LB_pressed = gamepadButton.get(LB) == 1;
RB_pressed = gamepadButton.get(RB) == 1;
//start select
if (gamepadButton.get(start)==1 ) {
start_pressed = true;
}else start_pressed = false;
if (gamepadButton.get(select)==1 ) {
select_pressed = true;
}else select_pressed = false;
start_pressed = gamepadButton.get(start) == 1;
select_pressed = gamepadButton.get(select) == 1;
//R & L JoystickClick
if (gamepadButton.get(R_JoyClick)==1 ) {
R_JoyClick_pressed = true;
}else R_JoyClick_pressed = false;
if (gamepadButton.get(L_JoyClick)==1 ) {
L_JoyClick_pressed = true;
}else L_JoyClick_pressed = false;
R_JoyClick_pressed = gamepadButton.get(R_JoyClick) == 1;
L_JoyClick_pressed = gamepadButton.get(L_JoyClick) == 1;
//up, down, left, right
if (gamepadButton.get(up)==1 ) {
up_pressed = true;
}else up_pressed = false;
if (gamepadButton.get(down)==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;
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
if (gamepadAxes.get(leftJoyX_Axe)> 0.1 ) {
leftJoyRight = true;
}else leftJoyRight = false;
if (gamepadAxes.get(leftJoyX_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;
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
if (gamepadAxes.get(rightJoyX_Axe)> 0.1 ) {
rightJoyRight = true;
}else rightJoyRight = false;
if (gamepadAxes.get(rightJoyX_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;
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
if (gamepadButton.get(LT)==1 ) {
LT_pressed = true;
}else LT_pressed = false;
if (gamepadButton.get(RT)==1 ) {
RT_pressed = true;
}else RT_pressed = false;
LT_pressed = gamepadButton.get(LT) == 1;
RT_pressed = gamepadButton.get(RT) == 1;