| 56 | #define SDL_CONTROLLER_BUTTON_RIGHT_TRIGGER (SDL_CONTROLLER_BUTTON_MAX + 2) |
| 57 | |
| 58 | int GetKeyFromGameControllerButton(SDL_GameControllerButton button) |
| 59 | { |
| 60 | switch (button) |
| 61 | { |
| 62 | case SDL_CONTROLLER_BUTTON_DPAD_UP: { return SDLK_q; } // -- camera translate up |
| 63 | case SDL_CONTROLLER_BUTTON_DPAD_DOWN: { return SDLK_z; } // -- camera translate down |
| 64 | case SDL_CONTROLLER_BUTTON_DPAD_LEFT: { return SDLK_h; } // -- hide GUI |
| 65 | case SDL_CONTROLLER_BUTTON_DPAD_RIGHT: { return -1; } // -- unassigned |
| 66 | case SDL_CONTROLLER_BUTTON_START: { return SDLK_RETURN; } // -- start selected scene |
| 67 | case SDL_CONTROLLER_BUTTON_BACK: { return SDLK_ESCAPE; } // -- quit |
| 68 | case SDL_CONTROLLER_BUTTON_LEFTSHOULDER: { return SDLK_UP; } // -- select prev scene |
| 69 | case SDL_CONTROLLER_BUTTON_RIGHTSHOULDER: { return SDLK_DOWN; } // -- select next scene |
| 70 | case SDL_CONTROLLER_BUTTON_A: { return SDLK_g; } // -- toggle gravity |
| 71 | case SDL_CONTROLLER_BUTTON_B: { return SDLK_p; } // -- pause |
| 72 | case SDL_CONTROLLER_BUTTON_X: { return SDLK_r; } // -- reset |
| 73 | case SDL_CONTROLLER_BUTTON_Y: { return SDLK_o; } // -- step sim |
| 74 | case SDL_CONTROLLER_BUTTON_RIGHT_TRIGGER: { return SDLK_SPACE; } // -- emit particles |
| 75 | default: { return -1; } // -- nop |
| 76 | }; |
| 77 | }; |
| 78 | |
| 79 | // |
| 80 | // Gamepad thresholds taken from XINPUT API |
no outgoing calls
no test coverage detected