Cleanup GamepadInput.java
This commit is contained in:
parent
c5883540f8
commit
516f18c99c
@ -39,66 +39,10 @@ public class GamepadInput {
|
||||
private ByteBuffer gamepadButton;
|
||||
private FloatBuffer gamepadAxes;
|
||||
|
||||
public boolean buttonA_pressed ;
|
||||
public boolean buttonB_pressed ;
|
||||
public boolean buttonY_pressed ;
|
||||
public boolean buttonX_pressed;
|
||||
|
||||
public boolean LB_pressed ;
|
||||
public boolean RB_pressed ;
|
||||
|
||||
public boolean select_pressed;
|
||||
public boolean start_pressed;
|
||||
|
||||
public boolean R_JoyClick_pressed;
|
||||
public boolean L_JoyClick_pressed;
|
||||
|
||||
public boolean up_pressed ;
|
||||
public boolean down_pressed;
|
||||
public boolean left_pressed ;
|
||||
public boolean right_pressed;
|
||||
|
||||
public boolean leftJoyRight;
|
||||
public boolean leftJoyLeft;
|
||||
public boolean leftJoyDown;
|
||||
public boolean leftJoyUp;
|
||||
|
||||
public boolean rightJoyLeft;
|
||||
public boolean rightJoyRight;
|
||||
public boolean rightJoyDown ;
|
||||
public boolean rightJoyUp;
|
||||
|
||||
public boolean LT_pressed ;
|
||||
public boolean RT_pressed;
|
||||
|
||||
public GamepadInput (int gamepadNum){
|
||||
this.gamepadNum = gamepadNum;
|
||||
this.gamepadAxes = null;
|
||||
this.gamepadButton = null;
|
||||
this.buttonA_pressed = false;
|
||||
this.buttonB_pressed = false;
|
||||
this.buttonY_pressed = false;
|
||||
this.buttonX_pressed = false;
|
||||
this.LB_pressed = false;
|
||||
this.RB_pressed = false;
|
||||
this.select_pressed = false;
|
||||
this.start_pressed = false;
|
||||
this.R_JoyClick_pressed = false;
|
||||
this.L_JoyClick_pressed = false;
|
||||
this.up_pressed = false;
|
||||
this.down_pressed = false;
|
||||
this.left_pressed = false;
|
||||
this.right_pressed = false;
|
||||
this.leftJoyRight = false;
|
||||
this.leftJoyLeft = false;
|
||||
this.leftJoyDown = false;
|
||||
this.leftJoyUp = false;
|
||||
this.rightJoyLeft = false;
|
||||
this.rightJoyRight = false;
|
||||
this.rightJoyDown = false;
|
||||
this.rightJoyUp = false;
|
||||
this.LT_pressed = false;
|
||||
this.RT_pressed = false;
|
||||
}
|
||||
|
||||
public void inputRefresh() {
|
||||
@ -109,52 +53,6 @@ public class GamepadInput {
|
||||
assert gamepadAxes != null;
|
||||
assert gamepadButton != null;
|
||||
|
||||
|
||||
// A B X Y
|
||||
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(LB) == 1;
|
||||
RB_pressed = gamepadButton.get(RB) == 1;
|
||||
|
||||
|
||||
//start select
|
||||
start_pressed = gamepadButton.get(start) == 1;
|
||||
select_pressed = gamepadButton.get(select) == 1;
|
||||
|
||||
|
||||
//R & L JoystickClick
|
||||
R_JoyClick_pressed = gamepadButton.get(R_JoystickClick) == 1;
|
||||
L_JoyClick_pressed = gamepadButton.get(L_JoystickClick) == 1;
|
||||
|
||||
|
||||
//up, down, left, right
|
||||
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(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(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(LT) == 1;
|
||||
RT_pressed = gamepadButton.get(RT) == 1;
|
||||
}
|
||||
|
||||
public boolean checkPressed(int keyCode){
|
||||
|
Loading…
x
Reference in New Issue
Block a user