SDL_envvars -- SDL environment variables
#include "SDL_getenv.h" ... putenv("name=value") ; ... const char* myvalue = getenv("name") ; ...
Maps getenv() and putenv() to SDL_getenv() and SDL_putenv() macros respectively (if needed).
Several environment variables are available to modify the behaviour of SDL. Using these variables isn't recommened and the names and presence of these variables aren't guaranteed from one release to the next. However, they can be very useful for debugging purposes.
These routines are intended for debugging/testing features in the SDL environment. They're not meant to (and do not) provide portable access to OS environment variables.
- If set to 0, disable hardware acceleration in the linux fbcon driver.
- Frame buffer device to use in the linux fbcon driver, instead of /dev/fb0
- In the ps2gs driver, sets the SDL_ASYNCBLIT flag on the display surface.
- Selects the video driver for SDL to use. Possible values, in the order they are tried if this variable is not set:
Quartz (Mac OS X)
Nano-X Window System (Linux)
iPod framebuffer (iPod)
Qtopia (embedded Linux)
NetBSD/OpenBSD wscons interface (BSD)
Linux framebuffer console (Linux)
Playstation 2 Graphics Synthesizer (Playstation 2)
FreeBSD Video Graphics Library (BSD)
Pocket PC Game API (Windows CE)
Win95/98/NT/2000 GDI (Win32)
Microsoft DirectX (Win32)
MacOS ROM Toolbox (MacOS Classic)
DrawSprocket (MacOS Classic)
QNX Photon (QNX)
Atari XBIOS (Atari)
Atari GEM (Atari)
Dreamcast video (Dreamcast)
Nintendo DS video (Nintendo DS)
RISC OS (RISCOS)
dummy driver (no output)
If set, tries to center the SDL window when running in X11 windowed mode, or using the CyberGrafix driver.
Set window position. The value should be a string on the form: "x,y"
- The openGL driver (shared library) to use for X11. Default is libGL.so.1
- With XFree86, enables use of DGA mouse if set.
- For X11, sets the mouse acceleration. The value should be a string on the form:
where n and d are the acceleration numerator/denumerators (so mouse movement is accelerated by n/d), and t is the threshold above which acceleration applies (counted as number of pixels the mouse moves at once).
If set, don't attempt to use DirectColor visuals even if they are present. (SDL will use them otherwise for gamma correction). This is needed with older X servers when using the XVideo extension.
- ID of an X11 visual to use, overriding SDL's default visual selection algorithm. It can be in decimal or in hex (prefixed by 0x).
- The name and class for the X11 window's WM_CLASS property (both use the same value), overriding the default.
If set, display YUV overlay directly on the video surface if possible, instead of on the surface passed to SDL_CreateYUVOverlay.
- If not set or set to a nonzero value, SDL will attempt to use hardware YUV acceleration for video playback.
- For X11 or Win32, contains the ID number of the window to be used by SDL instead of creating its own window. Either in decimal or in hex (prefixed by 0x).
- If set to 0, do not use mouse relative mode in X11. The default is to use it if the mouse is hidden and input is grabbed.
- The mouse device to use for the linux fbcon driver. If not set, SDL first tries to use GPM in repeater mode, then various other devices (/dev/pcaux, /dev/adbmouse, /dev/mouse etc).
- If set, SDL will not try to auto-detect the IMPS/2 protocol of a PS/2 mouse but use it right away. For the fbcon and ps2gs drivers.
- For the linux fbcon driver: if set to ELO, use the ELO touchscreen controller as a pointer device
- For the libvga driver: If set, do not attempt to put the keyboard in raw mode.
- If set, the linux fbcon driver will not use a mouse at all.
- The audio device to use, if SDL_PATH_DSP isn't set.
- Selects the audio driver for SDL to use. Possible values, in the order they are tried if this variable is not set:
OSS /dev/dsp (no DMA): Linux, Solaris, BSD etc)
OSS /dev/dsp (DMA): Linux, Solaris, BSD etc)
PulseAudio (POSIX, Win32)
QNX6 QSA-NTO audio (QNX)
Unix style /dev/audio: (SunOS, Solaris etc)
Irix DMedia audio (Irix)
Network Audio System (POSIX)
Windows WaveOut (Win32)
MacOS X CoreAudio (MacOS X)
MacOS SoundManager 3.0 (old MacOS)
MiNT GSXB audio driver
MiNT MCSN audio driver
MiNT STFA audio driver
MiNT XBIOS audio driver
MiNT DMA 8 bits audio driver
output to file (all platforms)
dummy driver (no output)
Dreamcast AICA audio
Nintendo DS audio
Tru64 MME WaveOut
OS/2 Direct Audio RouTines (DART)
EPOC streaming audio
- The name of the output file for the "disk" audio driver. If not set, the name sdlaudio.raw is used.
- For the "disk" audio driver, how long to wait (in ms) before writing a full sound buffer. The default is 150 ms.
For some audio drivers (alsa, paud, dma and dsp), don't use select() but a timed method instead. May cure some audio problems, or cause others.
- The audio device to use. If not set, SDL tries AUDIODEV and then a platform-dependent default value (/dev/audio on Solaris, /dev/dsp on Linux etc).
- A colon-separated list of CD-ROM devices to use, in addition to the standard devices (typically /dev/cdrom, platform-dependent).
If set, causes every call to SDL_SetError (that is, every time SDL signals an error) to also print an error message on stderr.
- Joystick device to use in the linux joystick driver, in addition to the usual: /dev/js*, /dev/input/event*, /dev/input/js*
- Special joystick configuration string for linux. The format is:
- "name numaxes numhats numballs"
where name is the name string of the joystick (possibly in single quotes), and the rest are the number of axes, hats and balls respectively.
- "name numaxes numhats numballs"
Windows version strangeness
Don't know if this is common to all platforms but apparently on Windows these routines (getenv, putenv) operate on an internal environment maintained by SDL - not based on the windows environment vars. Question related to this came up on #SDL (irc.freenode.net) about SDL_VIDEO_CENTERED appearing not to work. I confirmed that it does work but you have to set it before creating your window using putenv. (I set it before SDL_Init in my test.) That worked on WinXP Pro.
-- cid 2005-01-09 01:22:50
If you need an event queue but don't want a real window, try putenv("SDL_VIDEODRIVER=dummy") before you call SDL_SetVideoMode. I find this useful in apps that use SDL facilities, but don't need a real video output device. Oh, and apparently you can use a 0x0 resolution to avoid to much memory from making the dummy window. Of course, the dummy driver can also be used for offscreen rendering like for an image converter and such.
-- LIM 2005-02-12 07:22:50