I’ve got Keyboard (LWJGL 0.7) going well, but how do I get it to recognize key repeat? Pressing and holding a button only generates one event (which generally is good), but for when the user is typing stuff I’d like them to have key repeat.
my Keyboard initialization is just
Keyboard.create();
Keyboard.enableBuffer();
Keyboard.enableTranslation();
(which, btw, what does translation really do?)
and I read it with (once per frame)
Keyboard.read();
// buffer is my own data structure
buffer.resetCount();
while(Keyboard.next()) {
if(Keyboard.state) {
buffer.add(Keyboard.key, Keyboard.character);
}
}
I could maintain state of each key with a boolean and as long as the key is down stick events into my buffer at a constant rate, which wouldn’t be too bad. But maybe there’s a common, easier way to go about it?
The code above makes it so pressing and holding a key only generates one event, so say pressing and holding backspace will erase only one character.
I’ve looked around here and at the lwjgl forum without much luck.
