Don't add any renderers if you can't add any displays

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%404264
This commit is contained in:
Sam Lantinga 2009-12-04 09:01:48 +00:00
parent b6b1631cb5
commit a5eb078863
6 changed files with 22 additions and 7 deletions

View file

@ -157,7 +157,7 @@ WIN_AddDisplay(LPTSTR DeviceName)
return SDL_TRUE;
}
void
int
WIN_InitModes(_THIS)
{
SDL_VideoData *data = (SDL_VideoData *) _this->driverdata;
@ -192,6 +192,11 @@ WIN_InitModes(_THIS)
WIN_AddDisplay(DeviceName);
}
}
if (_this->num_displays == 0) {
SDL_SetError("No displays available");
return -1;
}
return 0;
}
void
@ -205,10 +210,11 @@ WIN_GetDisplayModes(_THIS, SDL_VideoDisplay * display)
if (!WIN_GetDisplayMode(data->DeviceName, i, &mode)) {
break;
}
if (mode.format != SDL_PIXELFORMAT_UNKNOWN)
if (mode.format != SDL_PIXELFORMAT_UNKNOWN) {
if (!SDL_AddDisplayMode(display, &mode)) {
SDL_free(mode.driverdata);
}
}
}
}