include/SDL_hints.h
author Sam Lantinga <slouken@libsdl.org>
Sat, 12 Feb 2011 12:04:00 -0800
changeset 5272 3c94c559f5c2
parent 5262 b530ef003506
child 5484 e20c93bc9122
permissions -rw-r--r--
changeset: 5272:cb08ef104ac4
tag: tip
user: Martin Decky <martin@decky.cz>
date: Sat Feb 12 20:53:06 2011 +0100
summary: improve header files compatibility with SDL 1.2 applications (namely QEMU)
     1 /*
     2     SDL - Simple DihintsMedia Layer
     3     Copyright (C) 1997-2011 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  *    "opengles2"
    81  *    "opengles"
    82  *    "software"
    83  *
    84  *  The default varies by platform, but it's the first one in the list that
    85  *  is available on the current platform.
    86  */
    87 #define SDL_HINT_RENDER_DRIVER              "SDL_RENDER_DRIVER"
    88 
    89 /**
    90  *  \brief  A variable controlling whether the OpenGL render driver uses shaders if they are available.
    91  *
    92  *  This variable can be set to the following values:
    93  *    "0"       - Disable shaders
    94  *    "1"       - Enable shaders
    95  *
    96  *  By default shaders are used if OpenGL supports them.
    97  */
    98 #define SDL_HINT_RENDER_OPENGL_SHADERS      "SDL_RENDER_OPENGL_SHADERS"
    99 
   100 /**
   101  *  \brief  A variable controlling whether updates to the SDL 1.2 screen surface should be synchronized with the vertical refresh, to avoid tearing.
   102  *
   103  *  This variable can be set to the following values:
   104  *    "0"       - Disable vsync
   105  *    "1"       - Enable vsync
   106  *
   107  *  By default SDL does not sync screen surface updates with vertical refresh.
   108  */
   109 #define SDL_HINT_RENDER_VSYNC               "SDL_RENDER_VSYNC"
   110 
   111 
   112 /**
   113  *  \brief  An enumeration of hint priorities
   114  */
   115 typedef enum
   116 {
   117     SDL_HINT_DEFAULT,
   118     SDL_HINT_NORMAL,
   119     SDL_HINT_OVERRIDE
   120 } SDL_HintPriority;
   121 
   122 
   123 /**
   124  *  \brief Set a hint with a specific priority
   125  *
   126  *  The priority controls the behavior when setting a hint that already
   127  *  has a value.  Hints will replace existing hints of their priority and
   128  *  lower.  Environment variables are considered to have override priority.
   129  * 
   130  *  \return SDL_TRUE if the hint was set, SDL_FALSE otherwise
   131  */
   132 extern DECLSPEC SDL_bool SDLCALL SDL_SetHintWithPriority(const char *name,
   133                                                          const char *value,
   134                                                          SDL_HintPriority priority);
   135 
   136 /**
   137  *  \brief Set a hint with normal priority
   138  * 
   139  *  \return SDL_TRUE if the hint was set, SDL_FALSE otherwise
   140  */
   141 extern DECLSPEC SDL_bool SDLCALL SDL_SetHint(const char *name,
   142                                              const char *value);
   143 
   144 
   145 /**
   146  *  \brief Get a hint
   147  *  
   148  *  \return The string value of a hint variable.
   149  */
   150 extern DECLSPEC const char * SDLCALL SDL_GetHint(const char *name);
   151 
   152 /**
   153  *  \brief  Clear all hints
   154  *
   155  *  This function is called during SDL_Quit() to free stored hints.
   156  */
   157 extern DECLSPEC void SDLCALL SDL_ClearHints(void);
   158 
   159 
   160 /* Ends C function definitions when using C++ */
   161 #ifdef __cplusplus
   162 /* *INDENT-OFF* */
   163 }
   164 /* *INDENT-ON* */
   165 #endif
   166 #include "close_code.h"
   167 
   168 #endif /* _SDL_hints_h */
   169 
   170 /* vi: set ts=4 sw=4 expandtab: */