Game Development by Sean

Cross-platform Xbox Gamepad Support

Table of Contents

For those who are interested in using the Xbox Gamepad in cross-platform titles, I’ve written a small library to help out. On Windows it is just a thin wrapper around XInput. On Linux, it uses the native joystick interface provided by the xpad driver. OS X and other platforms are currently missing (I don’t have a Mac to develop on), but I’m very open to contributions (either code or a Mac).

Currently, only the input functions of the Gamepad are supported. Rumble will be added soon. Headset support may or may not be added; I think that most PC users are probably using a better headset than the Xbox one, but for portability to the Xbox itself it is probably a good thing to have. Linux does not support the headset on Xbox controllers yet.

Hotplug on Linux is also currently missing, though I have some prototype code to use to add this support soon. Unfortunately the Linux kernel’s hotplug support for the xpad driver is broken (at least in recent Fedora kernels) so I can’t actually test the code to integrate it yet.

The library is delivered as a single header and a single C source file that you can drop into an existing project.

Gamepad Github page</div>