Mercurial > sdl-ios-xcode
diff test/testsprite2.c @ 1907:06c27a737b7a
Streamlined the API a bit and optimized the software renderer.
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Sat, 15 Jul 2006 09:46:36 +0000 |
parents | 1a713f9d1f71 |
children | 051df511279c |
line wrap: on
line diff
--- a/test/testsprite2.c Fri Jul 14 08:24:43 2006 +0000 +++ b/test/testsprite2.c Sat Jul 15 09:46:36 2006 +0000 @@ -1,6 +1,7 @@ /* Simple program: Move N sprites around on the screen as fast as possible */ #include <stdlib.h> +#include <stdio.h> #include <time.h> #include "SDL.h" @@ -126,6 +127,7 @@ { int window_w, window_h; Uint32 window_flags = SDL_WINDOW_SHOWN; + Uint32 render_flags = 0; SDL_DisplayMode *mode, fullscreen_mode; int i, done; SDL_Event event; @@ -152,11 +154,13 @@ } else if (strcmp(argv[i], "-fullscreen") == 0) { num_windows = 1; window_flags |= SDL_WINDOW_FULLSCREEN; + } else if (strcmp(argv[i], "-sync") == 0) { + render_flags |= SDL_Renderer_PresentVSync; } else if (isdigit(argv[i][0])) { num_sprites = atoi(argv[i]); } else { fprintf(stderr, - "Usage: %s [-width N] [-height N] [-windows N] [-fullscreen] [numsprites]\n", + "Usage: %s [-width N] [-height N] [-windows N] [-fullscreen] [-sync] [numsprites]\n", argv[0]); quit(1); } @@ -189,7 +193,7 @@ quit(2); } - if (SDL_CreateRenderer(windows[i], -1, 0) < 0) { + if (SDL_CreateRenderer(windows[i], -1, render_flags) < 0) { fprintf(stderr, "Couldn't create renderer: %s\n", SDL_GetError()); quit(2); }