InputManager.GetKeyboard().GetState() returns wrong states for isKeyUp and isKeyDown

Feb 6, 2011 at 2:38 PM

I tried using the PC Keyboard through the InputManager but it produces the wrong results when checking the keyboard state for IsKeyUp or IsKeyDown.

input.GetKeyboard().GetState().IsKeyDown(Keys.Down);
input.GetKeyboard().GetState().IsKeyUp(Keys.Down);

produced the opposite of the expected result. i.e. When the button was pressed IsKeyDown returned false and vice versa.

XNA Frameworks Keyboard.GetState() however produces the correct results:
Keyboard.GetState().IsKeyDown(Keys.Down);
Keyboard.GetState().IsKeyUp(Keys.Down);

No worries I just use the XNA Frameworks keyboard. I thought it was worth reporting the issue though.
(I've used Nuclex Framework R1323)

Thanks for all the work done on Nuclex.Input :o)

BR
/Sam

Coordinator
Feb 6, 2011 at 4:13 PM

You're right, I switched two statements in BufferedKeyboard.cs (lines 161 and 166). Fix is committed to SVN :)

It's always worth reporting - especially well researched bugs like this one where I spot the problem and fix it in under a minute :)

Thanks!

Feb 7, 2011 at 1:21 PM

Great!

Downloaded the new source. Works now.

BR
/Sam