| 39 | } |
| 40 | |
| 41 | bool GetButtonState(const Gamepad::State& state, GamepadButton button, float deadZone) |
| 42 | { |
| 43 | if (deadZone > 0.01f) |
| 44 | { |
| 45 | switch (button) |
| 46 | { |
| 47 | case GamepadButton::LeftTrigger: |
| 48 | case GamepadButton::RightTrigger: |
| 49 | case GamepadButton::LeftStickUp: |
| 50 | case GamepadButton::LeftStickDown: |
| 51 | case GamepadButton::LeftStickLeft: |
| 52 | case GamepadButton::LeftStickRight: |
| 53 | case GamepadButton::RightStickUp: |
| 54 | case GamepadButton::RightStickDown: |
| 55 | case GamepadButton::RightStickLeft: |
| 56 | case GamepadButton::RightStickRight: |
| 57 | { |
| 58 | bool positive; |
| 59 | float axis = state.Axis[(int32)GetButtonAxis(button, positive)]; |
| 60 | return positive ? axis >= deadZone : axis <= -deadZone; |
| 61 | } |
| 62 | default: |
| 63 | break; |
| 64 | } |
| 65 | } |
| 66 | return state.Buttons[(int32)button]; |
| 67 | } |
| 68 | } |
| 69 | |
| 70 | void GamepadLayout::Init() |
no test coverage detected