more gamepad stuff

- now have settings files
- now read/write gamepad settings to file
- now map button/axis for gamepads
This commit is contained in:
Diego Waxemberg
2013-12-19 20:31:33 -05:00
parent 6ea16c6283
commit 43df4cf93e
9 changed files with 223 additions and 32 deletions

View File

@@ -104,11 +104,13 @@ public class Gamepad {
}
private void handleComponent(Component comp, float value) {
ControllerComponent contComp = config.getControllerComponent(comp);
if (contComp.isAnalog()) {
handleAnalog(contComp, value);
} else {
handleButtons(contComp, value);
if (config != null) {
ControllerComponent contComp = config.getControllerComponent(comp);
if (contComp.isAnalog()) {
handleAnalog(contComp, value);
} else {
handleButtons(contComp, value);
}
}
}
@@ -147,14 +149,14 @@ public class Gamepad {
break;
}
}
private void handleButtons(ControllerComponent contComp, float value) {
boolean press = false;
if (value > 0.5F) {
press = true;
}
switch (contComp) {
case BTN_A:
toggle(ControllerPacket.A_FLAG, press);