diff --git a/src/java/org/lwjgl/input/Keyboard.java b/src/java/org/lwjgl/input/Keyboard.java index c071652b..7d84cf6c 100644 --- a/src/java/org/lwjgl/input/Keyboard.java +++ b/src/java/org/lwjgl/input/Keyboard.java @@ -48,8 +48,6 @@ import org.lwjgl.LWJGLException; *
* A raw Keyboard interface. This can be used to poll the current state of the * keys, or read all the keyboard presses / releases since the last read. - * Buffering must be explicitly enabled; the size of the buffer is determined - * by the native implementation at its discretion. * * @author cix_foo * @author elias_naur @@ -244,7 +242,7 @@ public class Keyboard { /** * The key events from the last read: a sequence of pairs of key number, - * followed by state. If translation is enabled, the state is followed by + * followed by state. The state is followed by * a 2 byte java char representing the translated character. */ private static IntBuffer readBuffer; @@ -295,6 +293,8 @@ public class Keyboard { return; Display.getImplementation().createKeyboard(); created = true; + enableBuffer(); + enableTranslation(); } /** @@ -318,11 +318,9 @@ public class Keyboard { * Polls the keyboard for its current state. Access the polled values using the * isKeyDown method. * By using this method, it is possible to "miss" keyboard keys if you don't - * poll fast enough. To receive all events, enable buffering by calling - * enableBuffer. + * poll fast enough. * - * This method also reads all keyboard events since last read if keyboard buffering is enabled. - * To use these values, you have to call next for each event you + * To use buffered values, you have to call next for each event you * want to read. You can query which key caused the event by using * getEventKey. To get the state of that key, for that event, use * getEventKeyState - finally use getEventCharacter to get the @@ -331,7 +329,6 @@ public class Keyboard { * @see org.lwjgl.input.Keyboard#isKeyDown(int key) * @see org.lwjgl.input.Keyboard#isStateKeySet(int key) * @see org.lwjgl.input.Keyboard#next() - * @see org.lwjgl.input.Keyboard#enableBuffer() * @see org.lwjgl.input.Keyboard#getEventKey() * @see org.lwjgl.input.Keyboard#getEventKeyState() * @see org.lwjgl.input.Keyboard#getEventCharacter() @@ -355,7 +352,7 @@ public class Keyboard { * Enable keyboard translation. Must be called after the keyboard is created, * and keyboard buffering must be enabled. */ - public static void enableTranslation() throws LWJGLException { + private static void enableTranslation() throws LWJGLException { if (!created) throw new IllegalStateException("Keyboard must be created before you can read events"); if (readBuffer == null) @@ -367,7 +364,7 @@ public class Keyboard { /** * Enable keyboard buffering. Must be called after the keyboard is created. */ - public static void enableBuffer() throws LWJGLException { + private static void enableBuffer() throws LWJGLException { if (!created) throw new IllegalStateException("Keyboard must be created before you can enable buffering"); readBuffer = BufferUtils.createIntBuffer(EVENT_SIZE*BUFFER_SIZE); @@ -386,20 +383,6 @@ public class Keyboard { return keyDownBuffer.get(key) != 0; } - /** - * @return true if buffering is enabled - */ - public static boolean isBuffered() { - return readBuffer != null; - } - - /** - * @return true if translation is enabled - */ - public static boolean isTranslationEnabled() { - return translationEnabled; - } - /** * Checks whether one of the state keys are "active" * diff --git a/src/java/org/lwjgl/input/Mouse.java b/src/java/org/lwjgl/input/Mouse.java index 1afe3dfa..2d93b945 100644 --- a/src/java/org/lwjgl/input/Mouse.java +++ b/src/java/org/lwjgl/input/Mouse.java @@ -270,6 +270,7 @@ public class Mouse { if (currentCursor != null) setNativeCursor(currentCursor); setGrabbed(isGrabbed); + enableBuffer(); } /** @@ -279,13 +280,6 @@ public class Mouse { return created; } - /** - * @return true if buffering is enabled - */ - public static boolean isBuffered() { - return readBuffer != null; - } - /** * "Destroy" the mouse. */ @@ -302,11 +296,9 @@ public class Mouse { * Polls the mouse for its current state. Access the polled values using the * get methods. * By using this method, it is possible to "miss" mouse click events if you don't - * poll fast enough. To receive all button events, enable buffering by calling - * enableBuffer. + * poll fast enough. * - * If buffering is enabled, this method also reads all button events since last read. - * To use these values, you have to call next for each event you + * To use buffered values, you have to call next for each event you * want to read. You can query which button caused the event by using * getEventButton. To get the state of that button, for that event, use * getEventButtonState. @@ -320,7 +312,6 @@ public class Mouse { * @see org.lwjgl.input.Mouse#getDX() * @see org.lwjgl.input.Mouse#getDY() * @see org.lwjgl.input.Mouse#getDWheel() - * @see org.lwjgl.input.Mouse#enableBuffer() */ public static void poll() { if (!created) throw new IllegalStateException("Mouse must be created before you can poll it"); @@ -396,7 +387,7 @@ public class Mouse { /** * Enable mouse button buffering. Must be called after the mouse is created. */ - public static void enableBuffer() throws LWJGLException { + private static void enableBuffer() throws LWJGLException { if (!created) throw new IllegalStateException("Mouse must be created before you can enable buffering"); readBuffer = BufferUtils.createIntBuffer(EVENT_SIZE * BUFFER_SIZE); readBuffer.limit(0); diff --git a/src/java/org/lwjgl/opengl/Display.java b/src/java/org/lwjgl/opengl/Display.java index 3fb511d9..c2639d1c 100644 --- a/src/java/org/lwjgl/opengl/Display.java +++ b/src/java/org/lwjgl/opengl/Display.java @@ -565,7 +565,6 @@ public final class Display { if (!Mouse.isCreated() && !Boolean.getBoolean("org.lwjgl.opengl.Display.nomouse")) { try { Mouse.create(); - Mouse.enableBuffer(); } catch (LWJGLException e) { if (Sys.DEBUG) { e.printStackTrace(System.err); @@ -577,8 +576,6 @@ public final class Display { if (!Keyboard.isCreated() && !Boolean.getBoolean("org.lwjgl.opengl.Display.nokeyboard")) { try { Keyboard.create(); - Keyboard.enableBuffer(); - Keyboard.enableTranslation(); } catch (LWJGLException e) { if (Sys.DEBUG) { e.printStackTrace(System.err); diff --git a/src/java/org/lwjgl/test/input/KeyboardTest.java b/src/java/org/lwjgl/test/input/KeyboardTest.java index 3283588b..cbeadf32 100644 --- a/src/java/org/lwjgl/test/input/KeyboardTest.java +++ b/src/java/org/lwjgl/test/input/KeyboardTest.java @@ -127,8 +127,6 @@ public class KeyboardTest { private void createKeyboard() { try { Keyboard.create(); - Keyboard.enableBuffer(); - Keyboard.enableTranslation(); } catch (Exception e) { e.printStackTrace(); System.exit(-1);