View Full Version : Windows Game controller driver?
Costring
08-11-2006, 10:05 PM
Anyone write a widows driver for any of the boards? I have the 0/16/16 and want to use switches and lights (at least switches) in xplane, but alas no software... I'm a hardware guy, and dont know coding the only thing I can do is hope somebody writes something and shares it. I find it odd that no one has made a game controller driver yet...
imported_Alex
08-14-2006, 08:02 AM
It's too bad you don't know code. It's actually fairly easy to write a class that interacts with a gamepad/joystick, which can then be used to easily interact with your Phidget devices. If you take a look at the attached .ZIP file, and run the shortcut for "CsharpUSBJoystick.exe", you'll see form that interacts with a class that I wrote in C# which utilizes Microsoft's DirectX 9.0.
Obviously I cannot teach you programming, but if you decide that this is too far over your head, show someone else this application that knows programming and ask them if they would write you a custom app using it.
The thing is, is that it is next to impossible to simply write a "universal" driver for a gamepad which can easily be plugged into any project. My class that I wrote exposes many of the features of a DirectX 9.0, but unfortunately cannot be used to control anything with out a custom app being wrapped around it.
alandyer
08-14-2006, 03:36 PM
How does X-plane currently expose its internals to the outside world ?
Not sure if DirectX will make something that ISN'T a joystick look like a joystick.
Last time I played with DirectX was 8 years ago when I wrote a Space Shuttle Simulator, so set me straight if I have it wrong.
imported_Alex
08-15-2006, 05:56 AM
To be more specific, I use DirectInput, which is a DLL inside DirectX 9.0. It has no rendering capabilities (that I'm aware of), and is solely used to interact with real world input devices (Joystick, Gamepad, Steering Wheels, etc.).
DirectInput continuosly polls the DirectX supported input device, retrieving values of most (a lot of times, all) of the components on each device. There is even an option to interact with the force feedback of the joystick, although my example doesn't support this.
The class, USBJoystick.cs, in my example above interacts with two classes of DirectInput: JoystickState and Device. This class exposes the most basic capabilities of DirectInput. There are way too many to mention here. You start by passing into the constructor the range of what you would like your analog components to operate at, the threshold, and the form itself. In my example I chose a range of 0 - 1000, and a threshold of 20%.
There are many examples all over the Net further demonstrating the capabilites of DirectInput. I simply wanted to write a small little class to get people started. What I wrote is very similar to what is contained in the DirectX 9.0 SDK, but I extracted most of the code and created a wrapper class.
We have had tremendous luck with Logitech Joysticks, Gamepads and Wheels. In fact, a joystick we had recently purchased, the Logitech Extreme 3D Pro, I was able to interact with every component on the joystick:
http://www.logitech.com/index.cfm/products/details/US/EN,CRID=2221,CONTENTID=6954
We've also used the XBox 360 controller without a problem. The only button I couldn't retrieve values from was the center X button. I still can't figure that one out...
Costring
08-16-2006, 08:54 PM
Yeah, I dont even need analog support, just my switches. I have a 0/16/16 that I'm using for lights, starters etc... and just want to make a "16 button joystick" driver for this board. I just thought maybe someone made one.