Jump to content
  • Advertisement
Sign in to follow this  
jtmerchant

Direct Input Order of Input

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

In Direct Input buffered mode, when using both keyboard and mouse, how do I figure out which inputs go in which order? That is, when GetDeviceData is called (once for mouse and once for keyboard), the arrays are filled with the buffered data, in the order which they occured. The problem is that how can I decide if the mouse events came before or after the keyboard events, or if some mouse events came before and some after the keyboard events? When processing the data it becomes necessary to know the order of events. For example, Player1 has a bolt gun equipped. Player2 just got shot, and Player1 presses "2" to switch to a repair box and clicks to repair Player2's armor, all faster than a frame. Now wait- I don't know how to order the processing so I have mouse processing before keyboard, so instead of switching to a repair box and healing Player2, Player1 fires once with his bolt gun and kills Player2, then switches to a repair box. You see my problem?

Share this post


Link to post
Share on other sites
Advertisement
Just compare the input events' dwTimeStamp fields (in the DIDEVICEOBJECTDATA structure). However since you're probably retrieving any new input within a couple of milliseconds this shouldn't really be necessary.

Share this post


Link to post
Share on other sites
Quote:
Original post by jtmerchant
Would it be faster to compare the dwTimeStamp member or the dwSequence member of the DIDEVICEOBJECTDATA structure?
It really doesn't matter. You won't be processing more than an event or two per frame anyway.
However I guess comparing the sequence numbers would be safer since you can rely on DISEQUENCE_COMPARE to handle wrapping for you.

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!