test/testsprite2.c
changeset 1915 a228436a2404
parent 1914 051df511279c
child 1916 c773b0c0ac89
equal deleted inserted replaced
1914:051df511279c 1915:a228436a2404
   132     }
   132     }
   133     for (i = 1; i < argc;) {
   133     for (i = 1; i < argc;) {
   134         int consumed;
   134         int consumed;
   135 
   135 
   136         consumed = CommonArg(state, i);
   136         consumed = CommonArg(state, i);
       
   137         if (consumed == 0) {
       
   138             num_sprites = SDL_atoi(argv[i]);
       
   139             consumed = 1;
       
   140         }
   137         if (consumed < 0) {
   141         if (consumed < 0) {
   138             fprintf(stderr, "Usage: %s %s", argv[0], CommonUsage(state));
   142             fprintf(stderr, "Usage: %s %s", argv[0], CommonUsage(state));
   139             quit(1);
   143             quit(1);
   140         }
       
   141         if (consumed == 0) {
       
   142             num_sprites = SDL_atoi(argv[i]);
       
   143             consumed = 1;
       
   144         }
   144         }
   145         i += consumed;
   145         i += consumed;
   146     }
   146     }
   147     if (!CommonInit(state)) {
   147     if (!CommonInit(state)) {
   148         quit(2);
   148         quit(2);
   182             velocities[i].x = (rand() % (MAX_SPEED * 2 + 1)) - MAX_SPEED;
   182             velocities[i].x = (rand() % (MAX_SPEED * 2 + 1)) - MAX_SPEED;
   183             velocities[i].y = (rand() % (MAX_SPEED * 2 + 1)) - MAX_SPEED;
   183             velocities[i].y = (rand() % (MAX_SPEED * 2 + 1)) - MAX_SPEED;
   184         }
   184         }
   185     }
   185     }
   186 
   186 
   187     /* Loop, blitting sprites and waiting for a keystroke */
   187     /* Main render loop */
   188     frames = 0;
   188     frames = 0;
   189     then = SDL_GetTicks();
   189     then = SDL_GetTicks();
   190     done = 0;
   190     done = 0;
   191     while (!done) {
   191     while (!done) {
   192         /* Check for events */
   192         /* Check for events */