| 232 | } |
| 233 | |
| 234 | void Input::Initialize() { |
| 235 | InitKeyTranslator(); |
| 236 | if (SDL_InitSubSystem(SDL_INIT_GAMECONTROLLER) < 0) { |
| 237 | FatalError("Error", "Could not initialize SDL_INIT_GAMECONTROLLER"); |
| 238 | } |
| 239 | if (SDL_InitSubSystem(SDL_INIT_JOYSTICK) < 0) { |
| 240 | FatalError("Error", "Could not initialize SDL_INIT_JOYSTICK"); |
| 241 | } |
| 242 | // if (SDL_InitSubSystem(SDL_INIT_HAPTIC) < 0) { |
| 243 | // FatalError("Error", "Could not initialize SDL_INIT_HAPTIC"); |
| 244 | // } |
| 245 | AddGameControllerDB(); |
| 246 | SDL_JoystickEventState(SDL_ENABLE); |
| 247 | for (int i = 0; i < SDL_NumJoysticks(); i++) { |
| 248 | OpenJoystick(i); |
| 249 | } |
| 250 | PrintControllers(open_joysticks_); |
| 251 | ProcessBindings(); |
| 252 | SetUpForXPlayers(0); |
| 253 | } |
| 254 | |
| 255 | void Input::Dispose() { |
| 256 | for (auto& open_joystick : open_joysticks_) { |
nothing calls this directly
no test coverage detected