Skip to content

Commit

Permalink
⟴Env checks in GamepadInputDeviceServiceFactory. Affects #248.
Browse files Browse the repository at this point in the history
  • Loading branch information
cjritola committed Jun 19, 2018
1 parent 70ea839 commit e4af1e0
Showing 1 changed file with 11 additions and 8 deletions.
Expand Up @@ -61,14 +61,17 @@ public GamepadInputDeviceService(){
System.setProperty("net.java.games.input.librarypath", new File("DeleteMe").getAbsolutePath());
}catch(Exception e){e.printStackTrace();}
this.controllerEnvironment = ControllerEnvironment.getDefaultEnvironment();
//Filter out the keyboards in favor of AWT's event-based tracking
for(Controller controller:controllerEnvironment.getControllers()){
final Type type = controller.getType();
if( type != Controller.Type.KEYBOARD &&
type != Controller.Type.MOUSE &&
type != Controller.Type.TRACKBALL)
inputDevices.add(new GamepadInputDevice(controller));
}//end for(controller types)
if(controllerEnvironment.isSupported()){
//Filter out the keyboards in favor of AWT's event-based tracking
for(Controller controller:controllerEnvironment.getControllers()){
final Type type = controller.getType();
if( type != Controller.Type.KEYBOARD &&
type != Controller.Type.MOUSE &&
type != Controller.Type.TRACKBALL)
inputDevices.add(new GamepadInputDevice(controller));
}//end for(controller types)
}//end if(controllerEnvironment.isSupported())
else System.err.println("GamepadInputDeviceServiceFactory() WARNING: jInput indicates environment not supported. There will be no Gamepad controller support by this Feature.");
}//end constructor

private class GamepadInputDevice implements InputDevice{
Expand Down

0 comments on commit e4af1e0

Please sign in to comment.