Mercurial > sdl-ios-xcode
comparison test/testsprite2.c @ 5161:b3ccd1947786
Simplified and improved the process of creating a texture from a surface.
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Thu, 03 Feb 2011 00:54:29 -0800 |
parents | ad50b3db78bd |
children | d976b67150c5 |
comparison
equal
deleted
inserted
replaced
5160:657543cc92f9 | 5161:b3ccd1947786 |
---|---|
75 } | 75 } |
76 | 76 |
77 /* Create textures from the image */ | 77 /* Create textures from the image */ |
78 for (i = 0; i < state->num_windows; ++i) { | 78 for (i = 0; i < state->num_windows; ++i) { |
79 SDL_Renderer *renderer = state->renderers[i]; | 79 SDL_Renderer *renderer = state->renderers[i]; |
80 sprites[i] = SDL_CreateTextureFromSurface(renderer, 0, temp); | 80 sprites[i] = SDL_CreateTextureFromSurface(renderer, temp); |
81 if (!sprites[i]) { | |
82 SDL_SetColorKey(temp, 0, 0); | |
83 sprites[i] = SDL_CreateTextureFromSurface(renderer, 0, temp); | |
84 } | |
85 if (!sprites[i]) { | 81 if (!sprites[i]) { |
86 fprintf(stderr, "Couldn't create texture: %s\n", SDL_GetError()); | 82 fprintf(stderr, "Couldn't create texture: %s\n", SDL_GetError()); |
87 SDL_FreeSurface(temp); | 83 SDL_FreeSurface(temp); |
88 return (-1); | 84 return (-1); |
89 } | 85 } |