Run the renderer so Steam can find the main window
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54
diff --git a/test/controllermap.c b/test/controllermap.c
index f81528e..144c603 100644
--- a/test/controllermap.c
+++ b/test/controllermap.c
@@ -165,6 +165,7 @@ static Uint32 s_unPendingAdvanceTime;
static SDL_bool s_bBindingComplete;
static SDL_Window *window;
+static SDL_Renderer *screen;
static SDL_bool done = SDL_FALSE;
SDL_Texture *
@@ -375,7 +376,6 @@ BMergeAxisBindings(int iIndex)
static void
WatchJoystick(SDL_Joystick * joystick)
{
- SDL_Renderer *screen = NULL;
SDL_Texture *background_front, *background_back, *button, *axis, *marker;
const char *name = NULL;
SDL_Event event;
@@ -384,12 +384,6 @@ WatchJoystick(SDL_Joystick * joystick)
Uint32 alpha_ticks = 0;
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_back = LoadTexture(screen, "controllermap_back.bmp", SDL_FALSE);
button = LoadTexture(screen, "button.bmp", SDL_TRUE);
@@ -746,6 +740,12 @@ main(int argc, char *argv[])
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) {
SDL_Event event;
@@ -763,6 +763,7 @@ main(int argc, char *argv[])
break;
}
}
+ SDL_RenderPresent(screen);
}
/* Print information about the joysticks */