PhiLho wrote on Nov 19th, 2009, 1:25am:Well, Cedric, if I understood correctly, antiquekid3 knows how to handle multiple key input, but he is annoyed to cut and paste the same code in each sketch needing it.
Indeed, sometime you have some simple code you want to use in several sketches, and currently Processing doesn't facilitate simple reuse, like looking in a shared code folder. I recall I suggested such feature long ago, as wrapping the code in a jar is sometime inconvenient, particularly if the shared code is still evolving.
Yes, that's quite right. For example, it would seem like a waste of time to detect a-z, A-Z, 0-9, all the symbols, space, return, etc. if you're just going to use two keys in one of your programs. However, in some other programs, that might be useful; hence the need for a library.
Yeah, I hate the copy/paste stuff. Maybe I'm lazy, but it's pretty annoying to go back over each program that uses the same part when you figure out how to make something better.
The way I have handled multi-key input doesn't seem as complicated to me as what the first link showed, but I guess mine might take up a few more lines of code. But it's easier for me to understand.
Kyle