Jonathan
Jonathan

Reputation: 216

How do I access the Joystick on windows in a non-deprecated way?

I want to write a Windows application which accesses the joystick. It is just a very simple application which reads the values and sends them to a server, so I am not using any game programming framework. However, I am confused about which API to use.

I looked at the Multimedia Joystick API, but this is described as superseded by DirectInput. So I looked at DirectInput, but this is also deprecated in favour of XInput. However the XInput documentation talks only about Xbox360 controllers, and says it does not support "legacy DirectInput devices".

Have Microsoft consigned the entire HID Joystick usage type to the dustbin and given up on supporting them in favour of their own proprietary controller products, or am I missing something?

Upvotes: 8

Views: 2455

Answers (1)

Zomby
Zomby

Reputation: 174

The most common solution is to use a combination of XInput and DirectInput so your application can properly access both type of devices. Microsoft even provides instructions on how to do this.

Please note that DirectInput is not available for Windows Store apps so if you intend to distribute through there, that's not an option.

XInput devices like the XBox 360 controller will also work with DirectInput but with some limitations. Notably, the left and right trigger will be mapped to the same axis instead of being independents, and vibration effects will not be available.

Upvotes: 2

Related Questions