Skip to main content
GameDev.net gamedev.net
🔒 Locked

keyboard input problem...

Started by FreJa Mar 17, 2003 at 1:05 PM 1 replies 250+ views
Original Post
FreJa
FreJa
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
"Through me the road to the city of desolation,Through me the road to sorrows diuturnal,Through me the road among the lost creation."
Zook
Zook
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!
Yohumbus
Yohumbus
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.
ASCII stupid question, get a stupid ANSI

Topic Locked

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

Sign in to reply to this topic.