XInputState state = XInput.GetState(0); // Get the state for player 1
joyGetPosEx
I'll make this one quick: I've been implementing various input libraries in my code recently and am stuck with a small dilemma. I currently have implemented:
Mouse, through WM_INPUT
Keyboard, through the standard windows messages
XBox 360 pad, through XInput (which I love, BTW)
Now I'm working on non-360 game controllers, and I'm at an impasse as to what method I want to use. For my part, I really want to expose the controllers much in the same way I do the XInput controllers. Basically:
Looking at the Win32 Joystick APIs, it seems that joyGetPosEx does this job nicely! After a bit of fiddling, I got that up and running no problem, but now I have something nagging at me: Is Direct Input the better choice?
Frankly, I despise the DI8 API. It does offer force feedback, though (which it seems simply isn't available any other way), and it's pretty clearly defined how you can tell a 360 controller apart from your standard DI device. I'm not sure how you would accomplish that with the Win32 APIs.
So the question is: does anyone have a convincing argument for one API over the other?
Win32 wont provide you with all the bells and whistles. If you need more than what Win32 provides (which is very little), then you will have to go to DirectX, but it's no big deal really. You will have to enumerate your devices, create an interface for each of them, poll, setup some vibration effects, and Bob's your uncle. I dont like the DirectX8 either, but once you're used to it, it's no biggy. I'd write a wrapper around it to make life easier.
I'm also not a fan of using messages for controllers. Really, it should just be a day or two job.
I'm also not a fan of using messages for controllers. Really, it should just be a day or two job.
I should point out that I already have a working implementation for both (minus the few "bells and whistles"), so it's not a matter of what's easier to implement. But I don't see any sense in having two disparate methods for reaching the same data, so I'm going to drop one of them. I'm just putting out feelers as to which is preferred (if any).
I'd stick with DirectX. Win32 is too limited, DirectInput is made for handling game controllers, well supported, very extensive, ect... It's worth the extra hassle.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement