mirror of
https://github.com/shadowfacts/lwjgl2-arm64.git
synced 2026-04-04 14:07:52 +00:00
fix: isStateKeySet now returning int
This commit is contained in:
parent
16ea129071
commit
f27e5a294c
4 changed files with 38 additions and 15 deletions
|
|
@ -188,6 +188,10 @@ public class Keyboard {
|
|||
public static final int KEY_APPS = 0xDD; /* AppMenu key */
|
||||
public static final int KEY_POWER = 0xDE;
|
||||
public static final int KEY_SLEEP = 0xDF;
|
||||
|
||||
public static final int STATE_ON = 0;
|
||||
public static final int STATE_OFF = 1;
|
||||
public static final int STATE_UNKNOWN = 2;
|
||||
|
||||
/** Key names */
|
||||
private static final String[] keyName = new String[255];
|
||||
|
|
@ -402,13 +406,13 @@ public class Keyboard {
|
|||
* Checks whether one of the state keys are "active"
|
||||
*
|
||||
* @param key State key to test (KEY_CAPITAL | KEY_NUMLOCK | KEY_SYSRQ)
|
||||
* @return true if state key is on
|
||||
* @return STATE_ON if on, STATE_OFF if off and STATE_UNKNOWN if the state is unknown
|
||||
*/
|
||||
public static boolean isStateKeySet(int key) {
|
||||
public static int isStateKeySet(int key) {
|
||||
assert created : "The keyboard has not been created.";
|
||||
return nisStateKeySet(key);
|
||||
}
|
||||
private static native boolean nisStateKeySet(int key);
|
||||
private static native int nisStateKeySet(int key);
|
||||
|
||||
/**
|
||||
* Gets a key's name
|
||||
|
|
|
|||
|
|
@ -159,15 +159,15 @@ public class KeyboardTest {
|
|||
position.y -= 1;
|
||||
}
|
||||
|
||||
if(Keyboard.isStateKeySet(Keyboard.KEY_SCROLL)) {
|
||||
if(Keyboard.isStateKeySet(Keyboard.KEY_SCROLL) == Keyboard.STATE_ON) {
|
||||
System.out.println("SCROLL lock on");
|
||||
}
|
||||
|
||||
if(Keyboard.isStateKeySet(Keyboard.KEY_CAPITAL)) {
|
||||
if(Keyboard.isStateKeySet(Keyboard.KEY_CAPITAL) == Keyboard.STATE_ON) {
|
||||
System.out.println("CAPS lock on");
|
||||
}
|
||||
|
||||
if(Keyboard.isStateKeySet(Keyboard.KEY_NUMLOCK)) {
|
||||
if(Keyboard.isStateKeySet(Keyboard.KEY_NUMLOCK) == Keyboard.STATE_ON) {
|
||||
System.out.println("NUM lock on");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue