Skip to content

Jamepad controller implementation

Benjamin Schulte edited this page Dec 20, 2020 · 12 revisions
ℹ️ Note Removed from the repo with v2.3.0 and up, included in gdx-controllers v2, usable with gdx 1.9.11+. If you still need to use an older gdx version, refer to v2.2.1

Thanks to born2snipe for his work on this.

Just change the following lines in your build.gradle's desktop project to switch from libGDX controller implementation to Jamepad:

    compile "com.badlogicgames.gdx:gdx-controllers-desktop:$gdxVersion"
    compile "com.badlogicgames.gdx:gdx-controllers-platform:$gdxVersion:natives-desktop"

to:

    compile "de.golfgl.gdxcontrollerutils:gdx-controllers-jamepad:$cuversion"

This just affects the Desktop project. The implementation is compatible to the libGDX implementations, no code changes in your project needed.

In case your project does not already declare the Jitpack repository, you need to do this as well:

  repositories {
      ...
      maven { url "https://jitpack.io" }
  }

Ups:

  • Hotplugging on Windows!
  • A big controller mapping database which ensures your users probably won't need to remap their buttons
  • Rumble/vibration supported (you need to add gdx-controllers-advanced to your core project to use it) since 0.2.0
  • implements AdvancedController interface

Downs:

  • If a connected controller is not in the mapping database, it is not shown.
  • D-Pad/POV values will be reported as buttons down/up. (Of course, it is just some piece of work to be done to map the D-Pad buttons to POV values)

Work still to be done: