[gameprogrammer] Re: Key Repeat problem
- From: "David Olsen" <jolynsbass@xxxxxxxxx>
- To: <gameprogrammer@xxxxxxxxxxxxx>
- Date: Fri, 20 Jan 2006 08:23:52 -0600
Sorry if this is a dumb question, since I'm not familiar with linux, but is
the behavior consistent regardless of any settings you try with
SDL_EnableKeyRepeat(delay,rate)? have you tried a 0 for delay, which should
turn off key repeating, and if that didn't work, how about the other
extreme - something like 30000? (not likely that they would hold one
direction arrow down for 30 or more seconds at a time, is it?)
Again, sorry if it's a dumb question/suggestion - but I had to throw it out
there!
-David Olsen
----- Original Message -----
From: "Stephen Smith" <gp@xxxxxxxxxxxxxxxxxxxxxxxx>
To: <gameprogrammer@xxxxxxxxxxxxx>
Sent: Thursday, January 19, 2006 3:00 PM
Subject: [gameprogrammer] Re: Key Repeat problem
That's what I do when it's running under Windows. Unfortunately, knowing
what the state of the keypress is under Linux is the crux of the problem,
due to the constant keypress/keyreleased events being fired when a key is
held down.
Steve
Jake Briggs wrote:
Or maybe store the state, only pass the message on to the network server
if the state changes. The state would store whether the key is pressed or
not....
Paul Smith wrote:
Maybe in your KeyPressed function store a timestamp in a static variable
and the next time the function is called only pass the message on to the
network server if the time elapsed is greater than a certain number of
milliseconds?
On 1/19/06, *Stephen Smith* <gp@xxxxxxxxxxxxxxxxxxxxxxxx
<mailto:gp@xxxxxxxxxxxxxxxxxxxxxxxx>> wrote:
I think this problem is purely with Java on Linux, but if anyone can
think of a workaround it would be much appreciated.
Basically, I have two functions, KeyPressed() and KeyReleased(),
which
normally get called (only) when a key is pressed and then released
respectively. However, if you hold a key down when running it on
Linux,
it fires each one pretty much constantly in turn for as long as
the key
is held down. My program is a network client for my game, and I
send
keypress and keyrelease signals to the server. With the above
symptoms
though, the server gets clogged up with constant signals from each
client when a single key is held down.
It is a known "symptom" of Java under Linux, but can anyone think
of a
work around?
Thanks in advance,
Stephen
---------------------
To unsubscribe go to http://gameprogrammer.com/mailinglist.html
<http://gameprogrammer.com/mailinglist.html>
--
Paul Smith
Computer programmer
paul@xxxxxxxxxxxxxxxxxx <mailto:paul@xxxxxxxxxxxxxxxxxx>
---------------------
To unsubscribe go to http://gameprogrammer.com/mailinglist.html
---------------------
To unsubscribe go to http://gameprogrammer.com/mailinglist.html
- Follow-Ups:
- [gameprogrammer] Re: Key Repeat problem
- From: David Olofson
- References:
- [gameprogrammer] Key Repeat problem
- From: Stephen Smith
- [gameprogrammer] Re: Key Repeat problem
- From: Paul Smith
- [gameprogrammer] Re: Key Repeat problem
- From: Jake Briggs
- [gameprogrammer] Re: Key Repeat problem
- From: Stephen Smith
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
Steve
Jake Briggs wrote:
Or maybe store the state, only pass the message on to the network server if the state changes. The state would store whether the key is pressed or not....
Paul Smith wrote:
Maybe in your KeyPressed function store a timestamp in a static variable and the next time the function is called only pass the message on to the network server if the time elapsed is greater than a certain number of milliseconds?
On 1/19/06, *Stephen Smith* <gp@xxxxxxxxxxxxxxxxxxxxxxxx <mailto:gp@xxxxxxxxxxxxxxxxxxxxxxxx>> wrote:
I think this problem is purely with Java on Linux, but if anyone can think of a workaround it would be much appreciated.
Basically, I have two functions, KeyPressed() and KeyReleased(), which
normally get called (only) when a key is pressed and then released
respectively. However, if you hold a key down when running it on
Linux,
it fires each one pretty much constantly in turn for as long as
the key
is held down. My program is a network client for my game, and I send
keypress and keyrelease signals to the server. With the above
symptoms
though, the server gets clogged up with constant signals from each
client when a single key is held down.
It is a known "symptom" of Java under Linux, but can anyone think of a work around?
Thanks in advance,
Stephen
--------------------- To unsubscribe go to http://gameprogrammer.com/mailinglist.html <http://gameprogrammer.com/mailinglist.html>
-- Paul Smith Computer programmer
paul@xxxxxxxxxxxxxxxxxx <mailto:paul@xxxxxxxxxxxxxxxxxx>
--------------------- To unsubscribe go to http://gameprogrammer.com/mailinglist.html
--------------------- To unsubscribe go to http://gameprogrammer.com/mailinglist.html
- [gameprogrammer] Re: Key Repeat problem
- From: David Olofson
- [gameprogrammer] Key Repeat problem
- From: Stephen Smith
- [gameprogrammer] Re: Key Repeat problem
- From: Paul Smith
- [gameprogrammer] Re: Key Repeat problem
- From: Jake Briggs
- [gameprogrammer] Re: Key Repeat problem
- From: Stephen Smith