| 138 | } // namespace |
| 139 | |
| 140 | bool IsControllerMotion(const SDL_Event &event) |
| 141 | { |
| 142 | #ifndef USE_SDL1 |
| 143 | if (event.type == SDL_CONTROLLERAXISMOTION) { |
| 144 | return IsAnyOf(event.caxis.axis, |
| 145 | SDL_CONTROLLER_AXIS_LEFTX, |
| 146 | SDL_CONTROLLER_AXIS_LEFTY, |
| 147 | SDL_CONTROLLER_AXIS_RIGHTX, |
| 148 | SDL_CONTROLLER_AXIS_RIGHTY); |
| 149 | } |
| 150 | #endif |
| 151 | |
| 152 | if (event.type == SDL_JOYAXISMOTION) { |
| 153 | switch (event.jaxis.axis) { |
| 154 | #ifdef JOY_AXIS_LEFTX |
| 155 | case JOY_AXIS_LEFTX: |
| 156 | return true; |
| 157 | #endif |
| 158 | #ifdef JOY_AXIS_LEFTX |
| 159 | case JOY_AXIS_LEFTY: |
| 160 | return true; |
| 161 | #endif |
| 162 | #ifdef JOY_AXIS_LEFTX |
| 163 | case JOY_AXIS_RIGHTX: |
| 164 | return true; |
| 165 | #endif |
| 166 | #ifdef JOY_AXIS_LEFTX |
| 167 | case JOY_AXIS_RIGHTY: |
| 168 | return true; |
| 169 | #endif |
| 170 | default: |
| 171 | return false; |
| 172 | } |
| 173 | } |
| 174 | |
| 175 | return false; |
| 176 | } |
| 177 | |
| 178 | // Updates motion state for mouse and joystick sticks. |
| 179 | void ProcessControllerMotion(const SDL_Event &event) |
no test coverage detected