|
@@ -5,7 +5,7 @@ import java.nio.FloatBuffer;
|
|
|
import static org.lwjgl.glfw.GLFW.*;
|
|
|
|
|
|
public final class Gamepad {
|
|
|
- public static final class GamepadButton {
|
|
|
+ public static final class Button {
|
|
|
private final String name;
|
|
|
private final int mapping;
|
|
|
|
|
@@ -13,7 +13,7 @@ public final class Gamepad {
|
|
|
private int time = 0;
|
|
|
private boolean isReleased = false;
|
|
|
|
|
|
- protected GamepadButton(String name, int mapping) {
|
|
|
+ protected Button(String name, int mapping) {
|
|
|
this.name = name;
|
|
|
this.mapping = mapping;
|
|
|
}
|
|
@@ -58,24 +58,24 @@ public final class Gamepad {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- public final GamepadButton a = new GamepadButton("A", 1);
|
|
|
- public final GamepadButton b = new GamepadButton("B", 2);
|
|
|
- public final GamepadButton x = new GamepadButton("X", 0);
|
|
|
- public final GamepadButton y = new GamepadButton("Y", 3);
|
|
|
- public final GamepadButton l = new GamepadButton("L", 4);
|
|
|
- public final GamepadButton r = new GamepadButton("R", 5);
|
|
|
- public final GamepadButton start = new GamepadButton("Start", 9);
|
|
|
- public final GamepadButton select = new GamepadButton("Select", 8);
|
|
|
- public final GamepadButton left = new GamepadButton("Left", 0);
|
|
|
- public final GamepadButton right = new GamepadButton("Right", 0);
|
|
|
- public final GamepadButton up = new GamepadButton("Up", 1);
|
|
|
- public final GamepadButton down = new GamepadButton("Down", 1);
|
|
|
-
|
|
|
- private final GamepadButton[] buttons = new GamepadButton[]{
|
|
|
+ public final Button a = new Button("A", 1);
|
|
|
+ public final Button b = new Button("B", 2);
|
|
|
+ public final Button x = new Button("X", 0);
|
|
|
+ public final Button y = new Button("Y", 3);
|
|
|
+ public final Button l = new Button("L", 4);
|
|
|
+ public final Button r = new Button("R", 5);
|
|
|
+ public final Button start = new Button("Start", 9);
|
|
|
+ public final Button select = new Button("Select", 8);
|
|
|
+ public final Button left = new Button("Left", 0);
|
|
|
+ public final Button right = new Button("Right", 0);
|
|
|
+ public final Button up = new Button("Up", 1);
|
|
|
+ public final Button down = new Button("Down", 1);
|
|
|
+
|
|
|
+ private final Button[] buttons = new Button[]{
|
|
|
a, b, x, y, l, r, start, select
|
|
|
};
|
|
|
|
|
|
- public final GamepadButton[] bindings = new GamepadButton[]{
|
|
|
+ public final Button[] bindings = new Button[]{
|
|
|
a, b, x, y, l, r, start, select, left, right, up, down
|
|
|
};
|
|
|
|
|
@@ -98,7 +98,7 @@ public final class Gamepad {
|
|
|
if(buttonBuffer == null) {
|
|
|
return;
|
|
|
}
|
|
|
- for(GamepadButton binding : buttons) {
|
|
|
+ for(Button binding : buttons) {
|
|
|
binding.tick(buttonBuffer.get(binding.getMapping()) != 0);
|
|
|
}
|
|
|
}
|