include/SDL_hints.h
author Sam Lantinga <slouken@libsdl.org>
Sat, 05 Feb 2011 20:02:37 -0800
changeset 5200 01bced9a4cc1
parent 5192 ef5a61ea3202
child 5233 ce4f91138031
permissions -rw-r--r--
Created a simpler version of SDL_SetHint() that doesn't need a priority.
     1 /*
     2     SDL - Simple DihintsMedia Layer
     3     Copyright (C) 1997-2010 Sam Lantinga
     4 
     5     This library is free software; you can redistribute it and/or
     6     modify it under the terms of the GNU Lesser General Public
     7     License as published by the Free Software Foundation; either
     8     version 2.1 of the License, or (at your option) any later version.
     9 
    10     This library is distributed in the hope that it will be useful,
    11     but WITHOUT ANY WARRANTY; without even the implied warranty of
    12     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    13     Lesser General Public License for more details.
    14 
    15     You should have received a copy of the GNU Lesser General Public
    16     License along with this library; if not, write to the Free Software
    17     Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
    18 
    19     Sam Lantinga
    20     slouken@libsdl.org
    21 */
    22 
    23 /**
    24  *  \file SDL_hints.h
    25  *  
    26  *  Official documentation for SDL configuration variables
    27  *
    28  *  This file contains functions to set and get configuration hints,
    29  *  as well as listing each of them alphabetically.
    30  *
    31  *  The convention for naming hints is SDL_HINT_X, where "SDL_X" is
    32  *  the environment variable that can be used to override the default.
    33  *
    34  *  In general these hints are just that - they may or may not be
    35  *  supported or applicable on any given platform, but they provide
    36  *  a way for an application or user to give the library a hint as
    37  *  to how they would like the library to work.
    38  */
    39 
    40 #ifndef _SDL_hints_h
    41 #define _SDL_hints_h
    42 
    43 #include "SDL_stdinc.h"
    44 
    45 #include "begin_code.h"
    46 /* Set up for C function definitions, even when using C++ */
    47 #ifdef __cplusplus
    48 /* *INDENT-OFF* */
    49 extern "C" {
    50 /* *INDENT-ON* */
    51 #endif
    52 
    53 /**
    54  *  \brief  A variable controlling how 3D acceleration is used to accelerate the SDL 1.2 screen surface. 
    55  *
    56  *  SDL can try to accelerate the SDL 1.2 screen surface by using streaming
    57  *  textures with a 3D rendering engine.  This variable controls whether and
    58  *  how this is done.
    59  *
    60  *  This variable can be set to the following values:
    61  *    "0"       - Disable 3D acceleration
    62  *    "1"       - Enable 3D acceleration, using the default renderer.
    63  *    "X"       - Enable 3D acceleration, using X where X is one of the valid rendering drivers.  (e.g. "direct3d", "opengl", etc.)
    64  *
    65  *  By default SDL tries to make a best guess for each platform whether
    66  *  to use acceleration or not.
    67  */
    68 #define SDL_HINT_FRAMEBUFFER_ACCELERATION   "SDL_FRAMEBUFFER_ACCELERATION"
    69 
    70 /**
    71  *  \brief  A variable specifying which render driver to use.
    72  *
    73  *  If the application doesn't pick a specific renderer to use, this variable
    74  *  specifies the name of the preferred renderer.  If the preferred renderer
    75  *  can't be initialized, the normal default renderer is used.
    76  *
    77  *  This variable is case insensitive and can be set to the following values:
    78  *    "direct3d"
    79  *    "opengl"
    80  *    "opengles"
    81  *    "software"
    82  */
    83 #define SDL_HINT_RENDER_DRIVER              "SDL_RENDER_DRIVER"
    84 
    85 /**
    86  *  \brief  A variable controlling whether updates to the SDL 1.2 screen surface should be synchronized with the vertical refresh, to avoid tearing.
    87  *
    88  *  This variable can be set to the following values:
    89  *    "0"       - Disable vsync
    90  *    "1"       - Enable vsync
    91  *
    92  *  By default SDL does not sync screen surface updates with vertical refresh.
    93  */
    94 #define SDL_HINT_RENDER_VSYNC               "SDL_RENDER_VSYNC"
    95 
    96 
    97 /**
    98  *  \brief  An enumeration of hint priorities
    99  */
   100 typedef enum
   101 {
   102     SDL_HINT_DEFAULT,
   103     SDL_HINT_NORMAL,
   104     SDL_HINT_OVERRIDE
   105 } SDL_HintPriority;
   106 
   107 
   108 /**
   109  *  \brief Set a hint with a specific priority
   110  *
   111  *  The priority controls the behavior when setting a hint that already
   112  *  has a value.  Hints will replace existing hints of their priority and
   113  *  lower.  Environment variables are considered to have override priority.
   114  * 
   115  *  \return SDL_TRUE if the hint was set, SDL_FALSE otherwise
   116  */
   117 extern DECLSPEC SDL_bool SDLCALL SDL_SetHintWithPriority(const char *name,
   118                                                          const char *value,
   119                                                          SDL_HintPriority priority);
   120 
   121 /**
   122  *  \brief Set a hint with normal priority
   123  * 
   124  *  \return SDL_TRUE if the hint was set, SDL_FALSE otherwise
   125  */
   126 extern DECLSPEC SDL_bool SDLCALL SDL_SetHint(const char *name,
   127                                              const char *value);
   128 
   129 
   130 /**
   131  *  \brief Get a hint
   132  *  
   133  *  \return The string value of a hint variable.
   134  */
   135 extern DECLSPEC const char * SDLCALL SDL_GetHint(const char *name);
   136 
   137 /**
   138  *  \brief  Clear all hints
   139  *
   140  *  This function is called during SDL_Quit() to free stored hints.
   141  */
   142 extern DECLSPEC void SDLCALL SDL_ClearHints();
   143 
   144 
   145 /* Ends C function definitions when using C++ */
   146 #ifdef __cplusplus
   147 /* *INDENT-OFF* */
   148 }
   149 /* *INDENT-ON* */
   150 #endif
   151 #include "close_code.h"
   152 
   153 #endif /* _SDL_hints_h */
   154 
   155 /* vi: set ts=4 sw=4 expandtab: */