Mercurial > sdl-ios-xcode
comparison test/testsprite2.c @ 3183:d1436442215f
Support for 15/16/24/32 bpps of icon.bmp has been added, in case if not an original icon.bmp (8bpp with palette) is used for tests.
author | Mike Gorchak <lestat@i.com.ua> |
---|---|
date | Wed, 10 Jun 2009 05:54:19 +0000 |
parents | 9dde605c7540 |
children | 51750b7a966f |
comparison
equal
deleted
inserted
replaced
3182:9f82979eaaf0 | 3183:d1436442215f |
---|---|
56 sprite_h = temp->h; | 56 sprite_h = temp->h; |
57 | 57 |
58 /* Set transparent pixel as the pixel at (0,0) */ | 58 /* Set transparent pixel as the pixel at (0,0) */ |
59 if (temp->format->palette) { | 59 if (temp->format->palette) { |
60 SDL_SetColorKey(temp, SDL_SRCCOLORKEY, *(Uint8 *) temp->pixels); | 60 SDL_SetColorKey(temp, SDL_SRCCOLORKEY, *(Uint8 *) temp->pixels); |
61 } else { | |
62 switch (temp->format->BitsPerPixel) { | |
63 case 15: | |
64 SDL_SetColorKey(temp, SDL_SRCCOLORKEY, (*(Uint16 *) temp->pixels) & 0x00007FFF); | |
65 break; | |
66 case 16: | |
67 SDL_SetColorKey(temp, SDL_SRCCOLORKEY, *(Uint16 *) temp->pixels); | |
68 break; | |
69 case 24: | |
70 SDL_SetColorKey(temp, SDL_SRCCOLORKEY, (*(Uint32 *) temp->pixels) & 0x00FFFFFF); | |
71 break; | |
72 case 32: | |
73 SDL_SetColorKey(temp, SDL_SRCCOLORKEY, *(Uint32 *) temp->pixels); | |
74 break; | |
75 } | |
61 } | 76 } |
62 | 77 |
63 /* Create textures from the image */ | 78 /* Create textures from the image */ |
64 for (i = 0; i < state->num_windows; ++i) { | 79 for (i = 0; i < state->num_windows; ++i) { |
65 SDL_SelectRenderer(state->windows[i]); | 80 SDL_SelectRenderer(state->windows[i]); |