Removed enableBuffer() and enableTranslation() from the public API.

This commit is contained in:
Elias Naur 2005-01-10 08:19:28 +00:00
parent 953e0f7982
commit 69bc20f3f5
4 changed files with 11 additions and 42 deletions

View File

@ -48,8 +48,6 @@ import org.lwjgl.LWJGLException;
* <br>
* 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 <cix_foo@users.sourceforge.net>
* @author elias_naur <elias_naur@users.sourceforge.net>
@ -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
* <code>isKeyDown</code> 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
* <code>enableBuffer</code>.
* 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 <code>next</code> for each event you
* To use buffered values, you have to call <code>next</code> for each event you
* want to read. You can query which key caused the event by using
* <code>getEventKey</code>. To get the state of that key, for that event, use
* <code>getEventKeyState</code> - finally use <code>getEventCharacter</code> 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"
*

View File

@ -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<value> 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
* <code>enableBuffer</code>.
* 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 <code>next</code> for each event you
* To use buffered values, you have to call <code>next</code> for each event you
* want to read. You can query which button caused the event by using
* <code>getEventButton</code>. To get the state of that button, for that event, use
* <code>getEventButtonState</code>.
@ -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);

View File

@ -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);

View File

@ -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);