
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'd be very interested in this class, indeed!
Reusing code from Tao is no problem (MIT/X11 license rocks). The only restriction is that you have to keep the original license intact, if you copy "significant portions" of the source code (e.g. take the whole file and make a couple of changes).
If you encounter any problems e.g. with p/invokes, make a post here and I'll help.
Edit: By the way, I think it's awesome that SGDK will use OpenTK. I've seen this project in the past and it looks very interesting - only problem being it was tied to Windows and the old MDX runtime.
Re: Shall I Implement Joystick support on Windows platform
Here's what I've got:
Re: Shall I Implement Joystick support on Windows platform
My GetDeviceCount function was a little silly. Here's a slightly more intelligent version:
Re: Shall I Implement Joystick support on Windows platform
Thanks for the code, this helps quite a lot.
Do you know if there are any limitations in winmm.dll that we should be aware of? Is there any reason to implement a Raw Input driver besides this (apart from rumble/force-feedback support?)
Re: Shall I Implement Joystick support on Windows platform
I'm afraid I don't have any inside scoop on winmm. I was just going for a quick and simple implementation, so I didn't do much research, and don't have much experience with winmm.dll. Maybe someone else will chime in with details if there's anything important to be aware of.
Re: Shall I Implement Joystick support on Windows platform
One more correction:
0 == joyGetDevCaps
should be
0 != joyGetDevCaps
Re: Shall I Implement Joystick support on Windows platform
Nice, thanks. I'll be adding this code to 0.9.1, but it won't be enabled for the release (need to port it to X11 and test it, first).
Re: Shall I Implement Joystick support on Windows platform
Did Joystick support ever make it into OpenTK? I'm not seeing much there.
Re: Shall I Implement Joystick support on Windows platform
There's no joystick support at this point. I am working on a linux joystick driver, but progress is slow since I don't plan to use this functionality in the immediate future.
Edit: It was surprisingly simple to add joystick support for linux, so I'll be merging the code at some point in the near future.
Re: Shall I Implement Joystick support on Windows platform
Could you give me a clue how to access the joystick from Linux MonoDevelop in C#? I was going to use similar code in my project (at least until OpenTK makes it available, but I know in the case of keyboard access, I had to write my own code because I'm not using GameWindow).