()
| 400 | } |
| 401 | |
| 402 | private void readButtons() { |
| 403 | if (readGLFWJoystick()) { |
| 404 | boolean hasMapping = !useManualMapping && controllerMapping != null; |
| 405 | boolean b0 = getButton(hasMapping ? controllerMapping.button0 : null, button0); |
| 406 | boolean b0rapid = getButton(hasMapping ? controllerMapping.button0rapid : null, button0rapid); |
| 407 | boolean b1 = getButton(hasMapping ? controllerMapping.button1 : null, button1); |
| 408 | boolean b1rapid = getButton(hasMapping ? controllerMapping.button1rapid : null, button1rapid); |
| 409 | boolean pause = getButton(hasMapping ? controllerMapping.pause : null); |
| 410 | |
| 411 | if (b0rapid) { |
| 412 | if (button0heldSince == 0) { |
| 413 | button0heldSince = System.currentTimeMillis(); |
| 414 | } else { |
| 415 | long timeHeld = System.currentTimeMillis() - button0heldSince; |
| 416 | int intervalNumber = (int) (timeHeld / rapidFireInterval); |
| 417 | b0 = (intervalNumber % 2 == 0); |
| 418 | } |
| 419 | } else { |
| 420 | button0heldSince = 0; |
| 421 | } |
| 422 | |
| 423 | if (b1rapid) { |
| 424 | if (button1heldSince == 0) { |
| 425 | button1heldSince = System.currentTimeMillis(); |
| 426 | } else { |
| 427 | long timeHeld = System.currentTimeMillis() - button1heldSince; |
| 428 | int intervalNumber = (int) (timeHeld / rapidFireInterval); |
| 429 | b1 = (intervalNumber % 2 == 0); |
| 430 | } |
| 431 | } else { |
| 432 | button1heldSince = 0; |
| 433 | } |
| 434 | |
| 435 | if (pause) { |
| 436 | if (!justPaused) { |
| 437 | // Paste the esc character |
| 438 | Keyboard.pasteFromString("\u001b"); |
| 439 | } |
| 440 | justPaused = true; |
| 441 | } else { |
| 442 | justPaused = false; |
| 443 | } |
| 444 | |
| 445 | SoftSwitches.PB0.getSwitch().setState(b0 || Keyboard.isOpenApplePressed); |
| 446 | SoftSwitches.PB1.getSwitch().setState(b1 || Keyboard.isClosedApplePressed); |
| 447 | } |
| 448 | } |
| 449 | |
| 450 | @Override |
| 451 | protected String getDeviceName() { |
no test coverage detected