My Project
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Macros | Typedefs | Enumerations | Functions
SDL_hints.h File Reference
#include "SDL_stdinc.h"
#include "begin_code.h"
#include "close_code.h"

Go to the source code of this file.

Macros

#define SDL_HINT_FRAMEBUFFER_ACCELERATION   "SDL_FRAMEBUFFER_ACCELERATION"
 A variable controlling how 3D acceleration is used to accelerate the SDL screen surface. More...
 
#define SDL_HINT_RENDER_DRIVER   "SDL_RENDER_DRIVER"
 A variable specifying which render driver to use. More...
 
#define SDL_HINT_RENDER_OPENGL_SHADERS   "SDL_RENDER_OPENGL_SHADERS"
 A variable controlling whether the OpenGL render driver uses shaders if they are available. More...
 
#define SDL_HINT_RENDER_DIRECT3D_THREADSAFE   "SDL_RENDER_DIRECT3D_THREADSAFE"
 A variable controlling whether the Direct3D device is initialized for thread-safe operations. More...
 
#define SDL_HINT_RENDER_DIRECT3D11_DEBUG   "SDL_HINT_RENDER_DIRECT3D11_DEBUG"
 A variable controlling whether to enable Direct3D 11+'s Debug Layer. More...
 
#define SDL_HINT_RENDER_SCALE_QUALITY   "SDL_RENDER_SCALE_QUALITY"
 A variable controlling the scaling quality. More...
 
#define SDL_HINT_RENDER_VSYNC   "SDL_RENDER_VSYNC"
 A variable controlling whether updates to the SDL screen surface should be synchronized with the vertical refresh, to avoid tearing. More...
 
#define SDL_HINT_VIDEO_ALLOW_SCREENSAVER   "SDL_VIDEO_ALLOW_SCREENSAVER"
 A variable controlling whether the screensaver is enabled. More...
 
#define SDL_HINT_VIDEO_X11_XVIDMODE   "SDL_VIDEO_X11_XVIDMODE"
 A variable controlling whether the X11 VidMode extension should be used. More...
 
#define SDL_HINT_VIDEO_X11_XINERAMA   "SDL_VIDEO_X11_XINERAMA"
 A variable controlling whether the X11 Xinerama extension should be used. More...
 
#define SDL_HINT_VIDEO_X11_XRANDR   "SDL_VIDEO_X11_XRANDR"
 A variable controlling whether the X11 XRandR extension should be used. More...
 
#define SDL_HINT_GRAB_KEYBOARD   "SDL_GRAB_KEYBOARD"
 A variable controlling whether grabbing input grabs the keyboard. More...
 
#define SDL_HINT_MOUSE_RELATIVE_MODE_WARP   "SDL_MOUSE_RELATIVE_MODE_WARP"
 A variable controlling whether relative mouse mode is implemented using mouse warping. More...
 
#define SDL_HINT_VIDEO_MINIMIZE_ON_FOCUS_LOSS   "SDL_VIDEO_MINIMIZE_ON_FOCUS_LOSS"
 Minimize your SDL_Window if it loses key focus when in fullscreen mode. Defaults to true.
 
#define SDL_HINT_IDLE_TIMER_DISABLED   "SDL_IOS_IDLE_TIMER_DISABLED"
 A variable controlling whether the idle timer is disabled on iOS. More...
 
#define SDL_HINT_ORIENTATIONS   "SDL_IOS_ORIENTATIONS"
 A variable controlling which orientations are allowed on iOS. More...
 
#define SDL_HINT_ACCELEROMETER_AS_JOYSTICK   "SDL_ACCELEROMETER_AS_JOYSTICK"
 A variable controlling whether an Android built-in accelerometer should be listed as a joystick device, rather than listing actual joysticks only. More...
 
#define SDL_HINT_XINPUT_ENABLED   "SDL_XINPUT_ENABLED"
 A variable that lets you disable the detection and use of Xinput gamepad devices. More...
 
#define SDL_HINT_GAMECONTROLLERCONFIG   "SDL_GAMECONTROLLERCONFIG"
 A variable that lets you manually hint extra gamecontroller db entries. More...
 
#define SDL_HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS   "SDL_JOYSTICK_ALLOW_BACKGROUND_EVENTS"
 A variable that lets you enable joystick (and gamecontroller) events even when your app is in the background. More...
 
