Who we are

We are the developers of Plastic SCM, a full version control stack (not a Git variant). We work on the strongest branching and merging you can find, and a core that doesn't cringe with huge binaries and repos. We also develop the GUIs, mergetools and everything needed to give you the full version control stack.

If you want to give it a try, download it from here.

We also code SemanticMerge, and the gmaster Git client.

Using a gamepad for development?

Monday, April 09, 2007 Pablo Santos 3 Comments

Last weekend I had the chance to spend some time playing with two really interesting gaming consoles: the XBox 360 and Nintendo's Wii. Needless to say I was really surprised by Wii's gaming capabilities, and its totally new (IMHO) approach to digital entertaiment.

And by the way I liked the 360 too. I love racing games, and I was playing Gothan Racing, which I suppose is not the best of breed, but it has better graphics than the ones rendered by my silent (and very CPU limited) living room's PC.
After using both the XBox's gamepad and the Wii remote for a while, the following idea came to my mind: what about using a gamepad (or even the Wii's remote) for software development? Yes, the idea sounds crazy, but adding new peripherals to the programmer's toolset would be great provided them would give an added value and some fun. Obviously I don't see myself using a gamepad to scroll my editor up and down, but I would definitely use a Wii-like remote during a slideshow demo. And, who knows, maybe there are some other areas where new input devices can help. Would you imagine next Code Complete front cover introducing a gamepad? :-P

Then I started trying to control Plastic's 3D Version Tree with a spare gamepad I have at home...
Step 1: how do you capture joystick input using C#? I have to admit it has been a long way since the days I used to write C++ 3D code with OpenGL, DirectX, DirectInput and the like, so I was a bit lost... Anyway, what about trying with the Tao libraries (the ones we are currently using to interface with OpenGL libraries both under Windows and Linux systems)? Yes, using SDL it was possible. So I googled some samples (unfortunately C# samples capturing joystick input were not available with Tao, so I looked for C code ones) and wrote the following small WinForms application.

Retrieving gamepad's input using SDL is pretty simple: you just have to initialize the joystick and then poll for some data (I didn't fiddle with events... yet).

IntPtr mJoy;
Tao.Sdl.Sdl.SDL_Joystick mJoystick;
mJoy = Sdl.SDL_JoystickOpen(0);
mJoystick = (Sdl.SDL_Joystick)
mJoy, typeof(Sdl.SDL_Joystick));

And getting joystick's input:


progressBar0X.Value = offset + Sdl.SDL_JoystickGetAxis(mJoy, 0);
progressBar0Y.Value = offset + Sdl.SDL_JoystickGetAxis(mJoy, 1);
progressBar1X.Value = offset + Sdl.SDL_JoystickGetAxis(mJoy, 2);
progressBar1Y.Value = offset + Sdl.SDL_JoystickGetAxis(mJoy, 3);

The full source code is available here.
Once it was running smoothly the next step was modifying the 3D version tree.
And it was pretty simple too. Just replacing mouse code with joystick code and adding a reference to Tao.SDL.dll. By the way, don't forget to download the original SDL.dll library and place it correctly.
The following video shows both the gamepad and the 3D version tree in action.
Pablo Santos
I'm the CTO and Founder at Códice.
I've been leading Plastic SCM since 2005. My passion is helping teams work better through version control.
I had the opportunity to see teams from many different industries at work while I helped them improving their version control practices.
I really enjoy teaching (I've been a University professor for 6+ years) and sharing my experience in talks and articles.
And I love simple code. You can reach me at @psluaces.


  1. Sounds a bit freaking, but I myself can't see neither why a gaming controller can't be a good aid in other fields. 3D mouses and the like are being used nowadays for non-gaming purposes (I think I've seen a demo of Google Earth controlled with one). Rejecting using a different controller just because it was first thought for gaming is an error in my opinion.
    What you said about using the Wiimote for presentations is something I already had in mind for my graduation project presentation, by the way! :P

    PS: The last 5-10 secs of the video are a good inspiration for a possible easter egg in Plastic. You like racing games; sure you've already guessed how the game might look ;) "Racersitory" might be a good name!

  2. Fun & great!

    Now you can make you own Tron-like game running inside your branches and merges.
    Your game tracks will evolve while your repository is growing!
    And even better if you support you wheel race controller.


  3. Have just read about this:

    In case you're interested on this in the future...