comparison test/testsprite2.c @ 3285:0d7b20a4a629

Fall back to opaque sprite if no formats with alpha are supported.
author Sam Lantinga <slouken@libsdl.org>
date Sun, 20 Sep 2009 23:09:30 +0000
parents 7856dfe3a44f
children 0267b8b1595c
comparison
equal deleted inserted replaced
3284:2b95b2c0b6d4 3285:0d7b20a4a629
79 79
80 /* Create textures from the image */ 80 /* Create textures from the image */
81 for (i = 0; i < state->num_windows; ++i) { 81 for (i = 0; i < state->num_windows; ++i) {
82 SDL_SelectRenderer(state->windows[i]); 82 SDL_SelectRenderer(state->windows[i]);
83 sprites[i] = SDL_CreateTextureFromSurface(0, temp); 83 sprites[i] = SDL_CreateTextureFromSurface(0, temp);
84 if (!sprites[i]) {
85 SDL_SetColorKey(temp, 0, 0);
86 sprites[i] = SDL_CreateTextureFromSurface(0, temp);
87 }
84 if (!sprites[i]) { 88 if (!sprites[i]) {
85 fprintf(stderr, "Couldn't create texture: %s\n", SDL_GetError()); 89 fprintf(stderr, "Couldn't create texture: %s\n", SDL_GetError());
86 SDL_FreeSurface(temp); 90 SDL_FreeSurface(temp);
87 return (-1); 91 return (-1);
88 } 92 }