• Advertisement
Sign in to follow this  

Relative or absolute axes [solved]

This topic is 3828 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

Some Direct Input devices don't seem to succeed when calling IDirectInputDevice::GetProperty() with DIPROP_AXISMODE. Other GetProperty() types are succeeding, but this one returns E_NOTIMPL. How is it possible to use these axes correctly without knowing if they're relative or absolute? Is there some other way to know if the axis is relative? [Edited by - Kest on October 31, 2007 8:36:31 PM]

Share this post


Link to post
Share on other sites
Advertisement
Both my mouse and a dual analog USB joypad are failing to return the axis modes for any axes. One is relative, and the other absolute. But the device type can't be safely used to assume which type of axes it has. Any joystick could have a slider, spinner, or wheel on it.

Share this post


Link to post
Share on other sites
I can't seem to get any axis to successfully return its mode.

Has anyone ever actually obtained the axis mode for a specific device? Is it rare for devices to return E_NOTIMPL? If so, perhaps I'm doing something wrong. If not, then how is anyone using axis controls in a reliable way?

Share this post


Link to post
Share on other sites
If anyone else finds themselves having the same problem, the solution is to check for the flag DIDFT_ABSAXIS and/or DIDFT_RELAXIS in the DIDEVICEOBJECTINSTANCE::dwType member that is passed to the EnumObjects() callback function.

All devices that I've tried so far use these flags to indicate the axis mode correctly.

edit:

In case anyone else is having trouble with this, it would help to more clearly explain. I mistakenly thought the DIPROP_AXISMODE property and DIDFT_ABSAXIS / DIDFT_RELAXIS flags meant the same thing. One is related to how the user controls the device. The other is related to how the device sends data to the program.

The DIDFT_* flags actually define what type of hardware control it is. This isn't related to the type of data being read by the program. It just defines how the user controls it. At all times, an analog stick is always in a specific position, meaning it is absolute. But a mouse wheel can never be in any specific position, so it is relative.

The DIPROP_AXISMODE defines how the control returns data. Even an absolute control like an analog stick can return relative data if DIPROP_AXISMODE is set to DIPROPAXISMODE_REL. A mouse wheel can also return absolute data. It's just that the absolute position it reports won't have any real world meaning.

Further, I mistakenly thought DIPROP_AXISMODE could be read from and set for each individual axis on a device. In reality, the entire device can only be in one mode or the other. This is why my GetProperty() calls were failing.

[Edited by - Kest on October 31, 2007 11:35:20 PM]

Share this post


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

  • Advertisement