diff test/testalpha.c @ 2267:c785543d1843

Okay, still some bugs, but everything builds again...
author Sam Lantinga <slouken@libsdl.org>
date Sat, 18 Aug 2007 05:39:09 +0000
parents c121d94672cb
children 44e49d3fa6cf
line wrap: on
line diff
--- 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));