DirectInput vs Windows API input

Started by
2 comments, last by _necrophilissimo_ 8 years, 11 months ago

Cheers,

While waiting for a new computer to arrive, I used the break from development duties to browse MSDN for development updates (it's been YEARS since the last time I did so). It seems Microsoft has all but abandoned DirectInput a long while ago. So, a question;

If DirectInput is kicked to the curb in the future iterations, is there a way to use Windows API to;

A) track relative mouse movement and

B) restrict the mouse to the app window without resorting to global ClipCursor trap?

I know I could do a horrible cluster-frakk of a work-around using global hooks, forced cursor re-positioning and the like, but that seems like awful lot of effort for something this simple. Especially since main motives for MS to move stuff over to Windows API has been, according to them, streamlining the codebase.

Sorry, if this question seems silly, but I just refuse to believe this task has moved from a simple few-lines-of-code into a colossal API-hacking nightmare - there just has to be something I'm missing.

Thanks you for your patience with silly questions! :D

Advertisement

Check out Raw Input and Taking Advantage of High-Definition Mouse Movement. Direct input's mouse handling is basically just a helper library that wraps up the WM_INPUT messages. Absolutely no reason you can't write all the same logic yourself instead of using DirectInput.

Be aware though, some parts of DirectInput are NOT available otherwise: Named controller parts (Axis, buttons, etc.) and calibration data.

Unfortunately I can't find the site anymore where they (not MS) explained how to use Raw Input generally but fetch the calibration and controller part info from DirectInput's registry entries.

My current library uses Raw Input to fetch HID data plus DirectInput data (not the library itself though) to interpret data. It's nicer for the player to select a named device than "some gamepad at USB port 17".

Fruny: Ftagn! Ia! Ia! std::time_put_byname! Mglui naflftagn std::codecvt eY'ha-nthlei!,char,mbstate_t>

Awesomes, thank you so much for the replies - I knew there had to be a more sensible way of doing things :D

This topic is closed to new replies.

Advertisement