• Advertisement

Archived

This topic is now archived and is closed to further replies.

keyboard input problem...

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

Hi, I''m using direct input, and when I click a certain key, a certain object will be affected by a determined translation. The result is that when I press the key the object wil only move for the time I press the key. How can I just press the key once, and the object will move all the way...? Thanks a lot

Share this post


Link to post
Share on other sites
Advertisement
One easy way to achieve this would be to use buffered input, which you do by using GetDeviceData instead of GetDeviceState.
When you call GetDeviceData you''ll recieve information about the latest events that happened on your keyboard. Which keys that are involved and if they were pressed or released. So, when you stumble upon an event that says something happened with this certain key, start moving the object if the key was pressed or stop it if it was released.
You will also have to set the buffer size in the initializion stage, it''s all in the docs.
Hope this helps!

Share this post


Link to post
Share on other sites
Another way that you might could do it without buffering is have a variable that you set (turned on) when you switch states. you dont accept input untill this variable is reset(turned off) which you do when the mouse button is released.

Share this post


Link to post
Share on other sites

  • Advertisement