comparison test/testsprite2.c @ 1707:57ce47f033a5 SDL-1.3

Passing NULL to SDL_SetDisplayMode() will set the desktop mode.
author Sam Lantinga <slouken@libsdl.org>
date Sat, 24 Jun 2006 17:01:29 +0000
parents 1577404809f0
children 931d111e737a
comparison
equal deleted inserted replaced
1706:1577404809f0 1707:57ce47f033a5
153 "Usage: %s [-width] [-height] [numsprites]\n", argv[0]); 153 "Usage: %s [-width] [-height] [numsprites]\n", argv[0]);
154 quit(1); 154 quit(1);
155 } 155 }
156 } 156 }
157 157
158 /* Initialize the video mode, if necessary */ 158 /* Set the desktop mode, we don't care what it is */
159 current_mode = SDL_GetCurrentDisplayMode(); 159 if (SDL_SetDisplayMode(NULL) < 0) {
160 if (!current_mode->w || !current_mode->h) { 160 fprintf(stderr, "Couldn't set display mode: %s\n", SDL_GetError());
161 SDL_DisplayMode mode; 161 quit(2);
162
163 /* Let the driver pick something it likes, we don't care */
164 mode.format = 0;
165 mode.w = 0;
166 mode.h = 0;
167 mode.refresh_rate = 0;
168
169 if (SDL_SetDisplayMode(&mode) < 0) {
170 fprintf(stderr, "Couldn't set display mode: %s\n",
171 SDL_GetError());
172 quit(2);
173 }
174 } 162 }
175 163
176 /* Create the windows, initialize the renderers, and load the textures */ 164 /* Create the windows, initialize the renderers, and load the textures */
177 windows = (SDL_WindowID *) SDL_malloc(num_windows * sizeof(*windows)); 165 windows = (SDL_WindowID *) SDL_malloc(num_windows * sizeof(*windows));
178 sprites = (SDL_TextureID *) SDL_malloc(num_windows * sizeof(*sprites)); 166 sprites = (SDL_TextureID *) SDL_malloc(num_windows * sizeof(*sprites));