Get other axis navigation direction from gamepad or keyboard * @return {Vector2}
()
| 577 | /** Get other axis navigation direction from gamepad or keyboard |
| 578 | * @return {Vector2} */ |
| 579 | getNavigationOtherDirection() |
| 580 | { |
| 581 | if (uiSystem.navigationDirection === 2) |
| 582 | return 0; // other direction disabled |
| 583 | |
| 584 | const vertical = uiSystem.navigationDirection === 1; |
| 585 | if (isUsingGamepad) |
| 586 | { |
| 587 | const stick = gamepadStick(0, gamepadPrimary); |
| 588 | const dpad = gamepadDpad(gamepadPrimary); |
| 589 | return !vertical ? (stick.y || dpad.y) : (stick.x || dpad.x); |
| 590 | } |
| 591 | const back = !vertical ? 'ArrowUp' : 'ArrowLeft'; |
| 592 | const forward = !vertical ? 'ArrowDown' : 'ArrowRight'; |
| 593 | return keyIsDown(back) ? -1 : keyIsDown(forward) ? 1 : 0; |
| 594 | } |
| 595 | |
| 596 | /** Get if navigation button was pressed from gamepad or keyboard |
| 597 | * @return {boolean} */ |
no test coverage detected