fix: creation of buttons array now occurs in java side
This commit is contained in:
parent
f08389fdd2
commit
0d1cc7583b
|
@ -54,7 +54,7 @@ public class Mouse {
|
||||||
private static boolean created;
|
private static boolean created;
|
||||||
|
|
||||||
/** The mouse buttons status from the last poll */
|
/** The mouse buttons status from the last poll */
|
||||||
private static boolean[] buttons = new boolean[4];
|
private static boolean[] buttons;
|
||||||
|
|
||||||
/** Delta X */
|
/** Delta X */
|
||||||
public static int dx;
|
public static int dx;
|
||||||
|
@ -107,6 +107,9 @@ public class Mouse {
|
||||||
if (!nCreate())
|
if (!nCreate())
|
||||||
throw new Exception("The mouse could not be created.");
|
throw new Exception("The mouse could not be created.");
|
||||||
created = true;
|
created = true;
|
||||||
|
|
||||||
|
//set mouse buttons
|
||||||
|
buttons = new boolean[buttonCount];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -123,6 +126,8 @@ public class Mouse {
|
||||||
if (!created)
|
if (!created)
|
||||||
return;
|
return;
|
||||||
created = false;
|
created = false;
|
||||||
|
buttons = null;
|
||||||
|
|
||||||
nDestroy();
|
nDestroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -152,6 +157,6 @@ public class Mouse {
|
||||||
*/
|
*/
|
||||||
public static boolean isButtonDown(int button) {
|
public static boolean isButtonDown(int button) {
|
||||||
assert created : "The mouse has not been created.";
|
assert created : "The mouse has not been created.";
|
||||||
return Mouse.buttons[button];
|
return buttons[button];
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue