Search in sources :

Example 1 with ControllerEnvironment

use of net.java.games.input.ControllerEnvironment in project lwjgl by LWJGL.

the class Controllers method create.

/**
	 * Initialise the controllers collection
	 *
	 * @throws LWJGLException Indicates a failure to initialise the controller library.
	 */
public static void create() throws LWJGLException {
    if (created)
        return;
    try {
        ControllerEnvironment env = ControllerEnvironment.getDefaultEnvironment();
        net.java.games.input.Controller[] found = env.getControllers();
        ArrayList<net.java.games.input.Controller> lollers = new ArrayList<net.java.games.input.Controller>();
        for (net.java.games.input.Controller c : found) {
            if ((!c.getType().equals(net.java.games.input.Controller.Type.KEYBOARD)) && (!c.getType().equals(net.java.games.input.Controller.Type.MOUSE))) {
                lollers.add(c);
            }
        }
        for (net.java.games.input.Controller c : lollers) {
            createController(c);
        }
        created = true;
    } catch (Throwable e) {
        throw new LWJGLException("Failed to initialise controllers", e);
    }
}
Also used : ControllerEnvironment(net.java.games.input.ControllerEnvironment) ArrayList(java.util.ArrayList) LWJGLException(org.lwjgl.LWJGLException)

Aggregations

ArrayList (java.util.ArrayList)1 ControllerEnvironment (net.java.games.input.ControllerEnvironment)1 LWJGLException (org.lwjgl.LWJGLException)1