test/testalpha.c
changeset 2267 c785543d1843
parent 1895 c121d94672cb
child 2710 44e49d3fa6cf
--- a/test/testalpha.c	Sat Aug 18 01:44:21 2007 +0000
+++ b/test/testalpha.c	Sat Aug 18 05:39:09 2007 +0000
@@ -253,7 +253,7 @@
 MoveSprite(SDL_Surface * screen, SDL_Surface * light)
 {
     SDL_Rect updates[2];
-    int alpha;
+    Uint8 alpha;
 
     /* Erase the sprite if it was visible */
     if (sprite_visible) {
@@ -290,10 +290,10 @@
     }
 
     /* Update transparency (fade in and out) */
-    alpha = sprite->format->alpha;
-    if ((alpha + alpha_vel) < 0) {
+    SDL_GetSurfaceAlphaMod(sprite, &alpha);
+    if (((int) alpha + alpha_vel) < 0) {
         alpha_vel = -alpha_vel;
-    } else if ((alpha + alpha_vel) > 255) {
+    } else if (((int) alpha + alpha_vel) > 255) {
         alpha_vel = -alpha_vel;
     }
     SDL_SetAlpha(sprite, SDL_SRCALPHA, (Uint8) (alpha + alpha_vel));