#define SDL_HINT_ALLOW_TOPMOST   "SDL_ALLOW_TOPMOST"
 If set to 0 then never set the top most bit on a SDL Window, even if the video mode expects it. This is a debugging aid for developers and not expected to be used by end users. The default is "1". More...
 
#define SDL_HINT_TIMER_RESOLUTION   "SDL_TIMER_RESOLUTION"
 A variable that controls the timer resolution, in milliseconds. More...
 
#define SDL_HINT_VIDEO_HIGHDPI_DISABLED   "SDL_VIDEO_HIGHDPI_DISABLED"
 If set to 1, then do not allow high-DPI windows. ("Retina" on Mac)
 
#define SDL_HINT_MAC_CTRL_CLICK_EMULATE_RIGHT_CLICK   "SDL_MAC_CTRL_CLICK_EMULATE_RIGHT_CLICK"
 A variable that determines whether ctrl+click should generate a right-click event on Mac. More...
 
#define SDL_HINT_VIDEO_WIN_D3DCOMPILER   "SDL_VIDEO_WIN_D3DCOMPILER"
 A variable specifying which shader compiler to preload when using the Chrome ANGLE binaries. More...
 
#define SDL_HINT_VIDEO_WINDOW_SHARE_PIXEL_FORMAT   "SDL_VIDEO_WINDOW_SHARE_PIXEL_FORMAT"
 A variable that is the address of another SDL_Window* (as a hex string formatted with "%p"). More...
 
#define SDL_HINT_WINRT_PRIVACY_POLICY_URL   "SDL_HINT_WINRT_PRIVACY_POLICY_URL"
 
#define SDL_HINT_WINRT_PRIVACY_POLICY_LABEL   "SDL_HINT_WINRT_PRIVACY_POLICY_LABEL"
 Label text for a WinRT app's privacy policy link. More...
 
#define SDL_HINT_WINRT_HANDLE_BACK_BUTTON   "SDL_HINT_WINRT_HANDLE_BACK_BUTTON"
 If set to 1, back button press events on Windows Phone 8+ will be marked as handled. More...
 
#define SDL_HINT_VIDEO_MAC_FULLSCREEN_SPACES   "SDL_VIDEO_MAC_FULLSCREEN_SPACES"
 A variable that dictates policy for fullscreen Spaces on Mac OS X. More...
 

Typedefs

typedef void(* SDL_HintCallback )(void *userdata, const char *name, const char *oldValue, const char *newValue)
 Add a function to watch a particular hint. More...
 

Enumerations

enum  SDL_HintPriority { SDL_HINT_DEFAULT, SDL_HINT_NORMAL, SDL_HINT_OVERRIDE }
 An enumeration of hint priorities.
 

Functions

DECLSPEC SDL_bool SDLCALL SDL_SetHintWithPriority (const char *name, const char *value, SDL_HintPriority priority)
 Set a hint with a specific priority. More...
 
DECLSPEC SDL_bool SDLCALL SDL_SetHint (const char *name, const char *value)
 Set a hint with normal priority. More...
 
DECLSPEC const char *SDLCALL SDL_GetHint (const char *name)
 Get a hint. More...
 
DECLSPEC void SDLCALL SDL_AddHintCallback (const char *name, SDL_HintCallback callback, void *userdata)
 
DECLSPEC void SDLCALL SDL_DelHintCallback (const char *name, SDL_HintCallback callback, void *userdata)
 Remove a function watching a particular hint. More...
 
DECLSPEC void SDLCALL SDL_ClearHints (void)
 Clear all hints. More...
 

Detailed Description

Official documentation for SDL configuration variables

This file contains functions to set and get configuration hints, as well as listing each of them alphabetically.

The convention for naming hints is SDL_HINT_X, where "SDL_X" is the environment variable that can be used to override the default.

In general these hints are just that - they may or may not be supported or applicable on any given platform, but they provide a way for an application or user to give the library a hint as to how they would like the library to work.

Macro Definition Documentation

#define SDL_HINT_ACCELEROMETER_AS_JOYSTICK   "SDL_ACCELEROMETER_AS_JOYSTICK"

A variable controlling whether an Android built-in accelerometer should be listed as a joystick device, rather than listing actual joysticks only.

This variable can be set to the following values: "0" - List only real joysticks and accept input from them "1" - List real joysticks along with the accelerometer as if it were a 3 axis joystick (the default).

#define SDL_HINT_ALLOW_TOPMOST   "SDL_ALLOW_TOPMOST"

If set to 0 then never set the top most bit on a SDL Window, even if the video mode expects it. This is a debugging aid for developers and not expected to be used by end users. The default is "1".

