Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 20 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,37 +11,40 @@ Use game controllers with ease in your libGDX games.
The recommended way to use gdx-controllers is via dependency management with Gradle or Maven. Artifacts are available in
[Snapshot Repository](https://oss.sonatype.org/content/repositories/snapshots/com/badlogicgames/gdx-controllers/) and Maven Central.

[![Sonatype Nexus (Releases)](https://img.shields.io/nexus/r/com.badlogicgames.gdx-controllers/gdx-controllers-core?nexusVersion=2&server=https%3A%2F%2Foss.sonatype.org&label=release)](https://search.maven.org/artifact/com.badlogicgames.gdx-controllers/gdx-controllers-core)
[![Sonatype Nexus (Snapshots)](https://img.shields.io/nexus/s/com.badlogicgames.gdx-controllers/gdx-controllers-core?server=https%3A%2F%2Foss.sonatype.org&label=snapshot)](https://oss.sonatype.org/#nexus-search;gav~com.badlogicgames.gdx-controllers~gdx-controllers-core)
[![MvnRepository](https://badges.mvnrepository.com/badge/com.badlogicgames.gdx-controllers/gdx-controllers-core/badge.svg?label=MvnRepository)](https://mvnrepository.com/artifact/com.badlogicgames.gdx-controllers/gdx-controllers-core)

*project-root/build.gradle:*

ext {
gdxControllersVersion = '2.0.1' // see badges above for latest versions
}
```kotlin
ext {
gdxControllersVersion = '2.2.4' // see badges above for latest versions
}
```

Add the following dependencies:

#### core:
```
```kotlin
implementation "com.badlogicgames.gdx-controllers:gdx-controllers-core:$gdxControllersVersion"
```
#### desktop:
```
```kotlin
implementation "com.badlogicgames.gdx-controllers:gdx-controllers-desktop:$gdxControllersVersion"
```

This will automatically fetch the [underlying SDL-based natives and Java wrappers](https://github.com/libgdx/Jamepad).
If you want to use a newer version, add the dependency yourself:

implementation("com.badlogicgames.jamepad:jamepad:$jamepadVersion") {
exclude group: 'com.badlogicgames.gdx', module: 'gdx-jnigen-loader'
}
```kotlin
implementation("com.badlogicgames.jamepad:jamepad:$jamepadVersion") {
exclude group: 'com.badlogicgames.gdx', module: 'gdx-jnigen-loader'
}
```

Make sure to check the [compatibility doc](https://github.com/libgdx/gdx-controllers/wiki/Compatibility) when doing so.

#### android:
```
```kotlin
implementation "com.badlogicgames.gdx-controllers:gdx-controllers-android:$gdxControllersVersion"
```
Proguard setting:
Expand All @@ -50,26 +53,26 @@ Proguard setting:
```

#### ios:
```
```kotlin
implementation "com.badlogicgames.gdx-controllers:gdx-controllers-ios:$gdxControllersVersion"
```
`robovml.xml` needs the following lines added to `forceLinkClasses` and `frameworks`:
```
```xml
<pattern>com.badlogic.gdx.controllers.IosControllerManager</pattern>
....
<framework>GameController</framework>
<framework>GameController</framework>
```
If you forget to explicitly link the framework, no game controller will show up.

#### html:
```
```kotlin
implementation "com.badlogicgames.gdx-controllers:gdx-controllers-core:$gdxControllersVersion:sources"
implementation "com.badlogicgames.gdx-controllers:gdx-controllers-gwt:$gdxControllersVersion:sources"
```
You also need to add the following file to your GdxDefinition.gwt.xml in your html project:
```
```xml
<inherits name="com.badlogic.gdx.controllers" />
<inherits name="com.badlogic.gdx.controllers.controllers-gwt"/>
<inherits name="com.badlogic.gdx.controllers.controllers-gwt" />
```

### Building from source
Expand Down