Do I really need SharpDX or Slimdx for this?

Started by
1 comment, last by jpetrie 8 years, 10 months ago

This may be a stupid question, but here it goes anyway.

I am building a .net windows forms program that needs input from a joystick. I added a reference to the DirectInput dll on my dev machine and the joystick works perfect. When I tried to move my program (and the directx dlls) to my target machine I get errors and a crash because it cant find the assemblies/methods that the joystick uses (immediately after I execute the method that enables the joystick input).

After some googling I determined that maybe I needed to build against Slimdx or SharpDX and distribute whichever one to my target system. But now I am wondering: is this really neccessary? Can I just install the DirectX redistributable and be done with it? What does SharpDX give me that I can't get from using directx ...directly smile.png ?

fyi

On my dev machine I added a reference to the DirectInput dll that lives inside a subfolder in the Windows folder. I naively thought I could just copy that dll with my exe and have it work. My dev machine is Win7 and target machine is Server2003.

Thanks for any tips or advice.

p.s. - I post this here because apparently the SharpDX forums are closed.

Advertisement

Why don't you use Winapi? Do you really need DirectInput or XInput? Winapi provides a lot of joystick functionality.

Look for joySetCapture in winmm.

https://msdn.microsoft.com/en-us/library/windows/desktop/dd757114(v=vs.85).aspx

https://social.msdn.microsoft.com/Forums/vstudio/en-US/e7163456-b3bb-4ea2-8025-bda8072f5246/what-is-the-best-way-to-use-joystick-in-c

http://www.codingmonkeys.com/index.php?topic=1183.0

You don't need SlimDX or SharpDX to do this; you could just do what they do yourself (essentially p/invoke the appropriate functionality). But they'll make it easier for you.

You probably can't just redistribute the DirectInput.dlls though, since that's usually illegal. That's why MS provides the DirectX redistributables; you'll have to bundle one of those with your installer.

(Check the licensing agreements, it's possible DirectInput's DLLs are redistributable themselves, but I'd err on the side of caution.)

This topic is closed to new replies.

Advertisement