Created
June 15, 2011 20:45
-
-
Save jordanorelli/1028065 to your computer and use it in GitHub Desktop.
Accepting keyboard input in ChucK. Pressing space disables keyboard entry (sometimes).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
KBHit kb; | |
fun void kbListener(KBHit @ _kb) | |
{ | |
while(true) | |
{ | |
_kb => now; | |
while(_kb.more()) | |
{ | |
chout <= "ascii: " <= kb.getchar() <= IO.newline(); | |
if(kb.getchar() == 32) | |
kb.off(); | |
} | |
} | |
} | |
spork ~ kbListener(kb); | |
while(true) { 100::ms => now; } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment