| 121 | } |
| 122 | |
| 123 | bool Gamepad::Update(EventQueue& queue) |
| 124 | { |
| 125 | // Copy state |
| 126 | Platform::MemoryCopy(&_mappedPrevState, &_mappedState, sizeof(State)); |
| 127 | _mappedState.Clear(); |
| 128 | |
| 129 | // Gather current state |
| 130 | if (UpdateState()) |
| 131 | return true; |
| 132 | |
| 133 | // Map state |
| 134 | for (int32 i = 0; i < (int32)GamepadButton::MAX; i++) |
| 135 | { |
| 136 | auto e = Layout.Buttons[i]; |
| 137 | _mappedState.Buttons[static_cast<int32>(e)] = _state.Buttons[i]; |
| 138 | } |
| 139 | for (int32 i = 0; i < (int32)GamepadAxis::MAX; i++) |
| 140 | { |
| 141 | auto e = Layout.Axis[i]; |
| 142 | float value = _state.Axis[i]; |
| 143 | value = Layout.AxisMap[i].X * value + Layout.AxisMap[i].Y; |
| 144 | _mappedState.Axis[static_cast<int32>(e)] = value; |
| 145 | } |
| 146 | |
| 147 | return false; |
| 148 | } |
nothing calls this directly
no test coverage detected