[gameprogrammer] Re: Key Repeat problem
- From: David Olofson <david@xxxxxxxxxxx>
- To: gameprogrammer@xxxxxxxxxxxxx
- Date: Fri, 20 Jan 2006 13:32:26 +0100
On Friday 20 January 2006 13:41, Simon Mihevc wrote:
> > The flaw with this, as I mentioned, is that if the player holds
> > down a
> > key, then with so many keypress/release events being fired for the
> > duration it is held down, the key might not be marked as being
> > pressed
> > at the time when the keys are being processed in the main game
> > loop.
>
> iirc an average keyboard allows/is able to transmit keypresses
> for at most 6 or 5 keys at once. That's 6/5 events every few ms
> although it's very unlikely that more than 2/3 keys will ever be
> pressed at the same time.
[...]
As I understand it, the problem is not the rate of events coming in,
but the fact that the Linux implementation is lying, saying the keys
are repeatedly pressed and released when the key repeat kicks in. (In
any seriously useful implementation, the key repeat would be
generating "down" events only, or specially marked "repeat" events.)
[...]
> With c++/SDL you also get a plethora of key events every few ms
> however you can handle all of the events there before you do the
> drawing, ...
Indeed, but there, you can just assume that you'll never get an "up"
event unless a key was actually released, key repeat or no key
repeat. Thus, tracking the state of keys is trivial and accurate.
//David Olofson - Programmer, Composer, Open Source Advocate
.------- http://olofson.net - Games, SDL examples -------.
| http://zeespace.net - 2.5D rendering engine |
| http://audiality.org - Music/audio engine |
| http://eel.olofson.net - Real time scripting |
'-- http://www.reologica.se - Rheology instrumentation --'
---------------------
To unsubscribe go to http://gameprogrammer.com/mailinglist.html
- References:
- [gameprogrammer] Key Repeat problem
- From: Stephen Smith
- [gameprogrammer] Re: Key Repeat problem
- From: Stephen Smith
- [gameprogrammer] Re: Key Repeat problem
- From: Simon Mihevc
Other related posts:
- » [gameprogrammer] Key Repeat problem
- » [gameprogrammer] Re: Key Repeat problem
- » [gameprogrammer] Re: Key Repeat problem
- » [gameprogrammer] Re: Key Repeat problem
- » [gameprogrammer] Re: Key Repeat problem
- » [gameprogrammer] Re: Key Repeat problem
- » [gameprogrammer] Re: Key Repeat problem
- » [gameprogrammer] Re: Key Repeat problem
- » [gameprogrammer] Re: Key Repeat problem
- » [gameprogrammer] Re: Key Repeat problem
- » [gameprogrammer] Re: Key Repeat problem
- » [gameprogrammer] Re: Key Repeat problem
- » [gameprogrammer] Re: Key Repeat problem
- » [gameprogrammer] Re: Key Repeat problem
- » [gameprogrammer] Re: Key Repeat problem
- » [gameprogrammer] Re: Key Repeat problem
- » [gameprogrammer] Re: Key Repeat problem
- » [gameprogrammer] Re: Key Repeat problem
- » [gameprogrammer] Re: Key Repeat problem
- » [gameprogrammer] Re: Key Repeat problem
- » [gameprogrammer] Re: Key Repeat problem
- [gameprogrammer] Key Repeat problem
- From: Stephen Smith
- [gameprogrammer] Re: Key Repeat problem
- From: Stephen Smith
- [gameprogrammer] Re: Key Repeat problem
- From: Simon Mihevc