Re: Keyboarding Assistance
- Posted by Jason Gade <jaygade at yahoo.com> Feb 10, 2006
- 457 views
don cole wrote: > > Funkbrat wrote: > > > > don cole wrote: > > > > > > Funkbrat wrote: > > > > > > > > I need to know how to do proper keyboarding in DOS Euphoria. > > > > > > > > I want the keyboard to recognize a pressed key without a pause. > > > > Normally, > > > > it detects the key once, waits a short while, then continues to > > > > recognize the > > > > key again. I don't want that to happen. I want it to constantly > > > > receive the > > > > keypress at a smooth rate without a pause after the first time. How do > > > > I do > > > > it? > > > > > > Could we see a sample of your code that pauses. > > > > > > Don Cole > > > > I don't really have any code. Those were the wait_key() and get_key() > > commands I were talking about. What I want is to program my own keyboarding > > routines that repeatedly recognize a key from the keyboard without a pause, > > like for moving a player in a game, like a side-scroller or something. I > > just don't know how to do it. I'm not that good with Euphoria yet. I'm > > asking what I need to do to make this happen. > > > Hello Funkbrat, > > I might be missing something here, but I don't understand how you can > determine that there is a pause after your keyboard recognizizes a key, > if you have no code to execute. > > Again I would like to see the code that is causing this pause. > > Don Cole Once I realized what he was talking about, I made a quick test.
integer key atom timer timer = time() key = get_key() while key != 27 do -- esc key = get_key() if key != -1 then if key > 32 and key < 127 then ? {key, time() - timer} end if timer = time() end if end while
It's probably related to how DOS/Windows handles key-repeat. After pressing a key, I get about a .5s pause before the key starts repeating at about .03 seconds between. Otherwise I don't know how to help him. Funkbrat: are you writing for DOS or Windows? -- "Any programming problem can be solved by adding a level of indirection." --anonymous "Any performance problem can be solved by removing a level of indirection." --M. Haertel j.