comparison src/video/win32/SDL_win32modes.c @ 3521:76f9b76ddf0f

Don't add any renderers if you can't add any displays
author Sam Lantinga <slouken@libsdl.org>
date Fri, 04 Dec 2009 09:01:48 +0000
parents 4b594623401b
children 59ff7a2beb57
comparison
equal deleted inserted replaced
3520:83518f8fcd61 3521:76f9b76ddf0f
155 display.driverdata = displaydata; 155 display.driverdata = displaydata;
156 SDL_AddVideoDisplay(&display); 156 SDL_AddVideoDisplay(&display);
157 return SDL_TRUE; 157 return SDL_TRUE;
158 } 158 }
159 159
160 void 160 int
161 WIN_InitModes(_THIS) 161 WIN_InitModes(_THIS)
162 { 162 {
163 SDL_VideoData *data = (SDL_VideoData *) _this->driverdata; 163 SDL_VideoData *data = (SDL_VideoData *) _this->driverdata;
164 DWORD i, j, count; 164 DWORD i, j, count;
165 DISPLAY_DEVICE device; 165 DISPLAY_DEVICE device;
190 } 190 }
191 if (count == 0) { 191 if (count == 0) {
192 WIN_AddDisplay(DeviceName); 192 WIN_AddDisplay(DeviceName);
193 } 193 }
194 } 194 }
195 if (_this->num_displays == 0) {
196 SDL_SetError("No displays available");
197 return -1;
198 }
199 return 0;
195 } 200 }
196 201
197 void 202 void
198 WIN_GetDisplayModes(_THIS, SDL_VideoDisplay * display) 203 WIN_GetDisplayModes(_THIS, SDL_VideoDisplay * display)
199 { 204 {
203 208
204 for (i = 0;; ++i) { 209 for (i = 0;; ++i) {
205 if (!WIN_GetDisplayMode(data->DeviceName, i, &mode)) { 210 if (!WIN_GetDisplayMode(data->DeviceName, i, &mode)) {
206 break; 211 break;
207 } 212 }
208 if (mode.format != SDL_PIXELFORMAT_UNKNOWN) 213 if (mode.format != SDL_PIXELFORMAT_UNKNOWN) {
209 if (!SDL_AddDisplayMode(display, &mode)) { 214 if (!SDL_AddDisplayMode(display, &mode)) {
210 SDL_free(mode.driverdata); 215 SDL_free(mode.driverdata);
211 } 216 }
217 }
212 } 218 }
213 } 219 }
214 220
215 int 221 int
216 WIN_SetDisplayMode(_THIS, SDL_VideoDisplay * display, SDL_DisplayMode * mode) 222 WIN_SetDisplayMode(_THIS, SDL_VideoDisplay * display, SDL_DisplayMode * mode)