From 0d1cc7583bb6a3a4987c4825e103d68131c3c796 Mon Sep 17 00:00:00 2001 From: Brian Matzon Date: Mon, 24 Mar 2003 16:58:10 +0000 Subject: [PATCH] fix: creation of buttons array now occurs in java side --- src/java/org/lwjgl/input/Mouse.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/java/org/lwjgl/input/Mouse.java b/src/java/org/lwjgl/input/Mouse.java index 7d81c8ca..8f9580a0 100644 --- a/src/java/org/lwjgl/input/Mouse.java +++ b/src/java/org/lwjgl/input/Mouse.java @@ -54,7 +54,7 @@ public class Mouse { private static boolean created; /** The mouse buttons status from the last poll */ - private static boolean[] buttons = new boolean[4]; + private static boolean[] buttons; /** Delta X */ public static int dx; @@ -107,6 +107,9 @@ public class Mouse { if (!nCreate()) throw new Exception("The mouse could not be created."); created = true; + + //set mouse buttons + buttons = new boolean[buttonCount]; } /** @@ -123,6 +126,8 @@ public class Mouse { if (!created) return; created = false; + buttons = null; + nDestroy(); } @@ -152,6 +157,6 @@ public class Mouse { */ public static boolean isButtonDown(int button) { assert created : "The mouse has not been created."; - return Mouse.buttons[button]; + return buttons[button]; } } \ No newline at end of file