keyboard ills - vc++
Hey - I''m making a game in vc++ that uses openGL and lots of drunken hours behind the keyboard. Anyways, I''m getting a decent frame rate (at least 40fps), but when I press and hold down a key, the game thinks its pressed for a while after I release it. The mouse works fine during this time, so my guess is the game just can''t keep up w/ the keyboard queue.
I''ve tried the "GetKeyState" function and I''ve tried relying on keyboard events passed to WndProc but I have the stick problem using both methods.
What are my options? Is there a function that allows me to check the current keystate instead of looking into the queue? It''s annoying and makes the game unplayable!
Also - is there a way to steal more clock time from windows?
*snort*
I don''t really understand what you''re asking. What do you mean you have a "stick problem"? If it is what I think it is:
If you are using DirectInput, use buffered input and get all input data that is available each frame. That is, poll input devices until there is no more data instead of once per frame.
When you check key state, have a global array of keys that were pressed on last frame. Then check for key down like this:
If this isn''t clear, you should post some code.
If you are using DirectInput, use buffered input and get all input data that is available each frame. That is, poll input devices until there is no more data instead of once per frame.
When you check key state, have a global array of keys that were pressed on last frame. Then check for key down like this:
if (CurrentKeys[KEY] && !LastKeys[KEY]) // Do something
If this isn''t clear, you should post some code.
---visit #directxdev on afternet <- not just for directx, despite the name
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement