Jump to content
  • Advertisement
Sign in to follow this  

Direct Input

This topic is 5398 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
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!