Using Game Pads and Joysticks for User Input

While the basic idea of the joystick device is quite similar to the mouse and keyboard (since they do share the same device class), there are a few other things that need to happen for these, since they are much less standardized. You can pretty much guarantee that there will be two buttons on a mouse, and the keyboard will have at least 36 keys. Joysticks and game pads, on the other hand, come in all shapes and sizes. You may have one with two axes and two buttons, and then another with 3 axes, 10 buttons, two throttles, a pedal, and who knows what else.

There's also no default SystemGuid member for creating a joystick. You will need to enumerate the joysticks first. Update the device creation function ...

Get Managed DirectX® 9 Kick Start: Graphics and Game Programming now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.