include/SDL_hints.h
author Sam Lantinga <slouken@libsdl.org>
Mon, 26 Nov 2012 16:37:54 -0800
changeset 6690 9548c8a58103
parent 6662 698c2e533a7e
child 6755 af77e1a6faf0
permissions -rw-r--r--
Added hotplug joystick support and simplified game controller API, courtesy of Alfred Reynolds
     1 /*
     2   Simple DirectMedia Layer
     3   Copyright (C) 1997-2012 Sam Lantinga <slouken@libsdl.org>
     4 
     5   This software is provided 'as-is', without any express or implied
     6   warranty.  In no event will the authors be held liable for any damages
     7   arising from the use of this software.
     8 
     9   Permission is granted to anyone to use this software for any purpose,
    10   including commercial applications, and to alter it and redistribute it
    11   freely, subject to the following restrictions:
    12 
    13   1. The origin of this software must not be misrepresented; you must not
    14      claim that you wrote the original software. If you use this software
    15      in a product, an acknowledgment in the product documentation would be
    16      appreciated but is not required.
    17   2. Altered source versions must be plainly marked as such, and must not be
    18      misrepresented as being the original software.
    19   3. This notice may not be removed or altered from any source distribution.
    20 */
    21 
    22 /**
    23  *  \file SDL_hints.h
    24  *  
    25  *  Official documentation for SDL configuration variables
    26  *
    27  *  This file contains functions to set and get configuration hints,
    28  *  as well as listing each of them alphabetically.
    29  *
    30  *  The convention for naming hints is SDL_HINT_X, where "SDL_X" is
    31  *  the environment variable that can be used to override the default.
    32  *
    33  *  In general these hints are just that - they may or may not be
    34  *  supported or applicable on any given platform, but they provide
    35  *  a way for an application or user to give the library a hint as
    36  *  to how they would like the library to work.
    37  */
    38 
    39 #ifndef _SDL_hints_h
    40 #define _SDL_hints_h
    41 
    42 #include "SDL_stdinc.h"
    43 
    44 #include "begin_code.h"
    45 /* Set up for C function definitions, even when using C++ */
    46 #ifdef __cplusplus
    47 /* *INDENT-OFF* */
    48 extern "C" {
    49 /* *INDENT-ON* */
    50 #endif
    51 
    52 /**
    53  *  \brief  A variable controlling how 3D acceleration is used to accelerate the SDL 1.2 screen surface. 
    54  *
    55  *  SDL can try to accelerate the SDL 1.2 screen surface by using streaming
    56  *  textures with a 3D rendering engine.  This variable controls whether and
    57  *  how this is done.
    58  *
    59  *  This variable can be set to the following values:
    60  *    "0"       - Disable 3D acceleration
    61  *    "1"       - Enable 3D acceleration, using the default renderer.
    62  *    "X"       - Enable 3D acceleration, using X where X is one of the valid rendering drivers.  (e.g. "direct3d", "opengl", etc.)
    63  *
    64  *  By default SDL tries to make a best guess for each platform whether
    65  *  to use acceleration or not.
    66  */
    67 #define SDL_HINT_FRAMEBUFFER_ACCELERATION   "SDL_FRAMEBUFFER_ACCELERATION"
    68 
    69 /**
    70  *  \brief  A variable specifying which render driver to use.
    71  *
    72  *  If the application doesn't pick a specific renderer to use, this variable
    73  *  specifies the name of the preferred renderer.  If the preferred renderer
    74  *  can't be initialized, the normal default renderer is used.
    75  *
    76  *  This variable is case insensitive and can be set to the following values:
    77  *    "direct3d"
    78  *    "opengl"
    79  *    "opengles2"
    80  *    "opengles"
    81  *    "software"
    82  *
    83  *  The default varies by platform, but it's the first one in the list that
    84  *  is available on the current platform.
    85  */
    86 #define SDL_HINT_RENDER_DRIVER              "SDL_RENDER_DRIVER"
    87 
    88 /**
    89  *  \brief  A variable controlling whether the OpenGL render driver uses shaders if they are available.
    90  *
    91  *  This variable can be set to the following values:
    92  *    "0"       - Disable shaders
    93  *    "1"       - Enable shaders
    94  *
    95  *  By default shaders are used if OpenGL supports them.
    96  */
    97 #define SDL_HINT_RENDER_OPENGL_SHADERS      "SDL_RENDER_OPENGL_SHADERS"
    98 
    99 /**
   100  *  \brief  A variable controlling the scaling quality
   101  *
   102  *  This variable can be set to the following values:
   103  *    "0" or "nearest" - Nearest pixel sampling
   104  *    "1" or "linear"  - Linear filtering (supported by OpenGL and Direct3D)
   105  *    "2" or "best"    - Anisotropic filtering (supported by Direct3D)
   106  *
   107  *  By default nearest pixel sampling is used
   108  */
   109 #define SDL_HINT_RENDER_SCALE_QUALITY       "SDL_RENDER_SCALE_QUALITY"
   110 
   111 /**
   112  *  \brief  A variable controlling whether updates to the SDL 1.2 screen surface should be synchronized with the vertical refresh, to avoid tearing.
   113  *
   114  *  This variable can be set to the following values:
   115  *    "0"       - Disable vsync
   116  *    "1"       - Enable vsync
   117  *
   118  *  By default SDL does not sync screen surface updates with vertical refresh.
   119  */
   120 #define SDL_HINT_RENDER_VSYNC               "SDL_RENDER_VSYNC"
   121 
   122 /**
   123  *  \brief  A variable controlling whether the X11 VidMode extension should be used.
   124  *
   125  *  This variable can be set to the following values:
   126  *    "0"       - Disable XVidMode
   127  *    "1"       - Enable XVidMode
   128  *
   129  *  By default SDL will use XVidMode if it is available.
   130  */
   131 #define SDL_HINT_VIDEO_X11_XVIDMODE         "SDL_VIDEO_X11_XVIDMODE"
   132 
   133 /**
   134  *  \brief  A variable controlling whether the X11 Xinerama extension should be used.
   135  *
   136  *  This variable can be set to the following values:
   137  *    "0"       - Disable Xinerama
   138  *    "1"       - Enable Xinerama
   139  *
   140  *  By default SDL will use Xinerama if it is available.
   141  */
   142 #define SDL_HINT_VIDEO_X11_XINERAMA         "SDL_VIDEO_X11_XINERAMA"
   143 
   144 /**
   145  *  \brief  A variable controlling whether the X11 XRandR extension should be used.
   146  *
   147  *  This variable can be set to the following values:
   148  *    "0"       - Disable XRandR
   149  *    "1"       - Enable XRandR
   150  *
   151  *  By default SDL will not use XRandR because of window manager issues.
   152  */
   153 #define SDL_HINT_VIDEO_X11_XRANDR           "SDL_VIDEO_X11_XRANDR"
   154 
   155 /**
   156  *  \brief  A variable controlling whether grabbing input grabs the keyboard
   157  *
   158  *  This variable can be set to the following values:
   159  *    "0"       - Grab will affect only the mouse
   160  *    "1"       - Grab will affect mouse and keyboard
   161  *
   162  *  By default SDL will not grab the keyboard so system shortcuts still work.
   163  */
   164 #define SDL_HINT_GRAB_KEYBOARD              "SDL_GRAB_KEYBOARD"
   165 
   166 /**
   167  *  \brief  A variable controlling whether the idle timer is disabled on iOS.
   168  *
   169  *  When an iOS app does not receive touches for some time, the screen is
   170  *  dimmed automatically. For games where the accelerometer is the only input
   171  *  this is problematic. This functionality can be disabled by setting this
   172  *  hint.
   173  *
   174  *  This variable can be set to the following values:
   175  *    "0"       - Enable idle timer
   176  *    "1"       - Disable idle timer
   177  */
   178 #define SDL_HINT_IDLE_TIMER_DISABLED "SDL_IOS_IDLE_TIMER_DISABLED"
   179 	
   180 /**
   181  *  \brief  A variable controlling which orientations are allowed on iOS.
   182  *
   183  *  In some circumstances it is necessary to be able to explicitly control
   184  *  which UI orientations are allowed.
   185  *
   186  *  This variable is a space delimited list of the following values:
   187  *    "LandscapeLeft", "LandscapeRight", "Portrait" "PortraitUpsideDown"
   188  */
   189 #define SDL_HINT_ORIENTATIONS "SDL_IOS_ORIENTATIONS"
   190 
   191 
   192 /**
   193  *  \brief  A variable that lets you manually hint extra gamecontroller db entries
   194  *
   195  *  The variable expected newline delimited rows of gamecontroller config data, see SDL_gamecontroller.h
   196  */
   197 #define SDL_HINT_GAMECONTROLLERCONFIG "SDL_GAMECONTROLLERCONFIG"
   198 
   199 
   200 /**
   201  *  \brief  An enumeration of hint priorities
   202  */
   203 typedef enum
   204 {
   205     SDL_HINT_DEFAULT,
   206     SDL_HINT_NORMAL,
   207     SDL_HINT_OVERRIDE
   208 } SDL_HintPriority;
   209 
   210 
   211 /**
   212  *  \brief Set a hint with a specific priority
   213  *
   214  *  The priority controls the behavior when setting a hint that already
   215  *  has a value.  Hints will replace existing hints of their priority and
   216  *  lower.  Environment variables are considered to have override priority.
   217  * 
   218  *  \return SDL_TRUE if the hint was set, SDL_FALSE otherwise
   219  */
   220 extern DECLSPEC SDL_bool SDLCALL SDL_SetHintWithPriority(const char *name,
   221                                                          const char *value,
   222                                                          SDL_HintPriority priority);
   223 
   224 /**
   225  *  \brief Set a hint with normal priority
   226  * 
   227  *  \return SDL_TRUE if the hint was set, SDL_FALSE otherwise
   228  */
   229 extern DECLSPEC SDL_bool SDLCALL SDL_SetHint(const char *name,
   230                                              const char *value);
   231 
   232 
   233 /**
   234  *  \brief Get a hint
   235  *  
   236  *  \return The string value of a hint variable.
   237  */
   238 extern DECLSPEC const char * SDLCALL SDL_GetHint(const char *name);
   239 
   240 /**
   241  *  \brief  Clear all hints
   242  *
   243  *  This function is called during SDL_Quit() to free stored hints.
   244  */
   245 extern DECLSPEC void SDLCALL SDL_ClearHints(void);
   246 
   247 
   248 /* Ends C function definitions when using C++ */
   249 #ifdef __cplusplus
   250 /* *INDENT-OFF* */
   251 }
   252 /* *INDENT-ON* */
   253 #endif
   254 #include "close_code.h"
   255 
   256 #endif /* _SDL_hints_h */
   257 
   258 /* vi: set ts=4 sw=4 expandtab: */