Hello everyone! I have a quick question: Is there a way to check if a key is pressed but not held using direct input? That way if a key is held, the direct input code will not keep seeing the key as being pressed, much like the bcall GetKey does. Any ideas? Thanks!
So you don't want key repeat ? Basically :
  • At the start of your program, set flag = 0
  • Program loop :

    • Do direct input
    • If key is pressed and flag is 0, set flag to 1 and apply action. Else if key is pressed and flag is 1, do nothing.
    • If key isn't pressed set flag to 0.
Ah, that makes sense. Can't believe I didn't see it before. Smile
Another little trick you can use for something like a menu routine is to wait until all keys are released before continuing, that way you don't accidentally go back into the store when you hit the Exit menu item Wink
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 1 of 1
» All times are UTC - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement