Search code examples
javacontrollerlwjglglfw

GLFW doesn't recognize Xbox Controller


LWJGL version: 3.1.4 build 8
GLFW version: 3.3.0 Win32 WGL EGL VisualC DLL

The controller shows up in the device manager as Xbox Controller under Xbox Peripherals and seems to be working fine in games.

However, trying glfwJoystickPresent() only returns false:

for (int joy = GLFW_JOYSTICK_1; joy<=GLFW_JOYSTICK_LAST;joy++) {    
    System.out.println(joy+": "+glfwJoystickPresent(joy))
}

Is the Xbox One controller not supported? Is there faulty hardware at play? Is there anything else I'm missing?

Edit: This is my complete code:

import static org.lwjgl.glfw.GLFW.*;

public class FuckingControllerInput {
    public static void main(String[] args) {        
        System.out.println(Version.getVersion());
        System.out.println(glfwGetVersionString());
        for (int joy = GLFW_JOYSTICK_1; joy<=GLFW_JOYSTICK_LAST;joy++) {
            System.out.println(joy+": "+glfwJoystickPresent(joy));
        }       
    }
}

Solution

  • XBox controllers should be supported, there were some conversations here talking about it

    http://www.java-gaming.org/topics/glfw-controller-database/37754/view.html

    With out you posting any other code or providing more details of your controller it is hard to tell what is wrong. Try the controller test program in the link to see if you get recognition of your controller. Other people definitely have had luck with xbox controllers.