SDL_hints.h 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340
  1. /*
  2. Simple DirectMedia Layer
  3. Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org>
  4. This software is provided 'as-is', without any express or implied
  5. warranty. In no event will the authors be held liable for any damages
  6. arising from the use of this software.
  7. Permission is granted to anyone to use this software for any purpose,
  8. including commercial applications, and to alter it and redistribute it
  9. freely, subject to the following restrictions:
  10. 1. The origin of this software must not be misrepresented; you must not
  11. claim that you wrote the original software. If you use this software
  12. in a product, an acknowledgment in the product documentation would be
  13. appreciated but is not required.
  14. 2. Altered source versions must be plainly marked as such, and must not be
  15. misrepresented as being the original software.
  16. 3. This notice may not be removed or altered from any source distribution.
  17. */
  18. /**
  19. * \file SDL_hints.h
  20. *
  21. * Official documentation for SDL configuration variables
  22. *
  23. * This file contains functions to set and get configuration hints,
  24. * as well as listing each of them alphabetically.
  25. *
  26. * The convention for naming hints is SDL_HINT_X, where "SDL_X" is
  27. * the environment variable that can be used to override the default.
  28. *
  29. * In general these hints are just that - they may or may not be
  30. * supported or applicable on any given platform, but they provide
  31. * a way for an application or user to give the library a hint as
  32. * to how they would like the library to work.
  33. */
  34. #ifndef _SDL_hints_h
  35. #define _SDL_hints_h
  36. #include "SDL_stdinc.h"
  37. #include "begin_code.h"
  38. /* Set up for C function definitions, even when using C++ */
  39. #ifdef __cplusplus
  40. extern "C" {
  41. #endif
  42. /**
  43. * \brief A variable controlling how 3D acceleration is used to accelerate the SDL screen surface.
  44. *
  45. * SDL can try to accelerate the SDL screen surface by using streaming
  46. * textures with a 3D rendering engine. This variable controls whether and
  47. * how this is done.
  48. *
  49. * This variable can be set to the following values:
  50. * "0" - Disable 3D acceleration
  51. * "1" - Enable 3D acceleration, using the default renderer.
  52. * "X" - Enable 3D acceleration, using X where X is one of the valid rendering drivers. (e.g. "direct3d", "opengl", etc.)
  53. *
  54. * By default SDL tries to make a best guess for each platform whether
  55. * to use acceleration or not.
  56. */
  57. #define SDL_HINT_FRAMEBUFFER_ACCELERATION "SDL_FRAMEBUFFER_ACCELERATION"
  58. /**
  59. * \brief A variable specifying which render driver to use.
  60. *
  61. * If the application doesn't pick a specific renderer to use, this variable
  62. * specifies the name of the preferred renderer. If the preferred renderer
  63. * can't be initialized, the normal default renderer is used.
  64. *
  65. * This variable is case insensitive and can be set to the following values:
  66. * "direct3d"
  67. * "opengl"
  68. * "opengles2"
  69. * "opengles"
  70. * "software"
  71. *
  72. * The default varies by platform, but it's the first one in the list that
  73. * is available on the current platform.
  74. */
  75. #define SDL_HINT_RENDER_DRIVER "SDL_RENDER_DRIVER"
  76. /**
  77. * \brief A variable controlling whether the OpenGL render driver uses shaders if they are available.
  78. *
  79. * This variable can be set to the following values:
  80. * "0" - Disable shaders
  81. * "1" - Enable shaders
  82. *
  83. * By default shaders are used if OpenGL supports them.
  84. */
  85. #define SDL_HINT_RENDER_OPENGL_SHADERS "SDL_RENDER_OPENGL_SHADERS"
  86. /**
  87. * \brief A variable controlling the scaling quality
  88. *
  89. * This variable can be set to the following values:
  90. * "0" or "nearest" - Nearest pixel sampling
  91. * "1" or "linear" - Linear filtering (supported by OpenGL and Direct3D)
  92. * "2" or "best" - Anisotropic filtering (supported by Direct3D)
  93. *
  94. * By default nearest pixel sampling is used
  95. */
  96. #define SDL_HINT_RENDER_SCALE_QUALITY "SDL_RENDER_SCALE_QUALITY"
  97. /**
  98. * \brief A variable controlling whether updates to the SDL screen surface should be synchronized with the vertical refresh, to avoid tearing.
  99. *
  100. * This variable can be set to the following values:
  101. * "0" - Disable vsync
  102. * "1" - Enable vsync
  103. *
  104. * By default SDL does not sync screen surface updates with vertical refresh.
  105. */
  106. #define SDL_HINT_RENDER_VSYNC "SDL_RENDER_VSYNC"
  107. /**
  108. * \brief A variable controlling whether the X11 VidMode extension should be used.
  109. *
  110. * This variable can be set to the following values:
  111. * "0" - Disable XVidMode
  112. * "1" - Enable XVidMode
  113. *
  114. * By default SDL will use XVidMode if it is available.
  115. */
  116. #define SDL_HINT_VIDEO_X11_XVIDMODE "SDL_VIDEO_X11_XVIDMODE"
  117. /**
  118. * \brief A variable controlling whether the X11 Xinerama extension should be used.
  119. *
  120. * This variable can be set to the following values:
  121. * "0" - Disable Xinerama
  122. * "1" - Enable Xinerama
  123. *
  124. * By default SDL will use Xinerama if it is available.
  125. */
  126. #define SDL_HINT_VIDEO_X11_XINERAMA "SDL_VIDEO_X11_XINERAMA"
  127. /**
  128. * \brief A variable controlling whether the X11 XRandR extension should be used.
  129. *
  130. * This variable can be set to the following values:
  131. * "0" - Disable XRandR
  132. * "1" - Enable XRandR
  133. *
  134. * By default SDL will not use XRandR because of window manager issues.
  135. */
  136. #define SDL_HINT_VIDEO_X11_XRANDR "SDL_VIDEO_X11_XRANDR"
  137. /**
  138. * \brief A variable controlling whether grabbing input grabs the keyboard
  139. *
  140. * This variable can be set to the following values:
  141. * "0" - Grab will affect only the mouse
  142. * "1" - Grab will affect mouse and keyboard
  143. *
  144. * By default SDL will not grab the keyboard so system shortcuts still work.
  145. */
  146. #define SDL_HINT_GRAB_KEYBOARD "SDL_GRAB_KEYBOARD"
  147. /**
  148. * \brief Minimize your SDL_Window if it loses key focus when in Fullscreen mode. Defaults to true.
  149. *
  150. */
  151. #define SDL_HINT_VIDEO_MINIMIZE_ON_FOCUS_LOSS "SDL_VIDEO_MINIMIZE_ON_FOCUS_LOSS"
  152. /**
  153. * \brief A variable controlling whether the idle timer is disabled on iOS.
  154. *
  155. * When an iOS app does not receive touches for some time, the screen is
  156. * dimmed automatically. For games where the accelerometer is the only input
  157. * this is problematic. This functionality can be disabled by setting this
  158. * hint.
  159. *
  160. * This variable can be set to the following values:
  161. * "0" - Enable idle timer
  162. * "1" - Disable idle timer
  163. */
  164. #define SDL_HINT_IDLE_TIMER_DISABLED "SDL_IOS_IDLE_TIMER_DISABLED"
  165. /**
  166. * \brief A variable controlling which orientations are allowed on iOS.
  167. *
  168. * In some circumstances it is necessary to be able to explicitly control
  169. * which UI orientations are allowed.
  170. *
  171. * This variable is a space delimited list of the following values:
  172. * "LandscapeLeft", "LandscapeRight", "Portrait" "PortraitUpsideDown"
  173. */
  174. #define SDL_HINT_ORIENTATIONS "SDL_IOS_ORIENTATIONS"
  175. /**
  176. * \brief A variable that lets you disable the detection and use of Xinput gamepad devices
  177. *
  178. * The variable can be set to the following values:
  179. * "0" - Disable XInput timer (only uses direct input)
  180. * "1" - Enable XInput timer (the default)
  181. */
  182. #define SDL_HINT_XINPUT_ENABLED "SDL_XINPUT_ENABLED"
  183. /**
  184. * \brief A variable that lets you manually hint extra gamecontroller db entries
  185. *
  186. * The variable should be newline delimited rows of gamecontroller config data, see SDL_gamecontroller.h
  187. *
  188. * This hint must be set before calling SDL_Init(SDL_INIT_GAMECONTROLLER)
  189. * You can update mappings after the system is initialized with SDL_GameControllerMappingForGUID() and SDL_GameControllerAddMapping()
  190. */
  191. #define SDL_HINT_GAMECONTROLLERCONFIG "SDL_GAMECONTROLLERCONFIG"
  192. /**
  193. * \brief A variable that lets you enable joystick (and gamecontroller) events even when your app is in the background.
  194. *
  195. * The variable can be set to the following values:
  196. * "0" - Disable joystick & gamecontroller input events when the
  197. * application is in the background.
  198. * "1" - Enable joystick & gamecontroller input events when the
  199. * application is in the backgroumd.
  200. *
  201. * The default value is "0". This hint may be set at any time.
  202. */
  203. #define SDL_HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS "SDL_JOYSTICK_ALLOW_BACKGROUND_EVENTS"
  204. /**
  205. * \brief If set to 0 then never set the top most bit on a SDL Window, even if the video mode expects it.
  206. * This is a debugging aid for developers and not expected to be used by end users. The default is "1"
  207. *
  208. * This variable can be set to the following values:
  209. * "0" - don't allow topmost
  210. * "1" - allow topmost
  211. */
  212. #define SDL_HINT_ALLOW_TOPMOST "SDL_ALLOW_TOPMOST"
  213. /**
  214. * \brief A variable that controls the timer resolution, in milliseconds.
  215. *
  216. * The higher resolution the timer, the more frequently the CPU services
  217. * timer interrupts, and the more precise delays are, but this takes up
  218. * power and CPU time. This hint is only used on Windows 7 and earlier.
  219. *
  220. * See this blog post for more information:
  221. * http://randomascii.wordpress.com/2013/07/08/windows-timer-resolution-megawatts-wasted/
  222. *
  223. * If this variable is set to "0", the system timer resolution is not set.
  224. *
  225. * The default value is "1". This hint may be set at any time.
  226. */
  227. #define SDL_HINT_TIMER_RESOLUTION "SDL_TIMER_RESOLUTION"
  228. /**
  229. * \brief An enumeration of hint priorities
  230. */
  231. typedef enum
  232. {
  233. SDL_HINT_DEFAULT,
  234. SDL_HINT_NORMAL,
  235. SDL_HINT_OVERRIDE
  236. } SDL_HintPriority;
  237. /**
  238. * \brief Set a hint with a specific priority
  239. *
  240. * The priority controls the behavior when setting a hint that already
  241. * has a value. Hints will replace existing hints of their priority and
  242. * lower. Environment variables are considered to have override priority.
  243. *
  244. * \return SDL_TRUE if the hint was set, SDL_FALSE otherwise
  245. */
  246. extern DECLSPEC SDL_bool SDLCALL SDL_SetHintWithPriority(const char *name,
  247. const char *value,
  248. SDL_HintPriority priority);
  249. /**
  250. * \brief Set a hint with normal priority
  251. *
  252. * \return SDL_TRUE if the hint was set, SDL_FALSE otherwise
  253. */
  254. extern DECLSPEC SDL_bool SDLCALL SDL_SetHint(const char *name,
  255. const char *value);
  256. /**
  257. * \brief Get a hint
  258. *
  259. * \return The string value of a hint variable.
  260. */
  261. extern DECLSPEC const char * SDLCALL SDL_GetHint(const char *name);
  262. /**
  263. * \brief Add a function to watch a particular hint
  264. *
  265. * \param name The hint to watch
  266. * \param callback The function to call when the hint value changes
  267. * \param userdata A pointer to pass to the callback function
  268. */
  269. typedef void (*SDL_HintCallback)(void *userdata, const char *name, const char *oldValue, const char *newValue);
  270. extern DECLSPEC void SDLCALL SDL_AddHintCallback(const char *name,
  271. SDL_HintCallback callback,
  272. void *userdata);
  273. /**
  274. * \brief Remove a function watching a particular hint
  275. *
  276. * \param name The hint being watched
  277. * \param callback The function being called when the hint value changes
  278. * \param userdata A pointer being passed to the callback function
  279. */
  280. extern DECLSPEC void SDLCALL SDL_DelHintCallback(const char *name,
  281. SDL_HintCallback callback,
  282. void *userdata);
  283. /**
  284. * \brief Clear all hints
  285. *
  286. * This function is called during SDL_Quit() to free stored hints.
  287. */
  288. extern DECLSPEC void SDLCALL SDL_ClearHints(void);
  289. /* Ends C function definitions when using C++ */
  290. #ifdef __cplusplus
  291. }
  292. #endif
  293. #include "close_code.h"
  294. #endif /* _SDL_hints_h */
  295. /* vi: set ts=4 sw=4 expandtab: */