test/testsprite2.c
changeset 1904 1a713f9d1f71
parent 1903 f132024010be
child 1907 06c27a737b7a
     1.1 --- a/test/testsprite2.c	Fri Jul 14 06:40:53 2006 +0000
     1.2 +++ b/test/testsprite2.c	Fri Jul 14 07:41:16 2006 +0000
     1.3 @@ -5,7 +5,7 @@
     1.4  
     1.5  #include "SDL.h"
     1.6  
     1.7 -#define NUM_WINDOWS 1
     1.8 +#define NUM_WINDOWS 4
     1.9  #define WINDOW_W    640
    1.10  #define WINDOW_H    480
    1.11  #define NUM_SPRITES	100
    1.12 @@ -141,22 +141,23 @@
    1.13      num_sprites = NUM_SPRITES;
    1.14      window_w = WINDOW_W;
    1.15      window_h = WINDOW_H;
    1.16 -    while (argc > 1) {
    1.17 -        if (strcmp(argv[argc - 1], "-width") == 0) {
    1.18 -            window_w = atoi(argv[argc]);
    1.19 -            --argc;
    1.20 -        } else if (strcmp(argv[argc - 1], "-height") == 0) {
    1.21 -            window_h = atoi(argv[argc]);
    1.22 -            --argc;
    1.23 -        } else if (strcmp(argv[argc - 1], "-fullscreen") == 0) {
    1.24 +    for (i = 1; i < argc; ++i) {
    1.25 +        if (strcmp(argv[i], "-width") == 0 && (i + 1 < argc)) {
    1.26 +            window_w = atoi(argv[++i]);
    1.27 +        } else if (strcmp(argv[i], "-height") == 0 && (i + 1 < argc)) {
    1.28 +            window_h = atoi(argv[++i]);
    1.29 +        } else if (strcmp(argv[i], "-windows") == 0 && (i + 1 < argc)) {
    1.30 +            num_windows = atoi(argv[++i]);
    1.31 +            window_flags &= ~SDL_WINDOW_FULLSCREEN;
    1.32 +        } else if (strcmp(argv[i], "-fullscreen") == 0) {
    1.33              num_windows = 1;
    1.34              window_flags |= SDL_WINDOW_FULLSCREEN;
    1.35 -            --argc;
    1.36 -        } else if (isdigit(argv[argc][0])) {
    1.37 -            num_sprites = atoi(argv[argc]);
    1.38 +        } else if (isdigit(argv[i][0])) {
    1.39 +            num_sprites = atoi(argv[i]);
    1.40          } else {
    1.41              fprintf(stderr,
    1.42 -                    "Usage: %s [-width] [-height] [numsprites]\n", argv[0]);
    1.43 +                    "Usage: %s [-width N] [-height N] [-windows N] [-fullscreen] [numsprites]\n",
    1.44 +                    argv[0]);
    1.45              quit(1);
    1.46          }
    1.47      }
    1.48 @@ -240,8 +241,7 @@
    1.49                  }
    1.50                  break;
    1.51              case SDL_KEYDOWN:
    1.52 -                ///* Any keypress quits the app... */
    1.53 -                break;
    1.54 +                /* Any keypress quits the app... */
    1.55              case SDL_QUIT:
    1.56                  done = 1;
    1.57                  break;