This variable can be set to the following values: "0" - don't allow topmost "1" - allow topmost

#define SDL_HINT_FRAMEBUFFER_ACCELERATION   "SDL_FRAMEBUFFER_ACCELERATION"

A variable controlling how 3D acceleration is used to accelerate the SDL screen surface.

SDL can try to accelerate the SDL screen surface by using streaming textures with a 3D rendering engine. This variable controls whether and how this is done.

This variable can be set to the following values: "0" - Disable 3D acceleration "1" - Enable 3D acceleration, using the default renderer. "X" - Enable 3D acceleration, using X where X is one of the valid rendering drivers. (e.g. "direct3d", "opengl", etc.)

By default SDL tries to make a best guess for each platform whether to use acceleration or not.

#define SDL_HINT_GAMECONTROLLERCONFIG   "SDL_GAMECONTROLLERCONFIG"

A variable that lets you manually hint extra gamecontroller db entries.

The variable should be newline delimited rows of gamecontroller config data, see SDL_gamecontroller.h

This hint must be set before calling SDL_Init(SDL_INIT_GAMECONTROLLER) You can update mappings after the system is initialized with SDL_GameControllerMappingForGUID() and SDL_GameControllerAddMapping()

#define SDL_HINT_GRAB_KEYBOARD   "SDL_GRAB_KEYBOARD"

A variable controlling whether grabbing input grabs the keyboard.

This variable can be set to the following values: "0" - Grab will affect only the mouse "1" - Grab will affect mouse and keyboard

By default SDL will not grab the keyboard so system shortcuts still work.

#define SDL_HINT_IDLE_TIMER_DISABLED   "SDL_IOS_IDLE_TIMER_DISABLED"

A variable controlling whether the idle timer is disabled on iOS.

When an iOS app does not receive touches for some time, the screen is dimmed automatically. For games where the accelerometer is the only input this is problematic. This functionality can be disabled by setting this hint.

This variable can be set to the following values: "0" - Enable idle timer "1" - Disable idle timer

#define SDL_HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS   "SDL_JOYSTICK_ALLOW_BACKGROUND_EVENTS"

A variable that lets you enable joystick (and gamecontroller) events even when your app is in the background.

The variable can be set to the following values: "0" - Disable joystick & gamecontroller input events when the application is in the background. "1" - Enable joystick & gamecontroller input events when the application is in the background.

The default value is "0". This hint may be set at any time.

#define SDL_HINT_MAC_CTRL_CLICK_EMULATE_RIGHT_CLICK   "SDL_MAC_CTRL_CLICK_EMULATE_RIGHT_CLICK"

A variable that determines whether ctrl+click should generate a right-click event on Mac.

If present, holding ctrl while left clicking will generate a right click event when on Mac.

#define SDL_HINT_MOUSE_RELATIVE_MODE_WARP   "SDL_MOUSE_RELATIVE_MODE_WARP"

A variable controlling whether relative mouse mode is implemented using mouse warping.

This variable can be set to the following values: "0" - Relative mouse mode uses raw input "1" - Relative mouse mode uses mouse warping

By default SDL will use raw input for relative mouse mode

#define SDL_HINT_ORIENTATIONS   "SDL_IOS_ORIENTATIONS"

A variable controlling which orientations are allowed on iOS.

In some circumstances it is necessary to be able to explicitly control which UI orientations are allowed.

This variable is a space delimited list of the following values: "LandscapeLeft", "LandscapeRight", "Portrait" "PortraitUpsideDown"

#define SDL_HINT_RENDER_DIRECT3D11_DEBUG   "SDL_HINT_RENDER_DIRECT3D11_DEBUG"

A variable controlling whether to enable Direct3D 11+'s Debug Layer.

This variable does not have any effect on the Direct3D 9 based renderer.

This variable can be set to the following values: "0" - Disable Debug Layer use "1" - Enable Debug Layer use

By default, SDL does not use Direct3D Debug Layer.

#define SDL_HINT_RENDER_DIRECT3D_THREADSAFE   "SDL_RENDER_DIRECT3D_THREADSAFE"

A variable controlling whether the Direct3D device is initialized for thread-safe operations.

This variable can be set to the following values: "0" - Thread-safety is not enabled (faster) "1" - Thread-safety is enabled

By default the Direct3D device is created with thread-safety disabled.

#define SDL_HINT_RENDER_DRIVER   "SDL_RENDER_DRIVER"

