GLFW_JOYSTICK_N envoyé depuis le constructeur
This commit is contained in:
parent
51733a2e6a
commit
f4b7d5752d
@ -216,7 +216,7 @@ public class Engine {
|
||||
// Game logic should fit here
|
||||
|
||||
if (present) { //sprite //bindings
|
||||
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);
|
||||
GamepadInput gamepad1 = new GamepadInput(GLFW_JOYSTICK_1, 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();
|
||||
|
||||
System.out.println( " \n left :" + gamepad1.leftJoyLeft +
|
||||
|
@ -3,8 +3,6 @@ package engine.input;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.FloatBuffer;
|
||||
|
||||
import engine.Engine;
|
||||
|
||||
import static engine.input.inputVariables.*;
|
||||
import static org.lwjgl.glfw.GLFW.*;
|
||||
/* Buttons
|
||||
@ -34,6 +32,8 @@ import static org.lwjgl.glfw.GLFW.*;
|
||||
*/
|
||||
|
||||
public class GamepadInput {
|
||||
|
||||
private final int gamepadNum;
|
||||
|
||||
public boolean buttonA_pressed ;
|
||||
public boolean buttonB_pressed ;
|
||||
@ -67,11 +67,11 @@ public class GamepadInput {
|
||||
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,
|
||||
public GamepadInput (int gamepadNum, 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.gamepadNum = gamepadNum;
|
||||
this.buttonA_pressed = buttonA_pressed;
|
||||
this.buttonB_pressed = buttonB_pressed;
|
||||
this.buttonY_pressed = buttonY_pressed;
|
||||
@ -99,8 +99,8 @@ public class GamepadInput {
|
||||
}
|
||||
|
||||
public void inputRefresh() {
|
||||
ByteBuffer gamepadButton = glfwGetJoystickButtons(GLFW_JOYSTICK_1);
|
||||
FloatBuffer gamepadAxes = glfwGetJoystickAxes(GLFW_JOYSTICK_1);
|
||||
ByteBuffer gamepadButton = glfwGetJoystickButtons(this.gamepadNum);
|
||||
FloatBuffer gamepadAxes = glfwGetJoystickAxes(this.gamepadNum);
|
||||
|
||||
assert gamepadAxes != null;
|
||||
assert gamepadButton != null;
|
||||
|
Loading…
x
Reference in New Issue
Block a user