test/testsprite.c
changeset 587 f00ccf8d8edc
parent 529 21409a7a5fee
child 663 8bedd6d61642
     1.1 --- a/test/testsprite.c	Sat Feb 01 19:50:22 2003 +0000
     1.2 +++ b/test/testsprite.c	Sat Feb 01 19:56:45 2003 +0000
     1.3 @@ -8,6 +8,8 @@
     1.4  
     1.5  #include "SDL.h"
     1.6  
     1.7 +#define DEBUG_FLIP 1
     1.8 +
     1.9  #define NUM_SPRITES	100
    1.10  #define MAX_SPEED 	1
    1.11  
    1.12 @@ -52,6 +54,10 @@
    1.13  
    1.14  void MoveSprites(SDL_Surface *screen, Uint32 background)
    1.15  {
    1.16 +#if DEBUG_FLIP
    1.17 +    static int t = 0;
    1.18 +#endif
    1.19 +
    1.20  	int i, nupdates;
    1.21  	SDL_Rect area, *position, *velocity;
    1.22  
    1.23 @@ -82,6 +88,20 @@
    1.24  		sprite_rects[nupdates++] = area;
    1.25  	}
    1.26  
    1.27 +#if DEBUG_FLIP
    1.28 +    {
    1.29 +        Uint32 color = SDL_MapRGB (screen->format, 255, 0, 0);
    1.30 +        SDL_Rect r;
    1.31 +        r.x = (sin((float)t * 2 * 3.1459) + 1.0) / 2.0 * (screen->w-20);
    1.32 +        r.y = 0;
    1.33 +        r.w = 20;
    1.34 +        r.h = screen->h;
    1.35 +        
    1.36 +        SDL_FillRect (screen, &r, color);
    1.37 +        t+=2;
    1.38 +    }
    1.39 +#endif
    1.40 +    
    1.41  	/* Update the screen! */
    1.42  	if ( (screen->flags & SDL_DOUBLEBUF) == SDL_DOUBLEBUF ) {
    1.43  		SDL_Flip(screen);