Revision: 3828
http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3828&view=rev
Author: spasi
Date: 2012-11-20 10:42:54 +0000 (Tue, 20 Nov 2012)
Log Message:
-----------
Fixed GetAsyncKeyState usage. We read the MSB, not the LSB.
Modified Paths:
--------------
trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsKeyboard.java
Modified: trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsKeyboard.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsKeyboard.java 2012-11-14 21:06:09 UTC (rev 3827)
+++ trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsKeyboard.java 2012-11-20 10:42:54 UTC (rev 3828)
@@ -154,6 +154,10 @@
return (state & 1) == 1;
}
+ private static boolean isKeyPressedAsync(int state) {
+ return (state >>> 31) == 1;
+ }
+
public void handleKey(int virt_key, int scan_code, boolean extended, byte event_state, long millis, boolean repeat) {
virt_key = translateExtended(virt_key, scan_code, event_state, extended);
if ( !repeat && isKeyPressed(event_state) == isKeyPressed(virt_key_down_buffer[virt_key]) )
@@ -176,7 +180,7 @@
public void fireLostKeyEvents() {
for ( int i = 0; i < virt_key_down_buffer.length; i++ ) {
- if ( isKeyPressed(virt_key_down_buffer[i]) && !isKeyPressed(GetAsyncKeyState(i)) )
+ if ( isKeyPressed(virt_key_down_buffer[i]) && !isKeyPressedAsync(GetAsyncKeyState(i)) )
handleKey(i, 0, false, (byte)0, System.currentTimeMillis(), false);
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|