(Controller controller, int buttonIndex, boolean keyDown)
| 1577 | } |
| 1578 | } |
| 1579 | private void translateButtons(Controller controller, int buttonIndex, boolean keyDown) { |
| 1580 | if (!hasGamepad()) |
| 1581 | return; //adventure only |
| 1582 | if (!keyDown) |
| 1583 | return; //prevent keyup on forgescene |
| 1584 | //overlay shoud have priority |
| 1585 | FContainer container = FOverlay.getTopOverlay(); |
| 1586 | if (container == null) { |
| 1587 | container = currentScreen; |
| 1588 | } |
| 1589 | if (container != null) { |
| 1590 | if (currentScreen instanceof MatchScreen) { |
| 1591 | if (controller.getMapping().buttonL2 == buttonIndex) {//others are axis-4 |
| 1592 | container.keyDown(Keys.ENTER); |
| 1593 | } |
| 1594 | if (controller.getMapping().buttonR2 == buttonIndex) {//others are axis-5 |
| 1595 | container.keyDown(Keys.ESCAPE); |
| 1596 | } |
| 1597 | if (controller.getMapping().buttonX == buttonIndex) { |
| 1598 | container.keyDown(Keys.BUTTON_X); |
| 1599 | } |
| 1600 | if (controller.getMapping().buttonY == buttonIndex) { |
| 1601 | container.keyDown(Keys.BUTTON_Y); |
| 1602 | } |
| 1603 | if (controller.getMapping().buttonR1 == buttonIndex) { |
| 1604 | container.keyDown(Keys.BUTTON_R1); |
| 1605 | } |
| 1606 | if (controller.getMapping().buttonL1 == buttonIndex) { |
| 1607 | container.keyDown(Keys.BUTTON_L1); |
| 1608 | } |
| 1609 | if (controller.getMapping().buttonDpadDown == buttonIndex) { |
| 1610 | container.keyDown(Keys.DPAD_DOWN); |
| 1611 | } |
| 1612 | if (controller.getMapping().buttonDpadLeft == buttonIndex) { |
| 1613 | container.keyDown(Keys.DPAD_LEFT); |
| 1614 | } |
| 1615 | if (controller.getMapping().buttonDpadRight == buttonIndex) { |
| 1616 | container.keyDown(Keys.DPAD_RIGHT); |
| 1617 | } |
| 1618 | if (controller.getMapping().buttonDpadUp == buttonIndex) { |
| 1619 | container.keyDown(Keys.DPAD_UP); |
| 1620 | } |
| 1621 | if (controller.getMapping().buttonA == buttonIndex) { |
| 1622 | container.keyDown(Keys.BUTTON_A); |
| 1623 | } |
| 1624 | if (controller.getMapping().buttonB == buttonIndex) { |
| 1625 | container.keyDown(Keys.BUTTON_B); |
| 1626 | } |
| 1627 | if (controller.getMapping().buttonBack == buttonIndex) { |
| 1628 | container.keyDown(Keys.BUTTON_SELECT); |
| 1629 | } |
| 1630 | } else {//Others |
| 1631 | /*if (controller.getMapping().buttonL2 == buttonIndex) {//others are axis-4 |
| 1632 | container.keyDown(Keys.ENTER); |
| 1633 | } |
| 1634 | if (controller.getMapping().buttonR2 == buttonIndex) {//others are axis-5 |
| 1635 | container.keyDown(Keys.ESCAPE); |
| 1636 | }*/ |
no test coverage detected