comparison src/video/SDL_video.c @ 4977:85969cc5098c

Use a valid window when creating the default renderer
author Sam Lantinga <slouken@libsdl.org>
date Wed, 12 Jan 2011 13:38:10 -0800
parents aa8888658021
children 4a7f284a82b2
comparison
equal deleted inserted replaced
4976:3811132c584f 4977:85969cc5098c
1044 if (!_this) { 1044 if (!_this) {
1045 SDL_UninitializedVideo(); 1045 SDL_UninitializedVideo();
1046 return NULL; 1046 return NULL;
1047 } 1047 }
1048 if (!SDL_CurrentRenderer) { 1048 if (!SDL_CurrentRenderer) {
1049 SDL_Window *window = NULL;
1050
1049 if (!create) { 1051 if (!create) {
1050 SDL_SetError("Use SDL_CreateRenderer() to create a renderer"); 1052 SDL_SetError("Use SDL_CreateRenderer() to create a renderer");
1051 return NULL; 1053 return NULL;
1052 } 1054 }
1053 if (SDL_CreateRenderer(0, -1, 0) < 0) { 1055
1056 /* Get the first window on the first display */
1057 if (_this->num_displays > 0) {
1058 window = _this->displays[0].windows;
1059 }
1060
1061 if (SDL_CreateRenderer(window, -1, 0) < 0) {
1054 return NULL; 1062 return NULL;
1055 } 1063 }
1056 } 1064 }
1057 return SDL_CurrentRenderer; 1065 return SDL_CurrentRenderer;
1058 } 1066 }