Re: (No Subject)

new topic     » goto parent     » topic index » view thread      » older message » newer message

>Disadvantage: If you chew up CPU time doing other ops then you will
>probablely find keys being 'missed', dropped out of the buffer before
>being read.

Actually, no. There is a keyboard buffer that stores something like 13
characters. If you try to go beyond that limit, the computer starts
making annoying beeps. When you are using get_key() for input, any input
will be stored until used. (By calling any routine that takes a character
from the keyboard buffer.)

(Untested code)

integer k

while 1 do
    k = get_key()
    puts(1, k)
    for i = 1 to 10000 do end for   -- Pause for a little while,
                                    -- change this value to mean a couple
                                    -- seconds on your computer
    if k = 27 then exit end if      -- Exit on escape
end while

If you type stuff during the pause, the characters will pop out next time
it gets to get_key(). If you type more than 13 characters during the
delay, you'll get beeps (or if you store up more than 13 characters).

After the delay, if you have typed something. Don't type anything and
you'll see the other characters you typed pop up each time it gets back
to the puts() line.

Now, you just have to make sure to poll the keyboard enough times to keep
up with a good typist not going over the 13 character limit........


_____________________________________________________________________
You don't need to buy Internet access to use free Internet e-mail.
Get completely free e-mail from Juno at http://www.juno.com
Or call Juno at (800) 654-JUNO [654-5866]

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu