[SDL] How to choose videodrivers on windows

Facundo Dominguez - INCO fdomin at fing.edu.uy
Mon Oct 2 16:29:16 PDT 2006


Hi:
    Is this the best way to ask sdl to test first for directx, then  
for the other available drivers? (I just know about windib)

#if defined(__WIN32__)
   SDL_putenv("SDL_VIDEODRIVER=directx");
   if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_NOPARACHUTE)!=0) {
     SDL_putenv("SDL_VIDEODRIVER=windib");
     if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_NOPARACHUTE)!=0) {
       printf("Could not initialize a video driver: %s\n",SDL_GetError());
       exit(1);
     }
   };
#else
     if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_NOPARACHUTE)!=0) {
       printf("Could not initialize a video driver: %s\n",SDL_GetError());
       exit(1);
     }
#endif //__WIN32__

     char drvname[30];
     drvname[0]='\0';
     SDL_VideoDriverName(drvname,30);
     printf("Using %s video driver\n",drvname);


Regards.

----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.





More information about the SDL mailing list