Jump to content
  • Advertisement
Sign in to follow this  
id_gamedev

Joystick Problems....[help]

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

(^-^,please don't mind my pool English. - fareast) [ !!!I want to use more than one joystick in my game. !!!] 1.As i never write any code for joystick before, I modified the "JoyStick" project in DX9SDK-sample. // my code is basically like this: class CInputManager { LPDIRECTINPUT8 m_pDI; // dxinput list<CJoyStick*> m_lstJoysticks; // joysticks int InitDxInput(); static BOOL CALLBACK EnumJoysticksCallback(const DIDEVICEINSTANCE* pdidInstance, VOID* pContext); }; class CJoySticks { LPDIRECTINPUTDEVICE8 m_pDID; // a certain joystick static BOOL CALLBACK EnumObjectsCallback( const DIDEVICEOBJECTINSTANCE* pdidoi, VOID* pContext ); }; //////// I want to use the call-back-function "EnumJoysticksCallback" to find Joystick then use another call-back-function "EnumObjectsCallback" to get the current joystick 's information or to set it's parameters One - By - One !!!!! in other words , the call-back-function sequence is following: "EnumJoysticksCallback": find a joystick => [more than one]"EnumObjectsCallback" : set parameters ... => "EnumJoysticksCallback": find another joystick... => [more than one]"EnumObjectsCallback" : set parameters ... .... But , the truth is : "EnumJoysticksCallback": find joystick =>"EnumJoysticksCallback": find another joystick =>[a lot of]"EnumObjectsCallback": Here!!!, I don't know whick joystick to operate with!. Plaase Help!. Thanks a lot.

Share this post


Link to post
Share on other sites
Advertisement
Check the DX utility library in my signature..
It handles Joystick enumeration for you along other things.

Share this post


Link to post
Share on other sites
i read your code and i know where my problem is : i called ""EnumObjects()"" at the end of InitDxinput!

I should call "EnumObjects()" in every single call-back-function "EnumJoysticksCallback" .

Stupid Microsoft, that Sample Project misguided me.



Thank U very much!

Share this post


Link to post
Share on other sites
Quote:
Original post by id_gamedev
i read your code and i know where my problem is : i called ""EnumObjects()"" at the end of InitDxinput!

I should call "EnumObjects()" in every single call-back-function "EnumJoysticksCallback" .

Stupid Microsoft, that Sample Project misguided me.



Thank U very much!


Welcome, sure glad I could help.

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!