[SDL] Graphics/Audio Driver selection at runtime

Olivier Delannoy olivier.delannoy at gmail.com
Fri Sep 16 01:40:04 PDT 2005

You can parse options before initializing SDL and fixes the environment vars 
using SDL_putenv in your program just before calling SDL_InitSubSystem. This 
function is available for this usage. 

On 9/15/05, Steven Johnson <SDL at sakuraindustries.com> wrote:
> Hi,
> I am starting to work with SDL.
> I want my users to be able to select from all drivers (video and audio)
> compiled into the SDL Library, so that they can select the driver with
> the best features/performance.
> I know this can be done by setting the "SDL_VIDEODRIVER" and
> "SDL_AUDIODRIVER" environment variables.
> I would prefer my users do this by either passing options on the command
> line, or having settings in a configuration file.
> I would like a modified SDL_InitSubSystem to allow the required names of
> the Audio and Video Driver to use to be explicitly declared, and not
> just auto probed. Null, or an empty string would auto probe as it does
> now. And this would be a copy of SDL_InitSubSystem, renamed something 
> like:
> SDL_InitSubSystem_Drivers(flags, VideoDriver, AudioDriver);
> then SDL_InitSubSystem would just call SDL_InitSubSystem_Drivers, with
> empty entries for VideoDriver and AudioDriver. To maintain complete
> compatibility with the current api.
> To go with this, i would like to add a function to enumerate drivers, so
> its possible at run time to discover what drivers a particular library
> supports. A Function something like:
> SDL_EnumerateDriver(Type, Index, **Name, **Description) returns True if
> its available to be used. False if its in the SDL Library, but not
> available to be used.
> Type would be "Audio" or "Video". Index, an increasing number. **Name is
> set null if at the end of the list, Description likewise. Name and
> Description just get set to the constants from the bootstrap table.
> Then the program could display the available drivers, and the user could
> select the video method they wanted for best performance.
> Or something like that. The purpose of this post is for comments before
> I do anything.
> Thanks for any comments or pointers.
> Also, should i do this work against 1.2.9 or CVS version? Whats the
> process for patch approval?
> Steven Johnson
> _______________________________________________
> SDL mailing list
> SDL at libsdl.org
> http://www.libsdl.org/mailman/listinfo/sdl
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20050916/5fa72504/attachment-0008.htm>

More information about the SDL mailing list