Search code examples
inputlwjgljoystick

Reading PS3 Controller with LWJGL/JInput


I've been working on a project with the LWJGL for a while now and now I'm trying to add joystick support. I have a PS3 controller plugged into a USB port and the following method that gets called in every game loop.

public synchronized void handleControllerEvents() {
    for (Controller controller : ControllerEnvironment
            .getDefaultEnvironment().getControllers()) {
        System.out.println(controller.getName());
        controller.poll();
        EventQueue eventQueue = controller.getEventQueue();
        Event event = new Event();
        while (eventQueue.getNextEvent(event)) {
            System.out.println(event);
        }
    }
}

The PS3 controllers name gets printed but I see no events coming out of it. Every other input device is detected and generates events.


Solution

  • A bit outdated but it was the topmost search result.

    A PS3 controller will not automagically work on your Windows PC. You will have to use a tool for this. For example: -DS3 Tool

    I'm currently using this with my bluetooth PS3 controller. Works splendid.