Detecting Key Press

Started by
2 comments, last by jechternach 23 years, 11 months ago
Do most of you use the windows msg pump to detect key presses? Is the sampling rate fast enough using that technique? Is there a better way? I am working on a simple game that rotates a ship while the right or left keys are pressed. My problem is that the ship is not rotating as fast and smoothly as I would like. My frame rate is maxed to the monitors refresh rate (75), but it doesn''t seem like the keypresses register fast enough to allow for the smooth rotation. Thanks. Justin
Advertisement
Maybee i''m not the guy to answer this question, when i only have used one form of input reading.. But here goes nothing:
Use directX!! The DirectInput comes with great possibilities for this task! I cannot guide you, or something, cause i''m not very good at it myself, but i got it to work, and now it''s VERY easy to control the keyboard!

Electron

"Who need more than 640kb of RAM?" -Bill gates -89


--Electron"The truth can be changed simply by the way you accept it.""'General failure trying to read from file' - who is General Failure, and why is he reading my file??"
Doh!!! Of course! I obviously am new to this. I checked out Direct Input and implemented it. It was exactly what I needed. Thanks for your help.
There is a simple way to do this if you don''t want to mess with DI. Write a macro around the GetAsyncKey functions like this( I think ):

#define KEY_DOWN( vk_code ) ( GetASyncKey( vk_code ) & 0x800 1 : 0 )

That is not correct, I''ll repost tomorrow with the better one.

This topic is closed to new replies.

Advertisement