SDL_VIDEODRIVER trick

For some reason SDL_VIDEODRIVER doesn’t work for me in Win32
(getenv()/putenv() - getenv() returns NULL).

How about falling back to GetEnvironmentVariable() in Win32 when getenv()
returns NULL? I propose using this in SDL.c (
SDL_VideoInit(getenvHelper(“SDL_VIDEODRIVER”)…) )

#ifdef WIN32
#define WIN32_LEAN_AND_MEAN
#include “windows.h”
#endif

static const char getenvHelper (const char sVarName)
{
#ifdef WIN32
static char sBuffer[128];
#endif

const char* sRet = getenv("SDL_VIDEODRIVER");

#ifdef WIN32
if (!sRet)
{
if (GetEnvironmentVariable(sVarName, sBuffer, 128))
sRet = sBuffer;
}
#endif

return sRet;

}

Any comments?

–Gabriel--------------------------------------------------------------------
mail2web - Check your email from the web at
http://mail2web.com/ .

For some reason SDL_VIDEODRIVER doesn’t work for me in Win32
(getenv()/putenv() - getenv() returns NULL).

How about falling back to GetEnvironmentVariable() in Win32

Actually, the code in CVS always uses GetEnvironmentVariable()

See ya!
-Sam Lantinga, Senior Software Engineer, Blizzard Entertainment