To DirectInput or not to DirectInput?

Discuss programming topics for the various GPL'd game engine sources.
Post Reply

Do you Direct?

Gimme gimme DirectInput baby!
4
80%
Software all the way for me!
1
20%
 
Total votes: 5

mh
Posts: 2292
Joined: Sat Jan 12, 2008 1:38 am

To DirectInput or not to DirectInput?

Post by mh »

I'm seriously considering removing the software mouse code from my engine. Advantage 1 is that I can have a simpler input code path with only one API to support. Advantage 2 is that I can construct a lot of reusable code for all input devices. Advantage 3 is that I would no longer have to write everything twice - once for DirectInput and once for software.

I'm interested in how many people really prefer to use software input. I know that there are some, with the main argument being that DirectInput sometimes feels slower, but I've already overcome that by adding an additional boost cvar. Reading MSDN it looks easy enough to also add mouse acceleration if required.

Another argument is that DirectInput may fail to start, but I don't really buy that. May have been valid in 1996 with version 3.0, but it's 2009 and version 8.0 these days. It's a robust, mature, proven-in-the-field API.

Last argument is that MS themselves no longer recommend use of DirectInput, but I'm wondering how much of that is coloured by their push towards the XNA platform.

OK, I'm one of those weird people that enjoys writing input code, and DirectInput is a spectacularly clean API that's just a pleasure to use, but I'm also genuinely interested here. :D
We had the power, we had the space, we had a sense of time and place
We knew the words, we knew the score, we knew what we were fighting for
Baker
Posts: 3666
Joined: Tue Mar 14, 2006 5:15 am

Post by Baker »

-dinput is overwhelmingly popular among the experienced. I recently learned of an engine that actually uses it by default ;)

I used to use the non-dinput way a few years ago, and then I did some experimentation and realized that with dinput the mouse control actually does what you do with the mouse movement.

It is very sad that Linux and OSX don't have a dinput equivalent.
Last argument is that MS themselves no longer recommend use of DirectInput
But those are the same people that recommend you switch to Vista ;)
mh
Posts: 2292
Joined: Sat Jan 12, 2008 1:38 am

Post by mh »

OK, I've added mouse acceleration to DirectInput. Go check out Tutorials for the full dirt on the matter. It's a lousy gameplay experience, by the way. :lol:
Baker wrote:It is very sad that Linux and OSX don't have a dinput equivalent.
I suppose SDL probably has something, but I seriously don't know enough about it.
We had the power, we had the space, we had a sense of time and place
We knew the words, we knew the score, we knew what we were fighting for
Spike
Posts: 2914
Joined: Fri Nov 05, 2004 3:12 am
Location: UK
Contact:

Post by Spike »

Baker wrote:It is very sad that Linux and OSX don't have a dinput equivalent.
evdev.


vista warning: on my vista laptop, I get periodic input stalls when not using dinput/rawinput.
if you detect vista, you ought to avoid defaulting to detecting mouse movements. Framerates are fine, it just periodically stops receiving inputs.

rawinput (xp/vista but not 2k) will supposedly give lower latency, as well as more than 5 mouse buttons. dinput is now a legacy api.
Post Reply