Skip to content
This repository has been archived by the owner on Feb 11, 2021. It is now read-only.

Commit

Permalink
Use a valid window when creating the default renderer
Browse files Browse the repository at this point in the history
  • Loading branch information
slouken committed Jan 12, 2011
1 parent 6b641ca commit 83729fb
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/video/SDL_video.c
Expand Up @@ -1046,11 +1046,19 @@ SDL_GetCurrentRenderer(SDL_bool create)
return NULL;
}
if (!SDL_CurrentRenderer) {
SDL_Window *window = NULL;

if (!create) {
SDL_SetError("Use SDL_CreateRenderer() to create a renderer");
return NULL;
}
if (SDL_CreateRenderer(0, -1, 0) < 0) {

/* Get the first window on the first display */
if (_this->num_displays > 0) {
window = _this->displays[0].windows;
}

if (SDL_CreateRenderer(window, -1, 0) < 0) {
return NULL;
}
}
Expand Down

0 comments on commit 83729fb

Please sign in to comment.