Jump to content
  • Advertisement
Sign in to follow this  
munawar

[SlimDX] Determining if a joystick object is a slider

This topic is 3679 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello: I am wondering if there is a way to determine if an object on a joystick is a slider control. Here is what I have done so far. When a player selects a joystick for playing, the game enumerates through all the devices using the Device.GetDeviceObjects() method. In order to set ranges on each object though, I need specifics about what it is. So I followed the DirectInput sample which did this: foreach (DeviceObjectInstance deviceObject in joystick.GetDeviceObjects()) { if ((deviceObject.ObjectType & ObjectDeviceType.Axis) != 0) ... I looked at the ObjectDeviceType enumeration, but there is no value for slider control. I see PointOfViewController and several more. Is there any way to determine, accurately, if the object that "has focus" in the enumeration is a slider? Right now the way I do it is use an int to keep track of which object is being enumerated. On my stick, the slider shows up as the fourth object, so when index==4, I set the range on that object. I know other sticks have different configurations, so this is definitely not a foolproof method. If anyone can help me with this, I'd much appreciate it. Also, a side note, thanks to the SlimDX group for this API. I really appreciate your work! Munawar

Share this post


Link to post
Share on other sites
Advertisement
I believe you should be able to compare the ObjectTypeGuid member of the DeviceObjectInstance to one of the ObjectGuid members, specifically ObjectGuid.Slider. I'm fairly certain this will work for most, if not all, joysticks, but it's difficult to be sure. DirectInput can only report on what information the driver vendor chooses to include.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!