Run the renderer so Steam can find the main window

This commit is contained in:
Sam Lantinga 2021-08-03 01:25:54 -07:00
parent 1907463a7e
commit 3d74707830
1 changed files with 8 additions and 7 deletions

View File

@ -165,6 +165,7 @@ static Uint32 s_unPendingAdvanceTime;
static SDL_bool s_bBindingComplete; static SDL_bool s_bBindingComplete;
static SDL_Window *window; static SDL_Window *window;
static SDL_Renderer *screen;
static SDL_bool done = SDL_FALSE; static SDL_bool done = SDL_FALSE;
SDL_Texture * SDL_Texture *
@ -375,7 +376,6 @@ BMergeAxisBindings(int iIndex)
static void static void
WatchJoystick(SDL_Joystick * joystick) WatchJoystick(SDL_Joystick * joystick)
{ {
SDL_Renderer *screen = NULL;
SDL_Texture *background_front, *background_back, *button, *axis, *marker; SDL_Texture *background_front, *background_back, *button, *axis, *marker;
const char *name = NULL; const char *name = NULL;
SDL_Event event; SDL_Event event;
@ -384,12 +384,6 @@ WatchJoystick(SDL_Joystick * joystick)
Uint32 alpha_ticks = 0; Uint32 alpha_ticks = 0;
SDL_JoystickID nJoystickID; SDL_JoystickID nJoystickID;
screen = SDL_CreateRenderer(window, -1, 0);
if (screen == NULL) {
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create renderer: %s\n", SDL_GetError());
return;
}
background_front = LoadTexture(screen, "controllermap.bmp", SDL_FALSE); background_front = LoadTexture(screen, "controllermap.bmp", SDL_FALSE);
background_back = LoadTexture(screen, "controllermap_back.bmp", SDL_FALSE); background_back = LoadTexture(screen, "controllermap_back.bmp", SDL_FALSE);
button = LoadTexture(screen, "button.bmp", SDL_TRUE); button = LoadTexture(screen, "button.bmp", SDL_TRUE);
@ -746,6 +740,12 @@ main(int argc, char *argv[])
return 2; return 2;
} }
screen = SDL_CreateRenderer(window, -1, 0);
if (screen == NULL) {
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create renderer: %s\n", SDL_GetError());
return 2;
}
while (!done && SDL_NumJoysticks() == 0) { while (!done && SDL_NumJoysticks() == 0) {
SDL_Event event; SDL_Event event;
@ -763,6 +763,7 @@ main(int argc, char *argv[])
break; break;
} }
} }
SDL_RenderPresent(screen);
} }
/* Print information about the joysticks */ /* Print information about the joysticks */