more gamepad changes

- now have a menu bar to access settings
- now handle user input to assign mappings
- fixed some typos
- now properly shutdown controller threads on exit
- renamed GamepadSettings to GamepadMapping
- created a lock to ensure we do not add/remove gamepads from the list while we are handling their events
- fixed settings directory booch
This commit is contained in:
Diego Waxemberg
2013-12-20 13:00:30 -05:00
parent 43df4cf93e
commit ba0b84f9e5
10 changed files with 184 additions and 80 deletions

View File

@@ -10,7 +10,7 @@ import net.java.games.input.EventQueue;
public class Gamepad {
private Controller pad;
private GamepadSettings config;
private GamepadMapping config;
private short inputMap = 0x0000;
private byte leftTrigger = 0x00;
@@ -20,7 +20,7 @@ public class Gamepad {
private short leftStickX = 0x0000;
private short leftStickY = 0x0000;
public Gamepad(Controller pad, GamepadSettings settings) {
public Gamepad(Controller pad, GamepadMapping settings) {
this.config = settings;
this.pad = pad;
@@ -29,7 +29,7 @@ public class Gamepad {
}
}
public GamepadSettings getConfiguration() {
public GamepadMapping getConfiguration() {
return config;
}
@@ -104,8 +104,8 @@ public class Gamepad {
}
private void handleComponent(Component comp, float value) {
if (config != null) {
ControllerComponent contComp = config.getControllerComponent(comp);
ControllerComponent contComp = config.getControllerComponent(comp);
if (contComp != null) {
if (contComp.isAnalog()) {
handleAnalog(contComp, value);
} else {