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 0885b876d5
commit c414fca5af
9 changed files with 223 additions and 32 deletions

View File

@@ -6,6 +6,7 @@ import java.util.LinkedList;
import java.util.List;
import com.limelight.nvstream.NvConnection;
import com.limelight.settings.GamepadSettingsManager;
import net.java.games.input.Controller;
@@ -18,9 +19,11 @@ public class GamepadHandler {
gamepads.clear();
GamepadSettings settings = GamepadSettingsManager.getSettings();
for (Controller pad : pads) {
gamepads.add(new Gamepad(pad, null)); //TODO: need to create/get the settings for this controller
gamepads.add(new Gamepad(pad, settings));
}
}
@@ -34,6 +37,7 @@ public class GamepadHandler {
public static void startUp() {
if (handler == null || !handler.isAlive()) {
System.out.println("Gamepad Handler thread starting up");
handler = new Thread(new Runnable() {
@Override
public void run() {
@@ -42,6 +46,7 @@ public class GamepadHandler {
if (!gamepad.poll()) {
break;
}
gamepad.handleEvents(conn);
}
try {
@@ -56,6 +61,7 @@ public class GamepadHandler {
public static void stopHandler() {
if (handler != null && handler.isAlive()) {
System.out.println("Stopping Gamepad Handler thread");
handler.interrupt();
conn = null;
}