GamepadInput
This commit is contained in:
parent
b276f1eca4
commit
6dcd7feda5
@ -2,7 +2,7 @@ package engine;
|
|||||||
|
|
||||||
import engine.input.Input;
|
import engine.input.Input;
|
||||||
//import engine.input.gamepadInput;
|
//import engine.input.gamepadInput;
|
||||||
import engine.input.gamepadInput;
|
import engine.input.GamepadInput;
|
||||||
import engine.math.*;
|
import engine.math.*;
|
||||||
import engine.object.*;
|
import engine.object.*;
|
||||||
import engine.sound.*;
|
import engine.sound.*;
|
||||||
@ -220,14 +220,14 @@ public class Engine {
|
|||||||
// Game logic should fit here
|
// Game logic should fit here
|
||||||
|
|
||||||
if (present) { //sprite //bindings
|
if (present) { //sprite //bindings
|
||||||
gamepadInput.gamepad(zangief, speed, buttonA, buttonB, buttonX, buttonY, LB, RB , select , start ,
|
GamepadInput.gamepad(zangief, speed, 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 :" + GamepadInput.leftJoyLeft +
|
||||||
" \n right :" + gamepadInput.leftJoyRight +
|
" \n right :" + GamepadInput.leftJoyRight +
|
||||||
" \n down :" + gamepadInput.leftJoyDown +
|
" \n down :" + GamepadInput.leftJoyDown +
|
||||||
" \n up :" + gamepadInput.leftJoyUp);
|
" \n up :" + GamepadInput.leftJoyUp);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Input.keyboardInput(zangief, speed);
|
// Input.keyboardInput(zangief, speed);
|
||||||
|
26
src/engine/input/Button.java
Normal file
26
src/engine/input/Button.java
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
package engine.input;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class Button {
|
||||||
|
|
||||||
|
public String name;
|
||||||
|
private final List<Integer> buttons;
|
||||||
|
|
||||||
|
public Button(String name, List<Integer> buttons, GamepadInput controller){
|
||||||
|
this.name = name;
|
||||||
|
this.buttons = buttons;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addButton(int key){
|
||||||
|
this.buttons.add(key);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isButtonPressed(){
|
||||||
|
for (int i : buttons){
|
||||||
|
GamepadInput.checkPressed(i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -36,7 +36,7 @@ import static org.lwjgl.opengl.GL11.*;
|
|||||||
5: R2 /RT : 1 active, -1 unactive
|
5: R2 /RT : 1 active, -1 unactive
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class gamepadInput{
|
public class GamepadInput {
|
||||||
|
|
||||||
public static boolean buttonA_pressed = false;
|
public static boolean buttonA_pressed = false;
|
||||||
public static boolean buttonB_pressed = false;
|
public static boolean buttonB_pressed = false;
|
||||||
@ -128,8 +128,6 @@ public class gamepadInput{
|
|||||||
LT_pressed = gamepadButton.get(LT) == 1;
|
LT_pressed = gamepadButton.get(LT) == 1;
|
||||||
RT_pressed = gamepadButton.get(RT) == 1;
|
RT_pressed = gamepadButton.get(RT) == 1;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user