Sign in to follow this  

Joystick Problems....[help]

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

This topic is 3860 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this