Hi. I’ve been trying to make JInput work but it doesn’t even recognize my controllers.
This is the .java I’m using:
import net.java.games.input.Controller;
import net.java.games.input.ControllerEnvironment;
/** A simple application that lists the available
-
input controllers
-
@author Robert Schuster
*/
public class ListControllers {/** Lists the available controllers * * @param args */ public static void main(String[] args) { /* access the default controller environment * which contains all identified controllers */ ControllerEnvironment ce = ControllerEnvironment.getDefaultEnvironment(); // retrieve the available controllers Controller[] controllers = ce.getControllers(); System.out.println(controllers.length); // iterate through all controllers and show their index, name and type for (int i = 0; i < controllers.length; i++) { System.out.println( i + " - " + controllers[i].getName() + " (" + controllers[i].getType() + ")"); } }
}