Removed enableBuffer() and enableTranslation() from the public API.
This commit is contained in:
parent
953e0f7982
commit
69bc20f3f5
|
@ -48,8 +48,6 @@ import org.lwjgl.LWJGLException;
|
||||||
* <br>
|
* <br>
|
||||||
* A raw Keyboard interface. This can be used to poll the current state of the
|
* 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.
|
* 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 cix_foo <cix_foo@users.sourceforge.net>
|
||||||
* @author elias_naur <elias_naur@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,
|
* 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.
|
* a 2 byte java char representing the translated character.
|
||||||
*/
|
*/
|
||||||
private static IntBuffer readBuffer;
|
private static IntBuffer readBuffer;
|
||||||
|
@ -295,6 +293,8 @@ public class Keyboard {
|
||||||
return;
|
return;
|
||||||
Display.getImplementation().createKeyboard();
|
Display.getImplementation().createKeyboard();
|
||||||
created = true;
|
created = true;
|
||||||
|
enableBuffer();
|
||||||
|
enableTranslation();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -318,11 +318,9 @@ public class Keyboard {
|
||||||
* Polls the keyboard for its current state. Access the polled values using the
|
* Polls the keyboard for its current state. Access the polled values using the
|
||||||
* <code>isKeyDown</code> method.
|
* <code>isKeyDown</code> method.
|
||||||
* By using this method, it is possible to "miss" keyboard keys if you don't
|
* 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
|
* poll fast enough.
|
||||||
* <code>enableBuffer</code>.
|
|
||||||
*
|
*
|
||||||
* This method also reads all keyboard events since last read if keyboard buffering is enabled.
|
* To use buffered values, you have to call <code>next</code> for each event you
|
||||||
* To use these 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
|
* 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>getEventKey</code>. To get the state of that key, for that event, use
|
||||||
* <code>getEventKeyState</code> - finally use <code>getEventCharacter</code> to get the
|
* <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#isKeyDown(int key)
|
||||||
* @see org.lwjgl.input.Keyboard#isStateKeySet(int key)
|
* @see org.lwjgl.input.Keyboard#isStateKeySet(int key)
|
||||||
* @see org.lwjgl.input.Keyboard#next()
|
* @see org.lwjgl.input.Keyboard#next()
|
||||||
* @see org.lwjgl.input.Keyboard#enableBuffer()
|
|
||||||
* @see org.lwjgl.input.Keyboard#getEventKey()
|
* @see org.lwjgl.input.Keyboard#getEventKey()
|
||||||
* @see org.lwjgl.input.Keyboard#getEventKeyState()
|
* @see org.lwjgl.input.Keyboard#getEventKeyState()
|
||||||
* @see org.lwjgl.input.Keyboard#getEventCharacter()
|
* @see org.lwjgl.input.Keyboard#getEventCharacter()
|
||||||
|
@ -355,7 +352,7 @@ public class Keyboard {
|
||||||
* Enable keyboard translation. Must be called after the keyboard is created,
|
* Enable keyboard translation. Must be called after the keyboard is created,
|
||||||
* and keyboard buffering must be enabled.
|
* and keyboard buffering must be enabled.
|
||||||
*/
|
*/
|
||||||
public static void enableTranslation() throws LWJGLException {
|
private static void enableTranslation() throws LWJGLException {
|
||||||
if (!created)
|
if (!created)
|
||||||
throw new IllegalStateException("Keyboard must be created before you can read events");
|
throw new IllegalStateException("Keyboard must be created before you can read events");
|
||||||
if (readBuffer == null)
|
if (readBuffer == null)
|
||||||
|
@ -367,7 +364,7 @@ public class Keyboard {
|
||||||
/**
|
/**
|
||||||
* Enable keyboard buffering. Must be called after the keyboard is created.
|
* 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)
|
if (!created)
|
||||||
throw new IllegalStateException("Keyboard must be created before you can enable buffering");
|
throw new IllegalStateException("Keyboard must be created before you can enable buffering");
|
||||||
readBuffer = BufferUtils.createIntBuffer(EVENT_SIZE*BUFFER_SIZE);
|
readBuffer = BufferUtils.createIntBuffer(EVENT_SIZE*BUFFER_SIZE);
|
||||||
|
@ -386,20 +383,6 @@ public class Keyboard {
|
||||||
return keyDownBuffer.get(key) != 0;
|
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"
|
* Checks whether one of the state keys are "active"
|
||||||
*
|
*
|
||||||
|
|
|
@ -270,6 +270,7 @@ public class Mouse {
|
||||||
if (currentCursor != null)
|
if (currentCursor != null)
|
||||||
setNativeCursor(currentCursor);
|
setNativeCursor(currentCursor);
|
||||||
setGrabbed(isGrabbed);
|
setGrabbed(isGrabbed);
|
||||||
|
enableBuffer();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -279,13 +280,6 @@ public class Mouse {
|
||||||
return created;
|
return created;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @return true if buffering is enabled
|
|
||||||
*/
|
|
||||||
public static boolean isBuffered() {
|
|
||||||
return readBuffer != null;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* "Destroy" the mouse.
|
* "Destroy" the mouse.
|
||||||
*/
|
*/
|
||||||
|
@ -302,11 +296,9 @@ public class Mouse {
|
||||||
* Polls the mouse for its current state. Access the polled values using the
|
* Polls the mouse for its current state. Access the polled values using the
|
||||||
* get<value> methods.
|
* get<value> methods.
|
||||||
* By using this method, it is possible to "miss" mouse click events if you don't
|
* 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
|
* poll fast enough.
|
||||||
* <code>enableBuffer</code>.
|
|
||||||
*
|
*
|
||||||
* If buffering is enabled, this method also reads all button events since last read.
|
* To use buffered values, you have to call <code>next</code> for each event you
|
||||||
* To use these 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
|
* 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>getEventButton</code>. To get the state of that button, for that event, use
|
||||||
* <code>getEventButtonState</code>.
|
* <code>getEventButtonState</code>.
|
||||||
|
@ -320,7 +312,6 @@ public class Mouse {
|
||||||
* @see org.lwjgl.input.Mouse#getDX()
|
* @see org.lwjgl.input.Mouse#getDX()
|
||||||
* @see org.lwjgl.input.Mouse#getDY()
|
* @see org.lwjgl.input.Mouse#getDY()
|
||||||
* @see org.lwjgl.input.Mouse#getDWheel()
|
* @see org.lwjgl.input.Mouse#getDWheel()
|
||||||
* @see org.lwjgl.input.Mouse#enableBuffer()
|
|
||||||
*/
|
*/
|
||||||
public static void poll() {
|
public static void poll() {
|
||||||
if (!created) throw new IllegalStateException("Mouse must be created before you can poll it");
|
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.
|
* 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");
|
if (!created) throw new IllegalStateException("Mouse must be created before you can enable buffering");
|
||||||
readBuffer = BufferUtils.createIntBuffer(EVENT_SIZE * BUFFER_SIZE);
|
readBuffer = BufferUtils.createIntBuffer(EVENT_SIZE * BUFFER_SIZE);
|
||||||
readBuffer.limit(0);
|
readBuffer.limit(0);
|
||||||
|
|
|
@ -565,7 +565,6 @@ public final class Display {
|
||||||
if (!Mouse.isCreated() && !Boolean.getBoolean("org.lwjgl.opengl.Display.nomouse")) {
|
if (!Mouse.isCreated() && !Boolean.getBoolean("org.lwjgl.opengl.Display.nomouse")) {
|
||||||
try {
|
try {
|
||||||
Mouse.create();
|
Mouse.create();
|
||||||
Mouse.enableBuffer();
|
|
||||||
} catch (LWJGLException e) {
|
} catch (LWJGLException e) {
|
||||||
if (Sys.DEBUG) {
|
if (Sys.DEBUG) {
|
||||||
e.printStackTrace(System.err);
|
e.printStackTrace(System.err);
|
||||||
|
@ -577,8 +576,6 @@ public final class Display {
|
||||||
if (!Keyboard.isCreated() && !Boolean.getBoolean("org.lwjgl.opengl.Display.nokeyboard")) {
|
if (!Keyboard.isCreated() && !Boolean.getBoolean("org.lwjgl.opengl.Display.nokeyboard")) {
|
||||||
try {
|
try {
|
||||||
Keyboard.create();
|
Keyboard.create();
|
||||||
Keyboard.enableBuffer();
|
|
||||||
Keyboard.enableTranslation();
|
|
||||||
} catch (LWJGLException e) {
|
} catch (LWJGLException e) {
|
||||||
if (Sys.DEBUG) {
|
if (Sys.DEBUG) {
|
||||||
e.printStackTrace(System.err);
|
e.printStackTrace(System.err);
|
||||||
|
|
|
@ -127,8 +127,6 @@ public class KeyboardTest {
|
||||||
private void createKeyboard() {
|
private void createKeyboard() {
|
||||||
try {
|
try {
|
||||||
Keyboard.create();
|
Keyboard.create();
|
||||||
Keyboard.enableBuffer();
|
|
||||||
Keyboard.enableTranslation();
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
System.exit(-1);
|
System.exit(-1);
|
||||||
|
|
Loading…
Reference in New Issue