Jump to content
  • Advertisement
Sign in to follow this  
The_Snake

DirectInput: Binding DeviceObjectInstance to state

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

Hi all, I've searched the doc deeply and looked around quite a long time to find the answer to this question. I'm currently handling the DirectInput API for a game project of mine and I want the user to be able to bind a button from my XBox controller to any variable he wants. To do this, i need to associate a button (DeviceObjectInstance) to an attribute of the controller(Device)'s currentJoystickState property. I'd like to know if anyone has an idea on how to do this.

Share this post


Link to post
Share on other sites
Advertisement
I forgot to mention, the amount of variables (therefore the amount of actions) can change runtime in my game, so this makes the ActionMap feature unusable.

Share this post


Link to post
Share on other sites
would anyone know how to identify a DeviceObjectInstance(input) so that i know it corresponds to the z Axe, or Y Axe or button[3] or which ever input it corresponds to

Share this post


Link to post
Share on other sites
SOLUTION:
hey everyone after searchin the web like crazy i found this site:
http://www.microsoft.com/whdc/archive/hidgame.mspx

turns out directInput uses the DeviceObjectInstance.Usage to identify the input type. Knowing this, u can easily map ur inputs with their states with a nasty switch/case.

Example:

Switch (usage)
{
case 0x30:
return state.X;
case 0x31:
return state.Y
default:
m_msg = "error: input isnt implemented yet;
break;
}

if n e of u find a better way plz post

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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!