Mercurial > sdl-ios-xcode
comparison test/testvidinfo.c @ 1660:8b9d79e7eacf SDL-1.3
Added API requested in bug #43:
Added SDL_GetNumVideoDrivers() and SDL_GetVideoDriver().
Replaced SDL_VideoDriverName() with SDL_GetCurrentVideoDriver()
Added SDL_GetNumAudioDrivers() and SDL_GetAudioDriver().
Replaced SDL_AudioDriverName() with SDL_GetCurrentAudioDriver()
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Sat, 20 May 2006 04:35:58 +0000 |
parents | 8d9bb0cf2c2a |
children | 782fd950bd46 |
comparison
equal
deleted
inserted
replaced
1659:14717b52abc0 | 1660:8b9d79e7eacf |
---|---|
384 } | 384 } |
385 | 385 |
386 int main(int argc, char *argv[]) | 386 int main(int argc, char *argv[]) |
387 { | 387 { |
388 const SDL_VideoInfo *info; | 388 const SDL_VideoInfo *info; |
389 int i; | 389 int i, n; |
390 SDL_Rect **modes; | 390 SDL_Rect **modes; |
391 char driver[128]; | 391 const char *driver; |
392 | |
393 /* Print available video drivers */ | |
394 n = SDL_GetNumVideoDrivers(); | |
395 if ( n == 0 ) { | |
396 printf("No built-in video drivers\n"); | |
397 } else { | |
398 printf("Built-in video drivers:"); | |
399 for ( i = 0; i < n; ++i ) { | |
400 if ( i > 0 ) { | |
401 printf(","); | |
402 } | |
403 printf(" %s", SDL_GetVideoDriver(i)); | |
404 } | |
405 printf("\n"); | |
406 } | |
392 | 407 |
393 if ( SDL_Init(SDL_INIT_VIDEO) < 0 ) { | 408 if ( SDL_Init(SDL_INIT_VIDEO) < 0 ) { |
394 fprintf(stderr, | 409 fprintf(stderr, |
395 "Couldn't initialize SDL: %s\n", SDL_GetError()); | 410 "Couldn't initialize SDL: %s\n", SDL_GetError()); |
396 exit(1); | 411 exit(1); |
397 } | 412 } |
398 if ( SDL_VideoDriverName(driver, sizeof(driver)) ) { | 413 driver = SDL_GetCurrentVideoDriver(); |
414 if ( driver ) { | |
399 printf("Video driver: %s\n", driver); | 415 printf("Video driver: %s\n", driver); |
400 } | 416 } |
401 info = SDL_GetVideoInfo(); | 417 info = SDL_GetVideoInfo(); |
402 printf( | 418 printf( |
403 "Current display: %dx%d, %d bits-per-pixel\n", | 419 "Current display: %dx%d, %d bits-per-pixel\n", |