Reputation: 175
In my last homework they want me to code a game, controlled by keyboard. Part of the game is to press a key and keep holding it.
I use keyDown method to track keyboard events. And what is happening, is that after first event (when i read a single key pressing) there is an approximately half second delay, before the other chars start coming. Same delay as if in a text box you hold "a", after the first char there is a gap of half second.
Where can i tweak that? It really busts the game...
Upvotes: 0
Views: 324
Reputation: 4958
I don't think this is an issue with reading the keyboard state in Squeak (or any programming language, for that matter), but an issue with what keyboard signals the operating system sends.
In Windows, you'll want to go to Control Panel
> Keyboard
> Speed
tab, and tweak the "Repeat delay" setting:
In Linux, I think you need to use the xset
or kbdrate
command. I'm sure there's something equivalent in Macs.
Having said that, I don't understand why you need to read the OS's keystrokes. Shouldn't you be reading keyDown
, and then assuming that that key stays pressed until you get the keyUp
event? I would've thought you'd be interested in the keyboard state rather than the individual characters "arriving".
Upvotes: 3