Sign in to follow this  

Direct Input

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

I am using an action mapper and everything works except the fact that the user is unable to hold down the button to do an action (rotate ship). So when the user wants to rotate his ship he must tap the right or left keys 10 times, instead of holding the button down. The following is the code for updateInput which is the first thing called every frame. Thanks -Brandon void updateInput(void){ DIDEVICEOBJECTDATA rgdod[10]; DWORD dwItems = 10; // Keyboard Input Only g_pKeyboard->Acquire(); g_pKeyboard->Poll(); if(FAILED(g_pKeyboard->GetDeviceData( sizeof(DIDEVICEOBJECTDATA) , rgdod, &dwItems, 0 ))){ MessageBox(NULL, "Get Device Data Failure", "Error!", MB_OK); } for( DWORD j=0; j<dwItems; j++ ) { switch( rgdod[j].uAppData ) { case INPUT_TURNLEFT: if(rgdod[j].dwData & 0x80 ){ rotateShip(0.5f); } break; case INPUT_TURNRIGHT: if(rgdod[j].dwData & 0x80 ){ rotateShip(-0.5f); } break; case INPUT_FORWARDTHRUST: if(rgdod[j].dwData & 0x80){ thrustShip(1.0f); } break; case INPUT_REVERSETHRUST: if(rgdod[j].dwData & 0x80){ thrustShip(-1.0f); } break; case INPUT_FIREWEAPONS: break; default: break; } } }

Share this post


Link to post
Share on other sites

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