| 1396 | } |
| 1397 | |
| 1398 | int |
| 1399 | SDL_GameControllerInit(void) |
| 1400 | { |
| 1401 | int i; |
| 1402 | |
| 1403 | /* watch for joy events and fire controller ones if needed */ |
| 1404 | SDL_AddEventWatch(SDL_GameControllerEventWatcher, NULL); |
| 1405 | |
| 1406 | /* Send added events for controllers currently attached */ |
| 1407 | for (i = 0; i < SDL_NumJoysticks(); ++i) { |
| 1408 | if (SDL_IsGameController(i)) { |
| 1409 | SDL_Event deviceevent; |
| 1410 | deviceevent.type = SDL_CONTROLLERDEVICEADDED; |
| 1411 | deviceevent.cdevice.which = i; |
| 1412 | SDL_PushEvent(&deviceevent); |
| 1413 | } |
| 1414 | } |
| 1415 | |
| 1416 | return (0); |
| 1417 | } |
| 1418 | |
| 1419 | |
| 1420 | /* |
no test coverage detected