[chuck-users] KBHit and arrow keys

Kassen signal.automatique at gmail.com
Fri Apr 28 19:14:09 EDT 2006


Jim Hinds;

> This isn't unique to the keyboard, but is pretty much the way all interrupt
> driven I/O works.  So, be happy: what you thought were warts in your program
> were really elegant solutions to a universal problem.  Or something like
> that.

Ah, yes, I did some more testing and now it's clear. Thanks.

I was under the impression that "kb.getchar()" would be updated every
iteration of the "while" loop and that the top value would be cleared
at that time and instead calling it already clears it from the buffer
so you need to be carefull how you do that or it'll be gone forever.

I didn't expect this to work;
if ( ( kb.getchar() == 224) && ( kb.getchar() == 72) ) <<<"up">>>;
But it does.

Considdering what you wrote that's all very understandable, realy, but
in that case it might be nice if something along the lines of the
example I posted previously would be in the documentation somewhere
because that's a bit tricky and this stuff covers almost half the
keyboard.

So, should I add it to the Wiki? If so, what would be a apropriate place?

Thanks again for your the explanation,

Yours,
Kas.


More information about the chuck-users mailing list