Mercurial > sdl-ios-xcode
changeset 1909:8f1ab2f7c722
Look at environment variables in SDL_VideoInit() and SDL_AudioInit()
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Sat, 15 Jul 2006 19:30:18 +0000 |
parents | e079dafea2bf |
children | c26194009c9c |
files | src/SDL.c src/audio/SDL_audio.c src/video/SDL_video.c |
diffstat | 3 files changed, 12 insertions(+), 11 deletions(-) [+] |
line wrap: on
line diff
--- a/src/SDL.c Sat Jul 15 19:29:42 2006 +0000 +++ b/src/SDL.c Sat Jul 15 19:30:18 2006 +0000 @@ -62,8 +62,7 @@ #if !SDL_VIDEO_DISABLED /* Initialize the video/event subsystem */ if ((flags & SDL_INIT_VIDEO) && !(SDL_initialized & SDL_INIT_VIDEO)) { - if (SDL_VideoInit(SDL_getenv("SDL_VIDEODRIVER"), - (flags & SDL_INIT_EVENTTHREAD)) < 0) { + if (SDL_VideoInit(NULL, (flags & SDL_INIT_EVENTTHREAD)) < 0) { return (-1); } SDL_initialized |= SDL_INIT_VIDEO; @@ -78,7 +77,7 @@ #if !SDL_AUDIO_DISABLED /* Initialize the audio subsystem */ if ((flags & SDL_INIT_AUDIO) && !(SDL_initialized & SDL_INIT_AUDIO)) { - if (SDL_AudioInit(SDL_getenv("SDL_AUDIODRIVER")) < 0) { + if (SDL_AudioInit(NULL) < 0) { return (-1); } SDL_initialized |= SDL_INIT_AUDIO;
--- a/src/audio/SDL_audio.c Sat Jul 15 19:29:42 2006 +0000 +++ b/src/audio/SDL_audio.c Sat Jul 15 19:30:18 2006 +0000 @@ -361,6 +361,9 @@ /* Select the proper audio driver */ audio = NULL; idx = 0; + if (driver_name == NULL) { + driver_name = SDL_getenv("SDL_AUDIODRIVER"); + } #if SDL_AUDIO_DRIVER_ESD if ((driver_name == NULL) && (SDL_getenv("ESPEAKER") != NULL)) { /* Ahem, we know that if ESPEAKER is set, user probably wants @@ -393,11 +396,6 @@ #endif /* SDL_AUDIO_DRIVER_ESD */ if (audio == NULL) { if (driver_name != NULL) { -#if 0 /* This will be replaced with a better driver selection API */ - if (SDL_strrchr(driver_name, ':') != NULL) { - idx = atoi(SDL_strrchr(driver_name, ':') + 1); - } -#endif for (i = 0; bootstrap[i]; ++i) { if (SDL_strncmp(bootstrap[i]->name, driver_name, SDL_strlen(bootstrap[i]->name)) == 0) { @@ -423,9 +421,10 @@ } else { SDL_SetError("No available audio device"); } -#if 0 /* Don't fail SDL_Init() if audio isn't available. - SDL_OpenAudio() will handle it at that point. *sigh* - */ +#if 0 + /* Don't fail SDL_Init() if audio isn't available. + SDL_OpenAudio() will handle it at that point. *sigh* + */ return (-1); #endif }
--- a/src/video/SDL_video.c Sat Jul 15 19:29:42 2006 +0000 +++ b/src/video/SDL_video.c Sat Jul 15 19:30:18 2006 +0000 @@ -201,6 +201,9 @@ /* Select the proper video driver */ index = 0; video = NULL; + if (driver_name == NULL) { + driver_name = SDL_getenv("SDL_VIDEODRIVER"); + } if (driver_name != NULL) { for (i = 0; bootstrap[i]; ++i) { if (SDL_strncmp(bootstrap[i]->name, driver_name,