constructor for gamepadInput

This commit is contained in:
Léo 2021-06-01 19:23:33 +02:00
parent b63ee09571
commit 611894537a
2 changed files with 61 additions and 31 deletions

View File

@ -220,14 +220,15 @@ public class Engine {
// Game logic should fit here
if (present) { //sprite //bindings
GamepadInput.inputRefresh(buttonA, buttonB, buttonX, buttonY, LB, RB , select , start ,
GamepadInput gamepad1 = new GamepadInput(false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false);
gamepad1.inputRefresh(buttonA, buttonB, buttonX, buttonY, LB, RB , select , start ,
L_JoystickClick , R_JoystickClick , Up , right , down , left,
leftJoyX_Axe, leftJoyY_Axe, rightJoyX_Axe, rightJoyY_Axe, LT, RT);
System.out.println( " \n left :" + GamepadInput.leftJoyLeft +
" \n right :" + GamepadInput.leftJoyRight +
" \n down :" + GamepadInput.leftJoyDown +
" \n up :" + GamepadInput.leftJoyUp);
System.out.println( " \n left :" + gamepad1.leftJoyLeft +
" \n right :" + gamepad1.leftJoyRight +
" \n down :" + gamepad1.leftJoyDown +
" \n up :" + gamepad1.leftJoyUp);
}
// Input.keyboardInput(zangief, speed);

View File

@ -32,41 +32,70 @@ import static org.lwjgl.glfw.GLFW.*;
public class GamepadInput {
public static boolean buttonA_pressed = false;
public static boolean buttonB_pressed = false;
public static boolean buttonY_pressed = false;
public static boolean buttonX_pressed = false;
public boolean buttonA_pressed ;
public boolean buttonB_pressed ;
public boolean buttonY_pressed ;
public boolean buttonX_pressed;
public static boolean LB_pressed = false;
public static boolean RB_pressed = false;
public boolean LB_pressed ;
public boolean RB_pressed ;
public static boolean select_pressed = false;
public static boolean start_pressed = false;
public boolean select_pressed;
public boolean start_pressed;
public static boolean R_JoyClick_pressed = false;
public static boolean L_JoyClick_pressed = false;
public boolean R_JoyClick_pressed;
public boolean L_JoyClick_pressed;
public static boolean up_pressed = false;
public static boolean down_pressed = false;
public static boolean left_pressed = false;
public static boolean right_pressed = false;
public boolean up_pressed ;
public boolean down_pressed;
public boolean left_pressed ;
public boolean right_pressed;
public static boolean leftJoyRight = false;
public static boolean leftJoyLeft = false;
public static boolean leftJoyDown = false;
public static boolean leftJoyUp = false;
public boolean leftJoyRight;
public boolean leftJoyLeft;
public boolean leftJoyDown;
public boolean leftJoyUp;
public static boolean rightJoyLeft = false;
public static boolean rightJoyRight = false;
public static boolean rightJoyDown = false;
public static boolean rightJoyUp = false;
public boolean rightJoyLeft;
public boolean rightJoyRight;
public boolean rightJoyDown ;
public boolean rightJoyUp;
public static boolean LT_pressed = false;
public static boolean RT_pressed = false;
public boolean LT_pressed ;
public boolean RT_pressed;
public GamepadInput (boolean buttonA_pressed,boolean buttonB_pressed,boolean buttonY_pressed, boolean buttonX_pressed, boolean LB_pressed,
boolean RB_pressed, boolean select_pressed, boolean start_pressed,boolean R_JoyClick_pressed, boolean L_JoyClick_pressed , boolean up_pressed,
boolean down_pressed,boolean left_pressed,boolean right_pressed,boolean leftJoyRight,boolean leftJoyLeft,boolean leftJoyDown, boolean leftJoyUp,
boolean rightJoyLeft, boolean rightJoyRight, boolean rightJoyDown,boolean rightJoyUp,boolean LT_pressed, boolean RT_pressed){
this.buttonA_pressed = buttonA_pressed;
this.buttonB_pressed = buttonB_pressed;
this.buttonY_pressed = buttonY_pressed;
this.buttonX_pressed =buttonX_pressed;
this.LB_pressed =LB_pressed;
this.RB_pressed =RB_pressed;
this.select_pressed =select_pressed;
this.start_pressed =start_pressed;
this.R_JoyClick_pressed =R_JoyClick_pressed;
this.L_JoyClick_pressed =L_JoyClick_pressed;
this.up_pressed =up_pressed;
this.down_pressed =down_pressed;
this.left_pressed =left_pressed;
this.right_pressed =right_pressed;
this.leftJoyRight =leftJoyRight;
this.leftJoyLeft =leftJoyLeft;
this.leftJoyDown =leftJoyDown;
this.leftJoyUp =leftJoyUp;
this.rightJoyLeft =rightJoyLeft;
this.rightJoyRight =rightJoyRight;
this.rightJoyDown =rightJoyDown;
this.rightJoyUp =rightJoyUp;
this.LT_pressed =LT_pressed;
this.RT_pressed =RT_pressed;
}
public static void inputRefresh(int ButtonA, int ButtonB, int ButtonX, int ButtonY, int LB, int RB ,
public void inputRefresh(int ButtonA, int ButtonB, int ButtonX, int ButtonY, int LB, int RB ,
int select , int start , int L_JoyClick , int R_JoyClick , int up , int right , int down , int left,
int leftJoyX_Axe, int leftJoyY_Axe, int rightJoyX_Axe, int rightJoyY_Axe, int LT, int RT) { //to update for more controlBinding
ByteBuffer gamepadButton = glfwGetJoystickButtons(GLFW_JOYSTICK_1);