remove dead/unused keyrepeat code
This commit is contained in:
parent
c67b96d3dc
commit
6850b59b84
|
@ -43,7 +43,7 @@ import static org.lwjgl.input.Keyboard.*;
|
||||||
*
|
*
|
||||||
* @author kevin
|
* @author kevin
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings({"rawtypes", "unchecked", "unused"})
|
@SuppressWarnings({"unused"})
|
||||||
public class Input {
|
public class Input {
|
||||||
|
|
||||||
/** A helper for left ALT */
|
/** A helper for left ALT */
|
||||||
|
@ -98,8 +98,6 @@ public class Input {
|
||||||
protected char[] keys = new char[1024];
|
protected char[] keys = new char[1024];
|
||||||
/** True if the key has been pressed since last queries */
|
/** True if the key has been pressed since last queries */
|
||||||
protected boolean[] pressed = new boolean[1024];
|
protected boolean[] pressed = new boolean[1024];
|
||||||
/** The time since the next key repeat to be fired for the key */
|
|
||||||
protected long[] nextRepeat = new long[1024];
|
|
||||||
|
|
||||||
/** The listeners to notify of key events */
|
/** The listeners to notify of key events */
|
||||||
protected ArrayList<KeyListener> keyListeners = new ArrayList<>();
|
protected ArrayList<KeyListener> keyListeners = new ArrayList<>();
|
||||||
|
@ -113,13 +111,6 @@ public class Input {
|
||||||
/** True if the display is active */
|
/** True if the display is active */
|
||||||
private boolean displayActive = true;
|
private boolean displayActive = true;
|
||||||
|
|
||||||
/** True if key repeat is enabled */
|
|
||||||
private boolean keyRepeat;
|
|
||||||
/** The initial delay for key repeat starts */
|
|
||||||
private int keyRepeatInitial;
|
|
||||||
/** The interval of key repeat */
|
|
||||||
private int keyRepeatInterval;
|
|
||||||
|
|
||||||
/** The clicked button */
|
/** The clicked button */
|
||||||
private int clickButton;
|
private int clickButton;
|
||||||
|
|
||||||
|
@ -344,7 +335,6 @@ public class Input {
|
||||||
|
|
||||||
keys[eventKey] = Keyboard.getEventCharacter();
|
keys[eventKey] = Keyboard.getEventCharacter();
|
||||||
pressed[eventKey] = true;
|
pressed[eventKey] = true;
|
||||||
nextRepeat[eventKey] = System.currentTimeMillis() + keyRepeatInitial;
|
|
||||||
|
|
||||||
for (KeyListener listener : keyListeners) {
|
for (KeyListener listener : keyListeners) {
|
||||||
if (listener.keyPressed(eventKey, Keyboard.getEventCharacter())) {
|
if (listener.keyPressed(eventKey, Keyboard.getEventCharacter())) {
|
||||||
|
@ -353,7 +343,6 @@ public class Input {
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
int eventKey = Keyboard.getEventKey();
|
int eventKey = Keyboard.getEventKey();
|
||||||
nextRepeat[eventKey] = 0;
|
|
||||||
|
|
||||||
for (KeyListener listener : keyListeners) {
|
for (KeyListener listener : keyListeners) {
|
||||||
if (listener.keyReleased(eventKey, keys[eventKey])) {
|
if (listener.keyReleased(eventKey, keys[eventKey])) {
|
||||||
|
@ -425,21 +414,6 @@ public class Input {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (keyRepeat) {
|
|
||||||
for (int i=0;i<1024;i++) {
|
|
||||||
if (pressed[i] && (nextRepeat[i] != 0)) {
|
|
||||||
if (System.currentTimeMillis() > nextRepeat[i]) {
|
|
||||||
nextRepeat[i] = System.currentTimeMillis() + keyRepeatInterval;
|
|
||||||
for (KeyListener listener : keyListeners) {
|
|
||||||
if (listener.keyPressed(i, keys[i])) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Display.isCreated()) {
|
if (Display.isCreated()) {
|
||||||
displayActive = Display.isActive();
|
displayActive = Display.isActive();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user