O'Reilly logo

Game Programming using Qt 5 Beginner's Guide - Second Edition by Lorenz Haas, Witold Wysota, Pavel Strakhov

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Working with gamepads in Qt

The starting point of the gamepad API is the QGamepadManager class. The singleton object of this class can be obtained using the QGamepadManager::instance() function. It allows you to request the list of identifiers of the available gamepads using the connectedGamepads() function. The gamepadConnected() signal can be used to detect new gamepads on the fly. QGamepadManager also provides API for configuring buttons and axes on the gamepad and is able to save the configuration to the specified settings file.

After you detected that one or multiple gamepads are available in the system, you should create a new QGamepad object and pass the obtained device identifier as a constructor's argument. You can use the first ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required