Skip to main content
gamedev.net
🔒 Locked

slowing down dinput

Started by xtrmntr 2 replies 450+ views
Original Post
xtrmntr
xtrmntr
after finally getting dinput to work i noticed that the reaction to the user input goes at lightning speed! how can i slow this down? i tried creating a variable and if the variable was at a certain amount and the user pressed the key then modify data, however, this gave me rather jerky input. thanks in advance
Supernova
Supernova
What exactly are you trying to do? If you want a way to let the user input text without getting 40 letters by pressing the key once, or other things like a menu where you don't want the selection cursor to fly all over the place, I have a simple solution.

The code only allows only one instance of an action to take place when a key is pressed. For the action to take place again the user has to unpress the key.


bool marker=true;

if(>check if key is pressed down< && marker==true)
{
marker=false;
>perform action<
}
if(>check if key is UNpressed<)
{
marker=true;
}


Edited by - Supernova on November 20, 2000 7:13:24 PM
sakic
sakic
Time ago I''ve got the same problem when trying to read the left mouse button with direct input. I was developing a sort of GUI for my game and the user input was too fast! The trick is to think that the user-action is not happening until the mouse button is depressed...
You should keep track of the mouse button state and then compare it with the previus one-> if the button was pressed and now is depressed -> do user input!

Hope it helps...
Unlimited2 Website:HereE-mail: [email=unlimited2@tin.it]unlimited2@tin.it[/email]

Topic Locked

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

Sign in to reply to this topic.