A variable specifying which render driver to use.

If the application doesn't pick a specific renderer to use, this variable specifies the name of the preferred renderer. If the preferred renderer can't be initialized, the normal default renderer is used.

This variable is case insensitive and can be set to the following values: "direct3d" "opengl" "opengles2" "opengles" "software"

The default varies by platform, but it's the first one in the list that is available on the current platform.

#define SDL_HINT_RENDER_OPENGL_SHADERS   "SDL_RENDER_OPENGL_SHADERS"

A variable controlling whether the OpenGL render driver uses shaders if they are available.

This variable can be set to the following values: "0" - Disable shaders "1" - Enable shaders

By default shaders are used if OpenGL supports them.

#define SDL_HINT_RENDER_SCALE_QUALITY   "SDL_RENDER_SCALE_QUALITY"

A variable controlling the scaling quality.

This variable can be set to the following values: "0" or "nearest" - Nearest pixel sampling "1" or "linear" - Linear filtering (supported by OpenGL and Direct3D) "2" or "best" - Currently this is the same as "linear"

By default nearest pixel sampling is used

#define SDL_HINT_RENDER_VSYNC   "SDL_RENDER_VSYNC"

A variable controlling whether updates to the SDL screen surface should be synchronized with the vertical refresh, to avoid tearing.

This variable can be set to the following values: "0" - Disable vsync "1" - Enable vsync

By default SDL does not sync screen surface updates with vertical refresh.

#define SDL_HINT_TIMER_RESOLUTION   "SDL_TIMER_RESOLUTION"

A variable that controls the timer resolution, in milliseconds.

The higher resolution the timer, the more frequently the CPU services timer interrupts, and the more precise delays are, but this takes up power and CPU time. This hint is only used on Windows 7 and earlier.

See this blog post for more information: http://randomascii.wordpress.com/2013/07/08/windows-timer-resolution-megawatts-wasted/

If this variable is set to "0", the system timer resolution is not set.

The default value is "1". This hint may be set at any time.

#define SDL_HINT_VIDEO_ALLOW_SCREENSAVER   "SDL_VIDEO_ALLOW_SCREENSAVER"

A variable controlling whether the screensaver is enabled.

This variable can be set to the following values: "0" - Disable screensaver "1" - Enable screensaver

By default SDL will disable the screensaver.

#define SDL_HINT_VIDEO_MAC_FULLSCREEN_SPACES   "SDL_VIDEO_MAC_FULLSCREEN_SPACES"

A variable that dictates policy for fullscreen Spaces on Mac OS X.

This hint only applies to Mac OS X.

