constructor for gamepadInput
This commit is contained in:
parent
b63ee09571
commit
611894537a
@ -220,14 +220,15 @@ public class Engine {
|
|||||||
// Game logic should fit here
|
// Game logic should fit here
|
||||||
|
|
||||||
if (present) { //sprite //bindings
|
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,
|
L_JoystickClick , R_JoystickClick , Up , right , down , left,
|
||||||
leftJoyX_Axe, leftJoyY_Axe, rightJoyX_Axe, rightJoyY_Axe, LT, RT);
|
leftJoyX_Axe, leftJoyY_Axe, rightJoyX_Axe, rightJoyY_Axe, LT, RT);
|
||||||
|
|
||||||
System.out.println( " \n left :" + GamepadInput.leftJoyLeft +
|
System.out.println( " \n left :" + gamepad1.leftJoyLeft +
|
||||||
" \n right :" + GamepadInput.leftJoyRight +
|
" \n right :" + gamepad1.leftJoyRight +
|
||||||
" \n down :" + GamepadInput.leftJoyDown +
|
" \n down :" + gamepad1.leftJoyDown +
|
||||||
" \n up :" + GamepadInput.leftJoyUp);
|
" \n up :" + gamepad1.leftJoyUp);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Input.keyboardInput(zangief, speed);
|
// Input.keyboardInput(zangief, speed);
|
||||||
|
@ -32,41 +32,70 @@ import static org.lwjgl.glfw.GLFW.*;
|
|||||||
|
|
||||||
public class GamepadInput {
|
public class GamepadInput {
|
||||||
|
|
||||||
public static boolean buttonA_pressed = false;
|
public boolean buttonA_pressed ;
|
||||||
public static boolean buttonB_pressed = false;
|
public boolean buttonB_pressed ;
|
||||||
public static boolean buttonY_pressed = false;
|
public boolean buttonY_pressed ;
|
||||||
public static boolean buttonX_pressed = false;
|
public boolean buttonX_pressed;
|
||||||
|
|
||||||
public static boolean LB_pressed = false;
|
public boolean LB_pressed ;
|
||||||
public static boolean RB_pressed = false;
|
public boolean RB_pressed ;
|
||||||
|
|
||||||
public static boolean select_pressed = false;
|
public boolean select_pressed;
|
||||||
public static boolean start_pressed = false;
|
public boolean start_pressed;
|
||||||
|
|
||||||
public static boolean R_JoyClick_pressed = false;
|
public boolean R_JoyClick_pressed;
|
||||||
public static boolean L_JoyClick_pressed = false;
|
public boolean L_JoyClick_pressed;
|
||||||
|
|
||||||
public static boolean up_pressed = false;
|
public boolean up_pressed ;
|
||||||
public static boolean down_pressed = false;
|
public boolean down_pressed;
|
||||||
public static boolean left_pressed = false;
|
public boolean left_pressed ;
|
||||||
public static boolean right_pressed = false;
|
public boolean right_pressed;
|
||||||
|
|
||||||
public static boolean leftJoyRight = false;
|
public boolean leftJoyRight;
|
||||||
public static boolean leftJoyLeft = false;
|
public boolean leftJoyLeft;
|
||||||
public static boolean leftJoyDown = false;
|
public boolean leftJoyDown;
|
||||||
public static boolean leftJoyUp = false;
|
public boolean leftJoyUp;
|
||||||
|
|
||||||
public static boolean rightJoyLeft = false;
|
public boolean rightJoyLeft;
|
||||||
public static boolean rightJoyRight = false;
|
public boolean rightJoyRight;
|
||||||
public static boolean rightJoyDown = false;
|
public boolean rightJoyDown ;
|
||||||
public static boolean rightJoyUp = false;
|
public boolean rightJoyUp;
|
||||||
|
|
||||||
public static boolean LT_pressed = false;
|
public boolean LT_pressed ;
|
||||||
public static boolean RT_pressed = false;
|
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 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
|
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);
|
ByteBuffer gamepadButton = glfwGetJoystickButtons(GLFW_JOYSTICK_1);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user