comparison test/testsprite2.c @ 1904:1a713f9d1f71

Yay! D3D renderer works!
author Sam Lantinga <slouken@libsdl.org>
date Fri, 14 Jul 2006 07:41:16 +0000
parents f132024010be
children 06c27a737b7a
comparison
equal deleted inserted replaced
1903:f132024010be 1904:1a713f9d1f71
3 #include <stdlib.h> 3 #include <stdlib.h>
4 #include <time.h> 4 #include <time.h>
5 5
6 #include "SDL.h" 6 #include "SDL.h"
7 7
8 #define NUM_WINDOWS 1 8 #define NUM_WINDOWS 4
9 #define WINDOW_W 640 9 #define WINDOW_W 640
10 #define WINDOW_H 480 10 #define WINDOW_H 480
11 #define NUM_SPRITES 100 11 #define NUM_SPRITES 100
12 #define MAX_SPEED 1 12 #define MAX_SPEED 1
13 #define BACKGROUND 0x00FFFFFF 13 #define BACKGROUND 0x00FFFFFF
139 139
140 num_windows = NUM_WINDOWS; 140 num_windows = NUM_WINDOWS;
141 num_sprites = NUM_SPRITES; 141 num_sprites = NUM_SPRITES;
142 window_w = WINDOW_W; 142 window_w = WINDOW_W;
143 window_h = WINDOW_H; 143 window_h = WINDOW_H;
144 while (argc > 1) { 144 for (i = 1; i < argc; ++i) {
145 if (strcmp(argv[argc - 1], "-width") == 0) { 145 if (strcmp(argv[i], "-width") == 0 && (i + 1 < argc)) {
146 window_w = atoi(argv[argc]); 146 window_w = atoi(argv[++i]);
147 --argc; 147 } else if (strcmp(argv[i], "-height") == 0 && (i + 1 < argc)) {
148 } else if (strcmp(argv[argc - 1], "-height") == 0) { 148 window_h = atoi(argv[++i]);
149 window_h = atoi(argv[argc]); 149 } else if (strcmp(argv[i], "-windows") == 0 && (i + 1 < argc)) {
150 --argc; 150 num_windows = atoi(argv[++i]);
151 } else if (strcmp(argv[argc - 1], "-fullscreen") == 0) { 151 window_flags &= ~SDL_WINDOW_FULLSCREEN;
152 } else if (strcmp(argv[i], "-fullscreen") == 0) {
152 num_windows = 1; 153 num_windows = 1;
153 window_flags |= SDL_WINDOW_FULLSCREEN; 154 window_flags |= SDL_WINDOW_FULLSCREEN;
154 --argc; 155 } else if (isdigit(argv[i][0])) {
155 } else if (isdigit(argv[argc][0])) { 156 num_sprites = atoi(argv[i]);
156 num_sprites = atoi(argv[argc]);
157 } else { 157 } else {
158 fprintf(stderr, 158 fprintf(stderr,
159 "Usage: %s [-width] [-height] [numsprites]\n", argv[0]); 159 "Usage: %s [-width N] [-height N] [-windows N] [-fullscreen] [numsprites]\n",
160 argv[0]);
160 quit(1); 161 quit(1);
161 } 162 }
162 } 163 }
163 164
164 if (window_flags & SDL_WINDOW_FULLSCREEN) { 165 if (window_flags & SDL_WINDOW_FULLSCREEN) {
238 done = 1; 239 done = 1;
239 break; 240 break;
240 } 241 }
241 break; 242 break;
242 case SDL_KEYDOWN: 243 case SDL_KEYDOWN:
243 ///* Any keypress quits the app... */ 244 /* Any keypress quits the app... */
244 break;
245 case SDL_QUIT: 245 case SDL_QUIT:
246 done = 1; 246 done = 1;
247 break; 247 break;
248 default: 248 default:
249 break; 249 break;