|Project:||The Open Toolkit library|
I just committed support for joystick devices to trunk.
The Windows implementation is based in Win MM, while the Linux implementation reads events from the /dev/input/* device nodes. In theory, this means joystick input can be used independently, without using a GameWindow, GLControl, etc. In practice, it is necessary to change the interface around a bit before this will work right, so it's not implemented right now.
I have not touched the Mac OS X implementation, apart from making sure the library compiles. Kanato, if you have the time, can you please look into this? The code on Windows and Linux was surprisingly simple: discover devices, create a JoystickDevice for each device (where T is a platform-specific structure that contains extra device information, if necessary) and implement the Poll() function to update state with the JoystickDevice.SetAxis/.SetButton methods.
The question is, how can we handle the case where a device is disconnected or connected after initialization? Right now, devices are only discovered upon initialization, which is consistent with most libraries and games out there.
Also, does it make sense to write a Raw Input driver for windows? WinMM is limited in that it only supports 6 axes - are there joysticks out there with more than that?
Edit: Should use the real, hardware dependent joystick name in JoystickDevice.Description.
Edit 2: The implementation provides normalized axis coordinates, in the [-1, 1] range. Left and down are in the negative range, while up and right are in the positive.