test/testsprite.c
changeset 663 8bedd6d61642
parent 587 f00ccf8d8edc
child 753 b14fdadd8311
equal deleted inserted replaced
662:66c02f83f5bf 663:8bedd6d61642
    52 	return(0);
    52 	return(0);
    53 }
    53 }
    54 
    54 
    55 void MoveSprites(SDL_Surface *screen, Uint32 background)
    55 void MoveSprites(SDL_Surface *screen, Uint32 background)
    56 {
    56 {
    57 #if DEBUG_FLIP
       
    58     static int t = 0;
       
    59 #endif
       
    60 
       
    61 	int i, nupdates;
    57 	int i, nupdates;
    62 	SDL_Rect area, *position, *velocity;
    58 	SDL_Rect area, *position, *velocity;
    63 
    59 
    64 	nupdates = 0;
    60 	nupdates = 0;
    65 	/* Erase all the sprites if necessary */
    61 	/* Erase all the sprites if necessary */
    88 		sprite_rects[nupdates++] = area;
    84 		sprite_rects[nupdates++] = area;
    89 	}
    85 	}
    90 
    86 
    91 #if DEBUG_FLIP
    87 #if DEBUG_FLIP
    92     {
    88     {
    93         Uint32 color = SDL_MapRGB (screen->format, 255, 0, 0);
    89 	if ( (screen->flags & SDL_DOUBLEBUF) == SDL_DOUBLEBUF ) {
    94         SDL_Rect r;
    90             static int t = 0;
    95         r.x = (sin((float)t * 2 * 3.1459) + 1.0) / 2.0 * (screen->w-20);
    91 
    96         r.y = 0;
    92             Uint32 color = SDL_MapRGB (screen->format, 255, 0, 0);
    97         r.w = 20;
    93             SDL_Rect r;
    98         r.h = screen->h;
    94             r.x = (sin((float)t * 2 * 3.1459) + 1.0) / 2.0 * (screen->w-20);
       
    95             r.y = 0;
       
    96             r.w = 20;
       
    97             r.h = screen->h;
    99         
    98         
   100         SDL_FillRect (screen, &r, color);
    99             SDL_FillRect (screen, &r, color);
   101         t+=2;
   100             t+=2;
       
   101         }
   102     }
   102     }
   103 #endif
   103 #endif
   104     
   104     
   105 	/* Update the screen! */
   105 	/* Update the screen! */
   106 	if ( (screen->flags & SDL_DOUBLEBUF) == SDL_DOUBLEBUF ) {
   106 	if ( (screen->flags & SDL_DOUBLEBUF) == SDL_DOUBLEBUF ) {