Re: [Q] Keyboard repeats stop when I hit another key. How do I get them back?
Re: [Q] Keyboard repeats stop when I hit another key. How do I get them back?
- Subject: Re: [Q] Keyboard repeats stop when I hit another key. How do I get them back?
- From: Angela Brett <email@hidden>
- Date: Tue, 6 Nov 2001 22:18:39 +1300
I don't know if mine was the right way to do it or not since I'm
quite new to this, but maybe this idea will help. In my game I used
keyDown: and keyUp: to keep track of which keys were down. I had
keyDown add the key to a set (probably not the most efficient way of
storing it, but it was convenient for my purposes) if the key event
wasn't a repeat. keyUp would remove a key from the set. I had a timer
which would invoke my keyStillDown method, which would look at the
set of keys down and do whatever those keys were supposed to do.
That way the key repeat rate had no effect on how fast the player in
the game could move etc, it was always at the speed of my timer. Also
there was no problem with one key stopping when another one was
pressed, because my program remembered the other key was down (until
it got a keyUp for that key.)
--
Angela Brett email@hidden
http://acronyms.co.nz/angela
"We must believe in free will, we have no choice!" -- Isaac Bashevis Singer