XInput, MDX and an XBox360 Controller
Sunday, January 15 2006
Over the weekend I was given an XBox 360 Controller although I have not got an XBox 360 yet at least I can still use it with my PC, so I started to play with it. The first problem was that I have not done much with the Managed DirectX Beta systems yet, and there for did not have any working code to play with.
To start with I decided to convert some of my base code that I have to the MDX 2.0 system this worked and has allowed me to get a grip on how to set up the controller. I created a small application that had a base render loop and some text functions, then incorporated the controller code into this application, the resulting test application allows me to press buttons and functions on the controller and have the application react to it.
For those who are interested here is the small application that I put together... (The Application requires the Microsoft DirectX SDK December 2005 release)
The code is ruff but you will see what I have done and how to modify it.
The next step was to go a little deeper and to get a working game or application running, to do this I had to find one. As I am currently reading "Beginning .Net Game Programming in C#" by David Weller, Alexandre Santos Lobao, Ellen Hatton, and Apress, I thought this would be a good start to find a sample. The example that I chose was the Space donuts example (sort of an asteroids clone) and began to convert it to MDX2. I have found several problems with the conversion and will continue to work on them but have decided that they are not show stoppers. These problems included the DirectInput system and getting the System Guid for the device and the TextureLoader functions, for the moment I have removed the need for DirectInput and the keyboard and put together a work around for the loading of the texture. In the end I now have a working game that uses the Xbox360 controller and the XInput systems to control the game elements. I plan on finishing the project and have the system so that it can be controlled by either the Keyboard or the XBox360 controller. When I have finished and cleaned up my code I will try to make it public.
