Game Controller Library   Part of Android Game Development Kit.

The Game Controller library, also known as Paddleboat, helps you implement robust support for game controllers. The library provides the following:

  • Callbacks for detecting controller connections and disconnections
  • Controller device information, including button style and layout
  • Controller input data, standardized around modern dual-stick controller designs
  • Extended features on supported controllers, including vibration, lights, motion axis data, and battery status
  • Ability to read input from virtual and physical mouse devices
  • Ability to specify custom controller mapping data for particular devices

Compatibility requirements

The Game Controller library has minimum compatibility requirements of:

  • Android 4.4 (API level 19) or higher
  • Android NDK version 21 or higher

Integrate

The Game Controller library is distributed in two formats: As a Jetpack library for games using a Gradle-based build system (including Android Studio), and as discrete files for games using custom build systems.

For a sample that integrates the Game Controller library, see the games-samples repository.

Jetpack library

The Jetpack Android Games page has integration instructions to add the Game Controller library dependency to your game's build.gradle file.

The Jetpack library release of Game Controller is a static library built against the C++ runtime shared library.

After updating your build.gradle file, you will need to add the following line to your game's main CMakeLists.txt file:

find_package(games-controller REQUIRED CONFIG)

You will also need to add the following entry to the list of libraries in the target_link_libraries command of your game's main shared library:

games-controller::paddleboat_static

Discrete files

The .zip archive distribution of the Android Game Development Kit includes header and library files for the Game Controller library. The following files must be included in your project to use the Game Controller library:

  • The classes.jar file containing the Dalvik bytecode portions of the Game Controller library. This file is located at libs/classes.jar
  • The paddleboat.h interface header file. This file is located at include/paddleboat/paddleboat.h
  • Either the libpaddleboat.so shared library file or the libpaddleboat-static.a static library file. These files are found in the build configuration subdirectories under the libs directory.

The build configuration subdirectories under the root libs directory are categorized by:

  • ABI architecture
  • Minimum Android API level
  • Android NDK version
  • C++ runtime library version
  • Release or debug build configuration

As an example, the arm64-v8a_API16_NDK21_cpp_shared_Release subdirectory contains library files for:

  • ARM 64-bit ABI
  • Minimum API level 16
  • Built against NDK version 21
  • Built against shared library version of C++ runtime
  • Release build configuration

The libpaddleboat_static.a file is located directly in the subdirectory. The libpaddleboat.so file is located at lib/paddleboat/ within the subdirectory.

Next steps

See the following guides to continue integrating the Game Controller library into your game: