You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
75 lines
2.1 KiB
75 lines
2.1 KiB
#include <SDL2/SDL.h>
|
|
#include <vector>
|
|
|
|
int main(){
|
|
int nVDrvNumber = 0;
|
|
//if (SDL_Init(SDL_INIT_EVERYTHING) != 0) {
|
|
// printf( "SDL_Init Error: %s \n", SDL_GetError() );
|
|
// return EXIT_FAILURE;
|
|
//}
|
|
SDL_Init( 0 );
|
|
|
|
std::vector< bool > drivers( SDL_GetNumVideoDrivers() );
|
|
|
|
for( int i = 0; i < drivers.size(); ++i ){
|
|
drivers[ i ] = ( 0 == SDL_VideoInit( SDL_GetVideoDriver( i ) ) );
|
|
SDL_VideoQuit();
|
|
};
|
|
|
|
printf( "SDL_VIDEODRIVER usable: " );
|
|
for( int i = 0; i < drivers.size(); ++i ){
|
|
if( !drivers[ i ] ) continue;
|
|
printf( " %s", SDL_GetVideoDriver( i ) );
|
|
};
|
|
printf( "\n" );
|
|
|
|
nVDrvNumber = SDL_GetNumVideoDrivers();
|
|
printf( "Number of Video Drivers: %d\n", nVDrvNumber );
|
|
if( nVDrvNumber ){
|
|
for( int j = 0; j < nVDrvNumber; j++ ){
|
|
printf( "Driver[%d]:%s\n", j, SDL_GetVideoDriver( j ) );
|
|
};
|
|
};
|
|
|
|
if (SDL_GL_ExtensionSupported("GL_EXT_framebuffer_blit")) {
|
|
printf( "Use Blit\n" );
|
|
//draw_to_the_screen_with_framebuffer_blit(); // faster!
|
|
} else {
|
|
printf( "No Blit!\n" );
|
|
//draw_to_the_screen_with_a_textured_quad(); // slower!
|
|
};
|
|
|
|
|
|
if( SDL_VideoInit("directfb") != 0 ){
|
|
printf("Error initializing SDL video: %s\n", SDL_GetError());
|
|
return 2;
|
|
};
|
|
|
|
static int display_in_use = 0; /* Only using first display */
|
|
|
|
int i, display_mode_count;
|
|
SDL_DisplayMode mode;
|
|
Uint32 f;
|
|
|
|
SDL_Log("SDL_GetNumVideoDisplays(): %i", SDL_GetNumVideoDisplays());
|
|
|
|
display_mode_count = SDL_GetNumDisplayModes(display_in_use);
|
|
if (display_mode_count < 1) {
|
|
SDL_Log("SDL_GetNumDisplayModes failed: %s", SDL_GetError());
|
|
return 1;
|
|
}
|
|
SDL_Log("SDL_GetNumDisplayModes: %i", display_mode_count);
|
|
|
|
for (i = 0; i < display_mode_count; ++i) {
|
|
if (SDL_GetDisplayMode(display_in_use, i, &mode) != 0) {
|
|
SDL_Log("SDL_GetDisplayMode failed: %s", SDL_GetError());
|
|
return 1;
|
|
}
|
|
f = mode.format;
|
|
|
|
SDL_Log("Mode %i\tbpp %i\t%s\t%i x %i", i,
|
|
SDL_BITSPERPIXEL(f), SDL_GetPixelFormatName(f), mode.w, mode.h);
|
|
}
|
|
SDL_Quit();
|
|
return 0;
|
|
};
|