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:
parent
4309e3326a
commit
0a027f75d0
1 changed files with 4 additions and 0 deletions
|
@ -81,6 +81,10 @@ LoadSprite(char *file)
|
||||||
for (i = 0; i < state->num_windows; ++i) {
|
for (i = 0; i < state->num_windows; ++i) {
|
||||||
SDL_SelectRenderer(state->windows[i]);
|
SDL_SelectRenderer(state->windows[i]);
|
||||||
sprites[i] = SDL_CreateTextureFromSurface(0, temp);
|
sprites[i] = SDL_CreateTextureFromSurface(0, temp);
|
||||||
|
if (!sprites[i]) {
|
||||||
|
SDL_SetColorKey(temp, 0, 0);
|
||||||
|
sprites[i] = SDL_CreateTextureFromSurface(0, temp);
|
||||||
|
}
|
||||||
if (!sprites[i]) {
|
if (!sprites[i]) {
|
||||||
fprintf(stderr, "Couldn't create texture: %s\n", SDL_GetError());
|
fprintf(stderr, "Couldn't create texture: %s\n", SDL_GetError());
|
||||||
SDL_FreeSurface(temp);
|
SDL_FreeSurface(temp);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue