Keyboard.isKeyDown Bug

Started by laginimaineb, May 04, 2007, 20:10:38

Previous topic - Next topic

laginimaineb

Hello, I am currently using the new release of LWJGL in my new game (to be released at 2008  :P). Anyway, I have stumbled across something which I believe is a bug (I am not 100% sure). It appears that Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) returns true when only the Left Shift button is down, however, when another key such as one of the arrow keys, is pressed whilst the Left Shift is down - the method returns false. Perhaps this is not a bug, however, it is unexpected.

With Thanks,
laginimaineb.

bobjob

im currently running windowsXP dont have that problem

System.out.println(Keyboard.isKeyDown(Keyboard.KEY_LSHIFT));

i put that im my main game loop, and displayed true when shift was down, even when other keys are down.

could it be that in your keyboard check you have done something like:

if {
} else if {
} else if {
}

instead of
if {
}
if {
}
if {
}

i know its a basic idea but i cant think of anything else :-\

laginimaineb

No, I actually created a new program to test this. In my program the only thing I do is print out the states of several keys including the Left Shift (no elses, just ifs :P). Anyway, this is easily reproducible and I'll be happy to send you the sample program. (By the way, I just noticed I am using 1.0 which is actually not the most current edition, maybe this has already been fixed).

With Thanks,
laginimaineb.

bobjob

try make a program that prints ONLY the state of shift, then press other keys with shift, if it that works fine then the problem is in the coding, otherwise thats bizzzzar

:P gotta get you back   ;)

laginimaineb

I have built a simple application which only prints out whether or not the Left Shift button is pressed. The application shows that when a different key is pressed after the Left Shift, the method suddenly returns false, even though the shift is still pressed.

With Thanks,
laginimaineb.

Matzon

some keyboards have a limit as to how many keys can be registered as being down at the same time, though this is usually within a region. You might have such a keyboard.

laginimaineb

Oh ok, thanks. Didn't think my keyboard would be limited to 2 keys, though (it only takes another key press to cancel the Shift) since I just bought this new Microsoft keyboard. Oh well, good to know.

With thanks,
laginimaineb.