Mercurial > sdl-ios-xcode
comparison test/testspriteminimal.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 |
comparison
equal
deleted
inserted
replaced
5160:657543cc92f9 | 5161:b3ccd1947786 |
---|---|
58 break; | 58 break; |
59 } | 59 } |
60 } | 60 } |
61 | 61 |
62 /* Create textures from the image */ | 62 /* Create textures from the image */ |
63 sprite = SDL_CreateTextureFromSurface(renderer, 0, temp); | 63 sprite = SDL_CreateTextureFromSurface(renderer, temp); |
64 if (!sprite) { | |
65 SDL_SetColorKey(temp, 0, 0); | |
66 sprite = SDL_CreateTextureFromSurface(renderer, 0, temp); | |
67 } | |
68 if (!sprite) { | 64 if (!sprite) { |
69 fprintf(stderr, "Couldn't create texture: %s\n", SDL_GetError()); | 65 fprintf(stderr, "Couldn't create texture: %s\n", SDL_GetError()); |
70 SDL_FreeSurface(temp); | 66 SDL_FreeSurface(temp); |
71 return (-1); | 67 return (-1); |
72 } | 68 } |