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

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%403835
This commit is contained in:
Sam Lantinga 2009-09-20 23:09:30 +00:00
parent 4309e3326a
commit 0a027f75d0

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);