-
Notifications
You must be signed in to change notification settings - Fork 14
Migrate from v1
If you use gdx-controllers 1.9.x in your projects, there are some things to change for gdx-controllers 2.x.
Note: You can still continue to work with gdx-controllers 1.9.11 for the time being. If you do so, you miss the following new features:
- Reliable mappings on all supported platforms
- Hotplugging on all supported platforms
- Vibration on most platforms
- Controller feature query methods
In the past, gdx-controllers was an embedded project within the libGDX repository. Because of this, releases were done when libGDX was released, irrespective of changes made. gdx-controllers 2.x is an own project decoupled from main libGDX release cycle. Because of that, you have to change your gradle dependencies from something like
compile "com.badlogicgames.gdx:gdx-controllers:$gdxVersion"
to something like
compile "com.badlogicgames.gdx-controllers:gdx-controllers-core:$gdxControllerVersion"
See the main page for all needed artifacts.
We removed the static mappings for Xbox controllers that were needed in the past. These mapping files were platform-dependant and are not needed any more. You can retrieve a default mapping with Controller.getMapping()
on every platform.
gdx-controllers 1.9.x had three different controller input types: buttons (pressed or not pressed), axis (value range from -1f to 1f) and Pov (direction input with states center, west, north, east, south, northwest and so on). We removed the Pov concept. Most platforms do not know about such a concept and only map on axis and button inputs, so on most platforms a certain axis or some buttons identified as D-Pad axis/buttons were mapped to the Pov. In practice, this leaded to doubled mappings: because you couldn't rely on that mapping, you had to support axis, button and pov input if you wanted to implement d-pad input.
If you support pov-based input in your game, you can now retrieve state of d-pad buttons with getButton(getMapping().buttonDpad...)
.
No platform implemented slider and accelerometer input, that's why these methods were removed. If a slider is available, it is mapped on an axis.