Search in sources :

Example 6 with Controller

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;
    }
}
Also used : Controller(net.java.games.input.Controller)

Example 7 with Controller

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;
    }
}
Also used : Controller(net.java.games.input.Controller)

Aggregations

Controller (net.java.games.input.Controller)7 ArrayDeque (java.util.ArrayDeque)1 Component (net.java.games.input.Component)1 Type (net.java.games.input.Controller.Type)1 ControllerEvent (net.java.games.input.ControllerEvent)1 Event (net.java.games.input.Event)1 EventQueue (net.java.games.input.EventQueue)1 ControllerAction (org.terasology.input.device.ControllerAction)1