Fixed keyboard bugs

This commit is contained in:
Andrea Cavalli 2017-12-24 12:57:36 +01:00
parent 2d1f6b0e81
commit 9dc4bcd6aa
2 changed files with 10 additions and 109 deletions

View File

@ -272,6 +272,15 @@ public class Keyboard {
Keyboard.keyPressed(Key.NONE);
}
break;
case KeyEvent.VK_M:
if (!Keyboard.shift && !Keyboard.alpha) {
Keyboard.keyPressed(Key.SURD_MODE);
} else if (Keyboard.shift) {
Keyboard.keyPressed(Key.NONE);
} else {
Keyboard.keyPressed(Key.NONE);
}
break;
case com.jogamp.newt.event.KeyEvent.VK_ADD:
case KeyEvent.VK_ADD:
if (!Keyboard.shift && !Keyboard.alpha) {

View File

@ -88,115 +88,7 @@ public class SwingWindow extends JFrame {
@Override
public void keyReleased(KeyEvent arg0) {
switch (arg0.getKeyCode()) {
case KeyEvent.VK_ESCAPE:
Keyboard.keyReleased(Key.POWER);
break;
case KeyEvent.VK_D:
Keyboard.keyReleased(Key.debug_DEG);
break;
case KeyEvent.VK_R:
Keyboard.keyReleased(Key.debug_RAD);
break;
case KeyEvent.VK_G:
Keyboard.keyReleased(Key.debug_GRA);
break;
case KeyEvent.VK_X:
if (Keyboard.alpha) {
Keyboard.keyReleased(Key.LETTER_X);
} else {
Keyboard.keyReleased(Key.NONE);
}
break;
case KeyEvent.VK_P:
if (Keyboard.alpha) {
Keyboard.keyReleased(Key.PI);
} else {
Keyboard.keyReleased(Key.NONE);
}
break;
case KeyEvent.VK_B:
if (Keyboard.shift) {
Keyboard.keyReleased(Key.BRIGHTNESS_CYCLE_REVERSE);
} else if (!Keyboard.shift && !Keyboard.alpha) {
Keyboard.keyReleased(Key.BRIGHTNESS_CYCLE);
} else {
Keyboard.keyReleased(Key.NONE);
}
break;
case KeyEvent.VK_ENTER:
if (!Keyboard.shift && !Keyboard.alpha) {
Keyboard.keyReleased(Key.SIMPLIFY);
} else {
Keyboard.keyReleased(Key.NONE);
}
int row = 2;
int col = 1;
Keyboard.debugKeysDown[row - 1][col - 1] = false;
break;
case KeyEvent.VK_1:
if (!Keyboard.shift && !Keyboard.alpha) {
Keyboard.keyReleased(Key.debug1);
} else {
Keyboard.keyReleased(Key.NONE);
}
break;
case KeyEvent.VK_2:
if (!Keyboard.shift && !Keyboard.alpha) {
Keyboard.keyReleased(Key.debug2);
} else {
Keyboard.keyReleased(Key.NONE);
}
break;
case KeyEvent.VK_3:
if (!Keyboard.shift && !Keyboard.alpha) {
Keyboard.keyReleased(Key.debug3);
} else {
Keyboard.keyReleased(Key.NONE);
}
break;
case KeyEvent.VK_4:
if (!Keyboard.shift && !Keyboard.alpha) {
Keyboard.keyReleased(Key.debug4);
} else {
Keyboard.keyReleased(Key.NONE);
}
break;
case KeyEvent.VK_5:
if (!Keyboard.shift && !Keyboard.alpha) {
Keyboard.keyReleased(Key.debug5);
} else {
Keyboard.keyReleased(Key.NONE);
}
break;
case KeyEvent.VK_SHIFT:
Keyboard.keyReleased(Key.SHIFT);
if (Keyboard.shift) {
Keyboard.keyPressed(Key.SHIFT);
Keyboard.keyReleased(Key.SHIFT);
}
break;
case KeyEvent.VK_A:
Keyboard.keyReleased(Key.ALPHA);
if (Keyboard.alpha) {
Keyboard.keyPressed(Key.ALPHA);
Keyboard.keyReleased(Key.ALPHA);
}
break;
case KeyEvent.VK_M:
Keyboard.keyPressed(Key.SURD_MODE);
break;
case KeyEvent.VK_LEFT:
//LEFT
row = 2;
col = 3;
Keyboard.debugKeysDown[row - 1][col - 1] = false;
case KeyEvent.VK_RIGHT:
//RIGHT
row = 2;
col = 5;
Keyboard.debugKeysDown[row - 1][col - 1] = false;
}
}
@Override