SlimDX - input system for mouse, keyboard, gamepad


11-02-2010 23:49:59


today I made my first try with MOIS to capture inputs of a gamepad.
Unfortunately it didn't work. Maybe I made something wrong.

Then I searched for an alternative input system.
So I found SlimDX.

What is SlimDX?

SlimDX is a free open source framework that enables developers to easily build DirectX applications using .NET technologies such as C#, VB.NET, and !IronPython. It is designed to be an efficient, simple, and lean wrapper that fully encompasses all of Microsoft's gaming and multimedia technologies and exposes them to managed code. All of the code is under the MIT/X11 license, and all content is under the Creative Commons Attribution-Share Alike license.

In short words:
A practial library for easy access for input of keyboards, mice and gamepads. (It also can do more than input.)
The MIT licence allows the use even in commercial projects. (I think so. If I'm wrong, please correct me.)

There are several tutorials in the Developer SDK.

A tutorial related to gamepads you find in this directory:
...\SlimDX SDK (August 2009)\Samples\DirectInput\Joystick
It checks the states of all connected gamepads and show them in a GUI.
By using this easy code I can get gamepad inputs in my application (-:

Download here:

Maybe somebody needs it. So I just wanted to let you know.


13-02-2010 01:31:51

SlimDX is an entire rendering system, a little overkill for just getting input, don't you think? Of course I can't really talk seeing as I downloaded XNA just for GamePad support. :)


13-02-2010 04:48:10

I'm still quite a c# beginner but doesn't it only include the bits you actually use?
ie the slimdx dll is about 3 meg, but each compiled .exe demo in the samples project ends up only 50k or so with no slimdx.dll in the exe folder.


13-02-2010 20:04:08

^Yeah, but you're end user will have to have SlimDX installed on their machine. It's small, but it's one more thing your user has to do.


14-02-2010 12:22:17

It seems to be enough to just copy the DLL file to your project and refer it. (I will test it on an other computer.)

The library can much more, but in my project I just used the joystic class. So I think there is no overload.
For me it's just a quick and working solution.


14-02-2010 12:29:15

On the old computer of my girlfriend with Windows 2000 it doesn't work.
File mscoree.dll not found. But this seems to be a MS file and no SlimDX depency. (The DirectX version is 9.0c, but maybe a very old release.)
I will check it in some days on a WinXP computer.


16-02-2010 23:42:12

Installing SlimDX adds assemblies to the GAC, which the SlimDX.dll that you include in your projects depends on. Alternatively you could find all assemblies SlimDX.dll is dependent on and include them in your project, but this is not recommended.