A fast typist will be hitting approximately 375 chars per minute, and Processing defaults to 60fps. However, no matter what its frameRate, Processing doesn’t drop these events. Even at 1fps, it will catch dozens of keys correctly in each frame, in the correct order. Try it!
void draw(){
frameRate(1);
}
void keyReleased(){
print(key);
}
Don’t invoke key
from inside draw() → textBox1.draw() → getUserInput() – that is a convenience keyword and will only give you a single event per frame. Call it from keyReleased()
, which is invoked by every single queued event. Pass the unique key value each time.
void keyReleased() {
textBox1.getUserInput(key);
}