test/testalpha.c
changeset 2267 c785543d1843
parent 1895 c121d94672cb
child 2710 44e49d3fa6cf
     1.1 --- a/test/testalpha.c	Sat Aug 18 01:44:21 2007 +0000
     1.2 +++ b/test/testalpha.c	Sat Aug 18 05:39:09 2007 +0000
     1.3 @@ -253,7 +253,7 @@
     1.4  MoveSprite(SDL_Surface * screen, SDL_Surface * light)
     1.5  {
     1.6      SDL_Rect updates[2];
     1.7 -    int alpha;
     1.8 +    Uint8 alpha;
     1.9  
    1.10      /* Erase the sprite if it was visible */
    1.11      if (sprite_visible) {
    1.12 @@ -290,10 +290,10 @@
    1.13      }
    1.14  
    1.15      /* Update transparency (fade in and out) */
    1.16 -    alpha = sprite->format->alpha;
    1.17 -    if ((alpha + alpha_vel) < 0) {
    1.18 +    SDL_GetSurfaceAlphaMod(sprite, &alpha);
    1.19 +    if (((int) alpha + alpha_vel) < 0) {
    1.20          alpha_vel = -alpha_vel;
    1.21 -    } else if ((alpha + alpha_vel) > 255) {
    1.22 +    } else if (((int) alpha + alpha_vel) > 255) {
    1.23          alpha_vel = -alpha_vel;
    1.24      }
    1.25      SDL_SetAlpha(sprite, SDL_SRCALPHA, (Uint8) (alpha + alpha_vel));