Jump to content
  • Advertisement

Archived

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

jechternach

Detecting Key Press

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

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

Share this post


Link to post
Share on other sites
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


Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!