The variable can be set to the following values: "0" - Disable Spaces support (FULLSCREEN_DESKTOP won't use them and SDL_WINDOW_RESIZABLE windows won't offer the "fullscreen" button on their titlebars). "1" - Enable Spaces support (FULLSCREEN_DESKTOP will use them and SDL_WINDOW_RESIZABLE windows will offer the "fullscreen" button on their titlebars.

The default value is "1". Spaces are disabled regardless of this hint if the OS isn't at least Mac OS X Lion (10.7). This hint must be set before any windows are created.

#define SDL_HINT_VIDEO_WIN_D3DCOMPILER   "SDL_VIDEO_WIN_D3DCOMPILER"

A variable specifying which shader compiler to preload when using the Chrome ANGLE binaries.

SDL has EGL and OpenGL ES2 support on Windows via the ANGLE project. It can use two different sets of binaries, those compiled by the user from source or those provided by the Chrome browser. In the later case, these binaries require that SDL loads a DLL providing the shader compiler.

This variable can be set to the following values: "d3dcompiler_46.dll" - default, best for Vista or later. "d3dcompiler_43.dll" - for XP support. "none" - do not load any library, useful if you compiled ANGLE from source and included the compiler in your binaries.

#define SDL_HINT_VIDEO_WINDOW_SHARE_PIXEL_FORMAT   "SDL_VIDEO_WINDOW_SHARE_PIXEL_FORMAT"

A variable that is the address of another SDL_Window* (as a hex string formatted with "%p").

If this hint is set before SDL_CreateWindowFrom() and the SDL_Window* it is set to has SDL_WINDOW_OPENGL set (and running on WGL only, currently), then two things will occur on the newly created SDL_Window:

  1. Its pixel format will be set to the same pixel format as this SDL_Window. This is needed for example when sharing an OpenGL context across multiple windows.
  2. The flag SDL_WINDOW_OPENGL will be set on the new window so it can be used for OpenGL rendering.

This variable can be set to the following values: The address (as a string "%p") of the SDL_Window* that new windows created with SDL_CreateWindowFrom() should share a pixel format with.

#define SDL_HINT_VIDEO_X11_XINERAMA   "SDL_VIDEO_X11_XINERAMA"

A variable controlling whether the X11 Xinerama extension should be used.

This variable can be set to the following values: "0" - Disable Xinerama "1" - Enable Xinerama

By default SDL will use Xinerama if it is available.

#define SDL_HINT_VIDEO_X11_XRANDR   "SDL_VIDEO_X11_XRANDR"

A variable controlling whether the X11 XRandR extension should be used.

This variable can be set to the following values: "0" - Disable XRandR "1" - Enable XRandR

By default SDL will not use XRandR because of window manager issues.

#define SDL_HINT_VIDEO_X11_XVIDMODE   "SDL_VIDEO_X11_XVIDMODE"

A variable controlling whether the X11 VidMode extension should be used.

This variable can be set to the following values: "0" - Disable XVidMode "1" - Enable XVidMode

By default SDL will use XVidMode if it is available.

#define SDL_HINT_WINRT_HANDLE_BACK_BUTTON   "SDL_HINT_WINRT_HANDLE_BACK_BUTTON"

If set to 1, back button press events on Windows Phone 8+ will be marked as handled.

TODO, WinRT: document SDL_HINT_WINRT_HANDLE_BACK_BUTTON need and use For now, more details on why this is needed can be found at the beginning of the following web page: http://msdn.microsoft.com/en-us/library/windowsphone/develop/jj247550(v=vs.105).aspx

#define SDL_HINT_WINRT_PRIVACY_POLICY_LABEL   "SDL_HINT_WINRT_PRIVACY_POLICY_LABEL"

Label text for a WinRT app's privacy policy link.

Network-enabled WinRT apps must include a privacy policy. On Windows 8, 8.1, and RT, Microsoft mandates that this policy be available via the Windows Settings charm. SDL provides code to add a link there, with it's label text being set via the optional hint, SDL_HINT_WINRT_PRIVACY_POLICY_LABEL.

Please note that a privacy policy's contents are not set via this hint. A separate hint, SDL_HINT_WINRT_PRIVACY_POLICY_URL, is used to link to the actual text of the policy.

The contents of this hint should be encoded as a UTF8 string.

The default value is "Privacy Policy". This hint should only be set during app initialization, preferably before any calls to SDL_Init.

For additional information on linking to a privacy policy, see the documentation for SDL_HINT_WINRT_PRIVACY_POLICY_URL.

#define SDL_HINT_XINPUT_ENABLED   "SDL_XINPUT_ENABLED"

A variable that lets you disable the detection and use of Xinput gamepad devices.

The variable can be set to the following values: "0" - Disable XInput detection (only uses direct input) "1" - Enable XInput detection (the default)

Typedef Documentation

typedef void(* SDL_HintCallback)(void *userdata, const char *name, const char *oldValue, const char *newValue)

Add a function to watch a particular hint.

Parameters
nameThe hint to watch
callbackThe function to call when the hint value changes
userdataA pointer to pass to the callback function

Function Documentation

DECLSPEC void SDLCALL SDL_ClearHints ( void  )

Clear all hints.

This function is called during SDL_Quit() to free stored hints.

DECLSPEC void SDLCALL SDL_DelHintCallback ( const char *  name,
SDL_HintCallback  callback,
void userdata 
)

Remove a function watching a particular hint.

Parameters
nameThe hint being watched
callbackThe function being called when the hint value changes
userdataA pointer being passed to the callback function
DECLSPEC const char* SDLCALL SDL_GetHint ( const char *  name)

Get a hint.

Returns
The string value of a hint variable.
DECLSPEC SDL_bool SDLCALL SDL_SetHint ( const char *  name,
const char *  value 
)

Set a hint with normal priority.

Returns
SDL_TRUE if the hint was set, SDL_FALSE otherwise
DECLSPEC SDL_bool SDLCALL SDL_SetHintWithPriority ( const char *  name,
const char *  value,
SDL_HintPriority  priority 
)

Set a hint with a specific priority.

The priority controls the behavior when setting a hint that already has a value. Hints will replace existing hints of their priority and lower. Environment variables are considered to have override priority.

Returns
SDL_TRUE if the hint was set, SDL_FALSE otherwise