Fall back to opaque sprite if no formats with alpha are supported.

This commit is contained in:
Sam Lantinga
2009-09-20 23:09:30 +00:00
parent 2bf654253f
commit 8ced47d33f

View File

@@ -81,6 +81,10 @@ LoadSprite(char *file)
for (i = 0; i < state->num_windows; ++i) {
SDL_SelectRenderer(state->windows[i]);
sprites[i] = SDL_CreateTextureFromSurface(0, temp);
if (!sprites[i]) {
SDL_SetColorKey(temp, 0, 0);
sprites[i] = SDL_CreateTextureFromSurface(0, temp);
}
if (!sprites[i]) {
fprintf(stderr, "Couldn't create texture: %s\n", SDL_GetError());
SDL_FreeSurface(temp);