use of net.java.games.input.Controller in project j6dof-flight-sim by chris-ali.
the class Joystick method searchForControlDevices.
/**
* Search for and add controllers of type Controller.Type.STICK or Controller.Type.GAMEPAD
* to controlDeviceList
*/
@Override
public void searchForControlDevices() {
Controller[] controllers = ControllerEnvironment.getDefaultEnvironment().getControllers();
controlDeviceList = new ArrayList<>();
for (Controller controller : controllers) {
if (controller.getType() == Controller.Type.STICK || controller.getType() == Controller.Type.GAMEPAD) {
logger.debug("Found a joystick: " + controller.getName());
controlDeviceList.add(controller);
}
}
if (controlDeviceList.isEmpty()) {
logger.error("No joysticks found!");
return;
}
}
use of net.java.games.input.Controller in project j6dof-flight-sim by chris-ali.
the class Mouse method searchForControlDevices.
/**
* Search for and add controllers of type Controller.Type.MOUSE to controlDeviceList
*/
@Override
public void searchForControlDevices() {
Controller[] controllers = ControllerEnvironment.getDefaultEnvironment().getControllers();
controlDeviceList = new ArrayList<>();
for (Controller controller : controllers) {
if (controller.getType() == Controller.Type.MOUSE)
controlDeviceList.add(controller);
}
if (controlDeviceList.isEmpty()) {
logger.error("No mice found!");
return;
}
}
Aggregations