Windows 8 provides native support for the Xbox 360 Controller. In most cases this will be wired; however, a wireless dongle can be acquired to allow standard wireless controllers to be used with a PC. A simple to use C API is provided that allows you to work with multiple controllers, retrieve states, and set the vibration motors on the controller so that physical feedback can be provided to the player, as required in the game.
XInput, the API for the Xbox 360 Controller, is your best option for adding GamePad support, and to get started with it we just need to include a single include file and link a static library. Inside
pch.h, we'll add the following lines of code:
#include <Xinput.h> #pragma comment(lib, "Xinput.lib")
Now we can ...