
Shall I Implement Joystick support on Windows platform
Posted Wednesday, 12 March, 2008 - 11:18 by BlueMonkMN inBecause I'm trying to eliminate all traces of DirectX from SGDK2, I'll be manually implementing joystick support using winmm.dll. I've copied a couple lines from Tao because I didn't know the correct MarshalAs attributes to apply to some strings in the JOYCAPS structure, and a Google search for JOYCAPS returned a page of Tao source code. (Is that kosher?)
Might you be interested in the Joystick class when it's done, or will you be basing Joystick support on something else?


Comments
Re: Shall I Implement Joystick support on Windows platform
I've attached the code I'm working on. It's not 100% ready (works with polling but no events of any kind), but it should be easy to flesh out. It builds on your code for windows.
The idea is quite simple:
You instantiate an IJoystickDriver that enumerates all connected joystick devices. You can then access available joysticks like this:
You have to poll the driver, because the Joystick class is dumb and doesn't know how to update itself (by design).
Edit: really attached this time.
Edit 2: fixed implementation windows, please download the new file!