MCPcopy Create free account
hub / github.com/RavEngine/RavEngine / SDL_GameControllerInit

Function SDL_GameControllerInit

deps/SDL2/src/joystick/SDL_gamecontroller.c:1398–1417  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1396}
1397
1398int
1399SDL_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/*

Callers 1

SDL_InitSubSystemFunction · 0.85

Calls 4

SDL_AddEventWatchFunction · 0.85
SDL_NumJoysticksFunction · 0.85
SDL_IsGameControllerFunction · 0.85
SDL_PushEventFunction · 0.85

Tested by

no test coverage detected