1.1 --- a/test/graywin.c Tue May 28 19:24:11 2002 +0000
1.2 +++ b/test/graywin.c Tue May 28 19:31:32 2002 +0000
1.3 @@ -15,7 +15,7 @@
1.4 #endif
1.5
1.6 /* Draw a randomly sized and colored box centered about (X,Y) */
1.7 -void DrawBox(SDL_Surface *screen, int X, int Y)
1.8 +void DrawBox(SDL_Surface *screen, int X, int Y, int width, int height)
1.9 {
1.10 static unsigned int seeded = 0;
1.11 SDL_Rect area;
1.12 @@ -28,8 +28,8 @@
1.13 }
1.14
1.15 /* Get the bounds of the rectangle */
1.16 - area.w = (rand()%640);
1.17 - area.h = (rand()%480);
1.18 + area.w = (rand()%width);
1.19 + area.h = (rand()%height);
1.20 area.x = X-(area.w/2);
1.21 area.y = Y-(area.h/2);
1.22 color = (rand()%NUM_COLORS);
1.23 @@ -72,7 +72,7 @@
1.24 }
1.25 buffer = (Uint8 *)screen->pixels;
1.26 for ( i=0; i<screen->h; ++i ) {
1.27 - memset(buffer,(i*(NUM_COLORS-1))/screen->h, screen->w);
1.28 + memset(buffer,(i*(NUM_COLORS-1))/screen->h, screen->w * screen->format->BytesPerPixel);
1.29 buffer += screen->pitch;
1.30 }
1.31 SDL_UnlockSurface(screen);
1.32 @@ -126,7 +126,7 @@
1.33 if ( argv[argc] && (strcmp(argv[argc], "-fullscreen") == 0) ) {
1.34 videoflags |= SDL_FULLSCREEN;
1.35 } else {
1.36 - fprintf(stderr, "Usage: %s [-warp] [-fullscreen]\n",
1.37 + fprintf(stderr, "Usage: %s [-width] [-height] [-bpp] [-hw] [-hwpalette] [-noframe] [-fullscreen]\n",
1.38 argv[0]);
1.39 exit(1);
1.40 }
1.41 @@ -143,7 +143,7 @@
1.42 while ( !done && SDL_WaitEvent(&event) ) {
1.43 switch (event.type) {
1.44 case SDL_MOUSEBUTTONDOWN:
1.45 - DrawBox(screen, event.button.x, event.button.y);
1.46 + DrawBox(screen, event.button.x, event.button.y, width, height);
1.47 break;
1.48 case SDL_KEYDOWN:
1.49 /* Ignore ALT-TAB for windows */
1.50 @@ -153,7 +153,7 @@
1.51 }
1.52 /* Center the mouse on <SPACE> */
1.53 if ( event.key.keysym.sym == SDLK_SPACE ) {
1.54 - SDL_WarpMouse(640/2, 480/2);
1.55 + SDL_WarpMouse(width/2, height/2);
1.56 break;
1.57 }
1.58 /* Toggle fullscreen mode on <RETURN> */