Fixed some JNI errors. One remains.
This commit is contained in:
parent
0060b68efd
commit
be9286b6a0
|
@ -29,7 +29,7 @@
|
||||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.lwjgl.input;
|
package org.lwjgl.input;
|
||||||
|
|
||||||
import org.lwjgl.Display;
|
import org.lwjgl.Display;
|
||||||
|
@ -50,37 +50,37 @@ import org.lwjgl.Sys;
|
||||||
*/
|
*/
|
||||||
public class Mouse {
|
public class Mouse {
|
||||||
|
|
||||||
|
/** Has the mouse been created? */
|
||||||
|
private static boolean created;
|
||||||
|
|
||||||
|
/** The mouse buttons status from the last poll */
|
||||||
|
private static boolean[] buttons = new boolean[4];
|
||||||
|
|
||||||
|
/** Delta X */
|
||||||
|
public static int dx;
|
||||||
|
|
||||||
|
/** Delta Y */
|
||||||
|
public static int dy;
|
||||||
|
|
||||||
|
/** Delta Z */
|
||||||
|
public static int dwheel;
|
||||||
|
|
||||||
|
/** Number of buttons supported by the mouse */
|
||||||
|
public static int buttonCount = -1;
|
||||||
|
|
||||||
|
/** Does this mouse support a scroll wheel */
|
||||||
|
public static boolean hasWheel = false;
|
||||||
|
|
||||||
static {
|
static {
|
||||||
initialize();
|
initialize();
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Has the mouse been created? */
|
|
||||||
private static boolean created;
|
|
||||||
|
|
||||||
/** The mouse buttons status from the last poll */
|
|
||||||
private static boolean[] buttons;
|
|
||||||
|
|
||||||
/** Delta X */
|
|
||||||
public static int dx;
|
|
||||||
|
|
||||||
/** Delta Y */
|
|
||||||
public static int dy;
|
|
||||||
|
|
||||||
/** Delta Z */
|
|
||||||
public static int dwheel;
|
|
||||||
|
|
||||||
/** Number of buttons supported by the mouse */
|
|
||||||
public static int buttonCount = -1;
|
|
||||||
|
|
||||||
/** Does this mouse support a scroll wheel */
|
|
||||||
public static boolean hasWheel = false;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Mouse cannot be constructed.
|
* Mouse cannot be constructed.
|
||||||
*/
|
*/
|
||||||
private Mouse() {
|
private Mouse() {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Static initialization
|
* Static initialization
|
||||||
*/
|
*/
|
||||||
|
@ -88,15 +88,15 @@ public class Mouse {
|
||||||
System.loadLibrary(Sys.getLibraryName());
|
System.loadLibrary(Sys.getLibraryName());
|
||||||
initIDs();
|
initIDs();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Register fields with the native library
|
* Register fields with the native library
|
||||||
*/
|
*/
|
||||||
private static native void initIDs();
|
private static native void initIDs();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* "Create" the mouse. The display must first have been created.
|
* "Create" the mouse. The display must first have been created.
|
||||||
*
|
*
|
||||||
* @throws Exception if the mouse could not be created for any reason
|
* @throws Exception if the mouse could not be created for any reason
|
||||||
*/
|
*/
|
||||||
public static void create() throws Exception {
|
public static void create() throws Exception {
|
||||||
|
@ -108,7 +108,7 @@ public class Mouse {
|
||||||
throw new Exception("The mouse could not be created.");
|
throw new Exception("The mouse could not be created.");
|
||||||
created = true;
|
created = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Native method to create the mouse
|
* Native method to create the mouse
|
||||||
*
|
*
|
||||||
|
@ -125,7 +125,7 @@ public class Mouse {
|
||||||
created = false;
|
created = false;
|
||||||
nDestroy();
|
nDestroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Native method the destroy the mouse
|
* Native method the destroy the mouse
|
||||||
*/
|
*/
|
||||||
|
@ -137,13 +137,13 @@ public class Mouse {
|
||||||
public static void poll() {
|
public static void poll() {
|
||||||
assert created : "The mouse has not been created.";
|
assert created : "The mouse has not been created.";
|
||||||
nPoll();
|
nPoll();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Native method to poll the mouse
|
* Native method to poll the mouse
|
||||||
*/
|
*/
|
||||||
private static native void nPoll();
|
private static native void nPoll();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* See if a particular mouse button is down.
|
* See if a particular mouse button is down.
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in New Issue