test/testsprite2.c
changeset 1907 06c27a737b7a
parent 1904 1a713f9d1f71
child 1914 051df511279c
     1.1 --- a/test/testsprite2.c	Fri Jul 14 08:24:43 2006 +0000
     1.2 +++ b/test/testsprite2.c	Sat Jul 15 09:46:36 2006 +0000
     1.3 @@ -1,6 +1,7 @@
     1.4  /* Simple program:  Move N sprites around on the screen as fast as possible */
     1.5  
     1.6  #include <stdlib.h>
     1.7 +#include <stdio.h>
     1.8  #include <time.h>
     1.9  
    1.10  #include "SDL.h"
    1.11 @@ -126,6 +127,7 @@
    1.12  {
    1.13      int window_w, window_h;
    1.14      Uint32 window_flags = SDL_WINDOW_SHOWN;
    1.15 +    Uint32 render_flags = 0;
    1.16      SDL_DisplayMode *mode, fullscreen_mode;
    1.17      int i, done;
    1.18      SDL_Event event;
    1.19 @@ -152,11 +154,13 @@
    1.20          } else if (strcmp(argv[i], "-fullscreen") == 0) {
    1.21              num_windows = 1;
    1.22              window_flags |= SDL_WINDOW_FULLSCREEN;
    1.23 +        } else if (strcmp(argv[i], "-sync") == 0) {
    1.24 +            render_flags |= SDL_Renderer_PresentVSync;
    1.25          } else if (isdigit(argv[i][0])) {
    1.26              num_sprites = atoi(argv[i]);
    1.27          } else {
    1.28              fprintf(stderr,
    1.29 -                    "Usage: %s [-width N] [-height N] [-windows N] [-fullscreen] [numsprites]\n",
    1.30 +                    "Usage: %s [-width N] [-height N] [-windows N] [-fullscreen] [-sync] [numsprites]\n",
    1.31                      argv[0]);
    1.32              quit(1);
    1.33          }
    1.34 @@ -189,7 +193,7 @@
    1.35              quit(2);
    1.36          }
    1.37  
    1.38 -        if (SDL_CreateRenderer(windows[i], -1, 0) < 0) {
    1.39 +        if (SDL_CreateRenderer(windows[i], -1, render_flags) < 0) {
    1.40              fprintf(stderr, "Couldn't create renderer: %s\n", SDL_GetError());
    1.41              quit(2);
    1.42          }