| 1620 | } // namespace |
| 1621 | |
| 1622 | void DetectInputMethod(const SDL_Event &event, const ControllerButtonEvent &gamepadEvent) |
| 1623 | { |
| 1624 | ControlTypes inputType = GetInputTypeFromEvent(event); |
| 1625 | |
| 1626 | if (inputType == ControlTypes::None) |
| 1627 | return; |
| 1628 | |
| 1629 | #ifdef __vita__ |
| 1630 | if (inputType == ControlTypes::VirtualGamepad) { |
| 1631 | inputType = ControlTypes::Gamepad; |
| 1632 | } |
| 1633 | #endif |
| 1634 | |
| 1635 | #if HAS_KBCTRL == 1 |
| 1636 | if (inputType == ControlTypes::KeyboardAndMouse && gamepadEvent.button != ControllerButton_NONE) { |
| 1637 | inputType = ControlTypes::Gamepad; |
| 1638 | } |
| 1639 | #endif |
| 1640 | |
| 1641 | ControlTypes newControlDevice = inputType; |
| 1642 | ControlTypes newControlMode = inputType; |
| 1643 | if (ContinueSimulatedMouseEvent(event, gamepadEvent)) { |
| 1644 | newControlMode = ControlMode; |
| 1645 | } |
| 1646 | |
| 1647 | LogControlDeviceAndModeChange(newControlDevice, newControlMode); |
| 1648 | |
| 1649 | if (newControlDevice != ControlDevice) { |
| 1650 | ControlDevice = newControlDevice; |
| 1651 | |
| 1652 | #ifndef USE_SDL1 |
| 1653 | if (ControlDevice != ControlTypes::KeyboardAndMouse) { |
| 1654 | if (IsHardwareCursor()) |
| 1655 | SetHardwareCursor(CursorInfo::UnknownCursor()); |
| 1656 | } else { |
| 1657 | ResetCursor(); |
| 1658 | } |
| 1659 | if (ControlDevice == ControlTypes::Gamepad) { |
| 1660 | GamepadLayout newGamepadLayout = GameController::getLayout(event); |
| 1661 | if (newGamepadLayout != GamepadType) { |
| 1662 | LogGamepadChange(newGamepadLayout); |
| 1663 | GamepadType = newGamepadLayout; |
| 1664 | } |
| 1665 | } |
| 1666 | #endif |
| 1667 | } |
| 1668 | |
| 1669 | if (newControlMode != ControlMode) { |
| 1670 | ControlMode = newControlMode; |
| 1671 | CalculatePanelAreas(); |
| 1672 | } |
| 1673 | } |
| 1674 | |
| 1675 | void ProcessGameAction(const GameAction &action) |
| 1676 | { |
no test coverage detected