I am using windows 10 and sdl2. The SDL_INIT_GAMECONTROLLER flag must be initted or execution will not start. Here's some code from main (see the bottom comment at the gamecontroller init call):
SDL_Init(SDL_INIT_VIDEO);
int imgFlags = IMG_INIT_PNG;
if(!( IMG_Init(imgFlags) & imgFlags)) {
printf( "SDL_image could not initialize! SDL_image Error: %s\n", IMG_GetError() );
return 0;
}
SDL_ShowCursor(SDL_DISABLE);
SDL_Window* window = NULL;
window = SDL_CreateWindow("Anica", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, W, H,
SDL_WINDOW_SHOWN);
SDL_Renderer* renderer = NULL;
renderer = SDL_CreateRenderer(window, -1, SDL_RENDERER_ACCELERATED);
SDL_InitSubSystem(SDL_INIT_AUDIO);
SDL_InitSubSystem(SDL_INIT_EVENTS);
SDL_InitSubSystem(SDL_INIT_TIMER);
// If this sub system is not initted execution stops. If it is initted
// execution works fine. It takes 2-3 seconds for this call to finish which
// is really slow.
SDL_InitSubSystem(SDL_INIT_GAMECONTROLLER);
The window open and hangs until the gamecontroller init call is done (2-3 seconds) if the gamecontroller subsystem is initted. Then everything works fine. If the gamecontroller subsystem is not initted the window opens and hangs indefinitely.
I am using windows 10 if that makes any difference.
My partner does not have this issue using the same code on windows 10, which is confusing to both of us.