Skip to main content
gamedev.net
🔒 Locked

DirectInput question

Started by pixelmana Jul 3, 2004 at 8:24 AM 0 replies 600+ views
Original Post
pixelmana
pixelmana
HIHI, does any tutorial or articles describe how to implement the mouse double click or the keyboard double press actions with DirectInput??? Thanks a lot.
SoulSpectre
SoulSpectre
For time based apps use buffered data collection instead of polling. This way you can retrieve all the buffered input events since your last check with: GetDeviceData in a conditional while loop. find those data objects from that retrieval that relate to say a left mouse click and then compare the time stamps, to see if any two clicks occured in a given time. You will need to keep accoutn of the last time the click occurred as well from the last data fetch.
If you are using the polling approach then keep a value that records the last time the button was pressed, then check it when it is pressed again. Two problems can occur with this, the button may be held down over the check which can result in one long press, handle accordingly. The other is that if your game drops in frame rate then you may have a long period of time between to polls, which could result in a double click being dumped due to the poll event falling out of range.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.