25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276
  1. /*
  2. Simple DirectMedia Layer
  3. Copyright (C) 1997-2018 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_video.h
  20. *
  21. * Header file for SDL video functions.
  22. */
  23. #ifndef SDL_video_h_
  24. #define SDL_video_h_
  25. #include "SDL_stdinc.h"
  26. #include "SDL_pixels.h"
  27. #include "SDL_rect.h"
  28. #include "SDL_surface.h"
  29. #include "begin_code.h"
  30. /* Set up for C function definitions, even when using C++ */
  31. #ifdef __cplusplus
  32. extern "C" {
  33. #endif
  34. /**
  35. * \brief The structure that defines a display mode
  36. *
  37. * \sa SDL_GetNumDisplayModes()
  38. * \sa SDL_GetDisplayMode()
  39. * \sa SDL_GetDesktopDisplayMode()
  40. * \sa SDL_GetCurrentDisplayMode()
  41. * \sa SDL_GetClosestDisplayMode()
  42. * \sa SDL_SetWindowDisplayMode()
  43. * \sa SDL_GetWindowDisplayMode()
  44. */
  45. typedef struct
  46. {
  47. Uint32 format; /**< pixel format */
  48. int w; /**< width, in screen coordinates */
  49. int h; /**< height, in screen coordinates */
  50. int refresh_rate; /**< refresh rate (or zero for unspecified) */
  51. void *driverdata; /**< driver-specific data, initialize to 0 */
  52. } SDL_DisplayMode;
  53. /**
  54. * \brief The type used to identify a window
  55. *
  56. * \sa SDL_CreateWindow()
  57. * \sa SDL_CreateWindowFrom()
  58. * \sa SDL_DestroyWindow()
  59. * \sa SDL_GetWindowData()
  60. * \sa SDL_GetWindowFlags()
  61. * \sa SDL_GetWindowGrab()
  62. * \sa SDL_GetWindowPosition()
  63. * \sa SDL_GetWindowSize()
  64. * \sa SDL_GetWindowTitle()
  65. * \sa SDL_HideWindow()
  66. * \sa SDL_MaximizeWindow()
  67. * \sa SDL_MinimizeWindow()
  68. * \sa SDL_RaiseWindow()
  69. * \sa SDL_RestoreWindow()
  70. * \sa SDL_SetWindowData()
  71. * \sa SDL_SetWindowFullscreen()
  72. * \sa SDL_SetWindowGrab()
  73. * \sa SDL_SetWindowIcon()
  74. * \sa SDL_SetWindowPosition()
  75. * \sa SDL_SetWindowSize()
  76. * \sa SDL_SetWindowBordered()
  77. * \sa SDL_SetWindowResizable()
  78. * \sa SDL_SetWindowTitle()
  79. * \sa SDL_ShowWindow()
  80. */
  81. typedef struct SDL_Window SDL_Window;
  82. /**
  83. * \brief The flags on a window
  84. *
  85. * \sa SDL_GetWindowFlags()
  86. */
  87. typedef enum
  88. {
  89. /* !!! FIXME: change this to name = (1<<x). */
  90. SDL_WINDOW_FULLSCREEN = 0x00000001, /**< fullscreen window */
  91. SDL_WINDOW_OPENGL = 0x00000002, /**< window usable with OpenGL context */
  92. SDL_WINDOW_SHOWN = 0x00000004, /**< window is visible */
  93. SDL_WINDOW_HIDDEN = 0x00000008, /**< window is not visible */
  94. SDL_WINDOW_BORDERLESS = 0x00000010, /**< no window decoration */
  95. SDL_WINDOW_RESIZABLE = 0x00000020, /**< window can be resized */
  96. SDL_WINDOW_MINIMIZED = 0x00000040, /**< window is minimized */
  97. SDL_WINDOW_MAXIMIZED = 0x00000080, /**< window is maximized */
  98. SDL_WINDOW_INPUT_GRABBED = 0x00000100, /**< window has grabbed input focus */
  99. SDL_WINDOW_INPUT_FOCUS = 0x00000200, /**< window has input focus */
  100. SDL_WINDOW_MOUSE_FOCUS = 0x00000400, /**< window has mouse focus */
  101. SDL_WINDOW_FULLSCREEN_DESKTOP = ( SDL_WINDOW_FULLSCREEN | 0x00001000 ),
  102. SDL_WINDOW_FOREIGN = 0x00000800, /**< window not created by SDL */
  103. SDL_WINDOW_ALLOW_HIGHDPI = 0x00002000, /**< window should be created in high-DPI mode if supported.
  104. On macOS NSHighResolutionCapable must be set true in the
  105. application's Info.plist for this to have any effect. */
  106. SDL_WINDOW_MOUSE_CAPTURE = 0x00004000, /**< window has mouse captured (unrelated to INPUT_GRABBED) */
  107. SDL_WINDOW_ALWAYS_ON_TOP = 0x00008000, /**< window should always be above others */
  108. SDL_WINDOW_SKIP_TASKBAR = 0x00010000, /**< window should not be added to the taskbar */
  109. SDL_WINDOW_UTILITY = 0x00020000, /**< window should be treated as a utility window */
  110. SDL_WINDOW_TOOLTIP = 0x00040000, /**< window should be treated as a tooltip */
  111. SDL_WINDOW_POPUP_MENU = 0x00080000, /**< window should be treated as a popup menu */
  112. SDL_WINDOW_VULKAN = 0x10000000 /**< window usable for Vulkan surface */
  113. } SDL_WindowFlags;
  114. /**
  115. * \brief Used to indicate that you don't care what the window position is.
  116. */
  117. #define SDL_WINDOWPOS_UNDEFINED_MASK 0x1FFF0000u
  118. #define SDL_WINDOWPOS_UNDEFINED_DISPLAY(X) (SDL_WINDOWPOS_UNDEFINED_MASK|(X))
  119. #define SDL_WINDOWPOS_UNDEFINED SDL_WINDOWPOS_UNDEFINED_DISPLAY(0)
  120. #define SDL_WINDOWPOS_ISUNDEFINED(X) \
  121. (((X)&0xFFFF0000) == SDL_WINDOWPOS_UNDEFINED_MASK)
  122. /**
  123. * \brief Used to indicate that the window position should be centered.
  124. */
  125. #define SDL_WINDOWPOS_CENTERED_MASK 0x2FFF0000u
  126. #define SDL_WINDOWPOS_CENTERED_DISPLAY(X) (SDL_WINDOWPOS_CENTERED_MASK|(X))
  127. #define SDL_WINDOWPOS_CENTERED SDL_WINDOWPOS_CENTERED_DISPLAY(0)
  128. #define SDL_WINDOWPOS_ISCENTERED(X) \
  129. (((X)&0xFFFF0000) == SDL_WINDOWPOS_CENTERED_MASK)
  130. /**
  131. * \brief Event subtype for window events
  132. */
  133. typedef enum
  134. {
  135. SDL_WINDOWEVENT_NONE, /**< Never used */
  136. SDL_WINDOWEVENT_SHOWN, /**< Window has been shown */
  137. SDL_WINDOWEVENT_HIDDEN, /**< Window has been hidden */
  138. SDL_WINDOWEVENT_EXPOSED, /**< Window has been exposed and should be
  139. redrawn */
  140. SDL_WINDOWEVENT_MOVED, /**< Window has been moved to data1, data2
  141. */
  142. SDL_WINDOWEVENT_RESIZED, /**< Window has been resized to data1xdata2 */
  143. SDL_WINDOWEVENT_SIZE_CHANGED, /**< The window size has changed, either as
  144. a result of an API call or through the
  145. system or user changing the window size. */
  146. SDL_WINDOWEVENT_MINIMIZED, /**< Window has been minimized */
  147. SDL_WINDOWEVENT_MAXIMIZED, /**< Window has been maximized */
  148. SDL_WINDOWEVENT_RESTORED, /**< Window has been restored to normal size
  149. and position */
  150. SDL_WINDOWEVENT_ENTER, /**< Window has gained mouse focus */
  151. SDL_WINDOWEVENT_LEAVE, /**< Window has lost mouse focus */
  152. SDL_WINDOWEVENT_FOCUS_GAINED, /**< Window has gained keyboard focus */
  153. SDL_WINDOWEVENT_FOCUS_LOST, /**< Window has lost keyboard focus */
  154. SDL_WINDOWEVENT_CLOSE, /**< The window manager requests that the window be closed */
  155. SDL_WINDOWEVENT_TAKE_FOCUS, /**< Window is being offered a focus (should SetWindowInputFocus() on itself or a subwindow, or ignore) */
  156. SDL_WINDOWEVENT_HIT_TEST /**< Window had a hit test that wasn't SDL_HITTEST_NORMAL. */
  157. } SDL_WindowEventID;
  158. /**
  159. * \brief Event subtype for display events
  160. */
  161. typedef enum
  162. {
  163. SDL_DISPLAYEVENT_NONE, /**< Never used */
  164. SDL_DISPLAYEVENT_ORIENTATION /**< Display orientation has changed to data1 */
  165. } SDL_DisplayEventID;
  166. typedef enum
  167. {
  168. SDL_ORIENTATION_UNKNOWN, /**< The display orientation can't be determined */
  169. SDL_ORIENTATION_LANDSCAPE, /**< The display is in landscape mode, with the right side up, relative to portrait mode */
  170. SDL_ORIENTATION_LANDSCAPE_FLIPPED, /**< The display is in landscape mode, with the left side up, relative to portrait mode */
  171. SDL_ORIENTATION_PORTRAIT, /**< The display is in portrait mode */
  172. SDL_ORIENTATION_PORTRAIT_FLIPPED /**< The display is in portrait mode, upside down */
  173. } SDL_DisplayOrientation;
  174. /**
  175. * \brief An opaque handle to an OpenGL context.
  176. */
  177. typedef void *SDL_GLContext;
  178. /**
  179. * \brief OpenGL configuration attributes
  180. */
  181. typedef enum
  182. {
  183. SDL_GL_RED_SIZE,
  184. SDL_GL_GREEN_SIZE,
  185. SDL_GL_BLUE_SIZE,
  186. SDL_GL_ALPHA_SIZE,
  187. SDL_GL_BUFFER_SIZE,
  188. SDL_GL_DOUBLEBUFFER,
  189. SDL_GL_DEPTH_SIZE,
  190. SDL_GL_STENCIL_SIZE,
  191. SDL_GL_ACCUM_RED_SIZE,
  192. SDL_GL_ACCUM_GREEN_SIZE,
  193. SDL_GL_ACCUM_BLUE_SIZE,
  194. SDL_GL_ACCUM_ALPHA_SIZE,
  195. SDL_GL_STEREO,
  196. SDL_GL_MULTISAMPLEBUFFERS,
  197. SDL_GL_MULTISAMPLESAMPLES,
  198. SDL_GL_ACCELERATED_VISUAL,
  199. SDL_GL_RETAINED_BACKING,
  200. SDL_GL_CONTEXT_MAJOR_VERSION,
  201. SDL_GL_CONTEXT_MINOR_VERSION,
  202. SDL_GL_CONTEXT_EGL,
  203. SDL_GL_CONTEXT_FLAGS,
  204. SDL_GL_CONTEXT_PROFILE_MASK,
  205. SDL_GL_SHARE_WITH_CURRENT_CONTEXT,
  206. SDL_GL_FRAMEBUFFER_SRGB_CAPABLE,
  207. SDL_GL_CONTEXT_RELEASE_BEHAVIOR,
  208. SDL_GL_CONTEXT_RESET_NOTIFICATION,
  209. SDL_GL_CONTEXT_NO_ERROR
  210. } SDL_GLattr;
  211. typedef enum
  212. {
  213. SDL_GL_CONTEXT_PROFILE_CORE = 0x0001,
  214. SDL_GL_CONTEXT_PROFILE_COMPATIBILITY = 0x0002,
  215. SDL_GL_CONTEXT_PROFILE_ES = 0x0004 /**< GLX_CONTEXT_ES2_PROFILE_BIT_EXT */
  216. } SDL_GLprofile;
  217. typedef enum
  218. {
  219. SDL_GL_CONTEXT_DEBUG_FLAG = 0x0001,
  220. SDL_GL_CONTEXT_FORWARD_COMPATIBLE_FLAG = 0x0002,
  221. SDL_GL_CONTEXT_ROBUST_ACCESS_FLAG = 0x0004,
  222. SDL_GL_CONTEXT_RESET_ISOLATION_FLAG = 0x0008
  223. } SDL_GLcontextFlag;
  224. typedef enum
  225. {
  226. SDL_GL_CONTEXT_RELEASE_BEHAVIOR_NONE = 0x0000,
  227. SDL_GL_CONTEXT_RELEASE_BEHAVIOR_FLUSH = 0x0001
  228. } SDL_GLcontextReleaseFlag;
  229. typedef enum
  230. {
  231. SDL_GL_CONTEXT_RESET_NO_NOTIFICATION = 0x0000,
  232. SDL_GL_CONTEXT_RESET_LOSE_CONTEXT = 0x0001
  233. } SDL_GLContextResetNotification;
  234. /* Function prototypes */
  235. /**
  236. * \brief Get the number of video drivers compiled into SDL
  237. *
  238. * \sa SDL_GetVideoDriver()
  239. */
  240. extern DECLSPEC int SDLCALL SDL_GetNumVideoDrivers(void);
  241. /**
  242. * \brief Get the name of a built in video driver.
  243. *
  244. * \note The video drivers are presented in the order in which they are
  245. * normally checked during initialization.
  246. *
  247. * \sa SDL_GetNumVideoDrivers()
  248. */
  249. extern DECLSPEC const char *SDLCALL SDL_GetVideoDriver(int index);
  250. /**
  251. * \brief Initialize the video subsystem, optionally specifying a video driver.
  252. *
  253. * \param driver_name Initialize a specific driver by name, or NULL for the
  254. * default video driver.
  255. *
  256. * \return 0 on success, -1 on error
  257. *
  258. * This function initializes the video subsystem; setting up a connection
  259. * to the window manager, etc, and determines the available display modes
  260. * and pixel formats, but does not initialize a window or graphics mode.
  261. *
  262. * \sa SDL_VideoQuit()
  263. */
  264. extern DECLSPEC int SDLCALL SDL_VideoInit(const char *driver_name);
  265. /**
  266. * \brief Shuts down the video subsystem.
  267. *
  268. * This function closes all windows, and restores the original video mode.
  269. *
  270. * \sa SDL_VideoInit()
  271. */
  272. extern DECLSPEC void SDLCALL SDL_VideoQuit(void);
  273. /**
  274. * \brief Returns the name of the currently initialized video driver.
  275. *
  276. * \return The name of the current video driver or NULL if no driver
  277. * has been initialized
  278. *
  279. * \sa SDL_GetNumVideoDrivers()
  280. * \sa SDL_GetVideoDriver()
  281. */
  282. extern DECLSPEC const char *SDLCALL SDL_GetCurrentVideoDriver(void);
  283. /**
  284. * \brief Returns the number of available video displays.
  285. *
  286. * \sa SDL_GetDisplayBounds()
  287. */
  288. extern DECLSPEC int SDLCALL SDL_GetNumVideoDisplays(void);
  289. /**
  290. * \brief Get the name of a display in UTF-8 encoding
  291. *
  292. * \return The name of a display, or NULL for an invalid display index.
  293. *
  294. * \sa SDL_GetNumVideoDisplays()
  295. */
  296. extern DECLSPEC const char * SDLCALL SDL_GetDisplayName(int displayIndex);
  297. /**
  298. * \brief Get the desktop area represented by a display, with the primary
  299. * display located at 0,0
  300. *
  301. * \return 0 on success, or -1 if the index is out of range.
  302. *
  303. * \sa SDL_GetNumVideoDisplays()
  304. */
  305. extern DECLSPEC int SDLCALL SDL_GetDisplayBounds(int displayIndex, SDL_Rect * rect);
  306. /**
  307. * \brief Get the usable desktop area represented by a display, with the
  308. * primary display located at 0,0
  309. *
  310. * This is the same area as SDL_GetDisplayBounds() reports, but with portions
  311. * reserved by the system removed. For example, on Mac OS X, this subtracts
  312. * the area occupied by the menu bar and dock.
  313. *
  314. * Setting a window to be fullscreen generally bypasses these unusable areas,
  315. * so these are good guidelines for the maximum space available to a
  316. * non-fullscreen window.
  317. *
  318. * \return 0 on success, or -1 if the index is out of range.
  319. *
  320. * \sa SDL_GetDisplayBounds()
  321. * \sa SDL_GetNumVideoDisplays()
  322. */
  323. extern DECLSPEC int SDLCALL SDL_GetDisplayUsableBounds(int displayIndex, SDL_Rect * rect);
  324. /**
  325. * \brief Get the dots/pixels-per-inch for a display
  326. *
  327. * \note Diagonal, horizontal and vertical DPI can all be optionally
  328. * returned if the parameter is non-NULL.
  329. *
  330. * \return 0 on success, or -1 if no DPI information is available or the index is out of range.
  331. *
  332. * \sa SDL_GetNumVideoDisplays()
  333. */
  334. extern DECLSPEC int SDLCALL SDL_GetDisplayDPI(int displayIndex, float * ddpi, float * hdpi, float * vdpi);
  335. /**
  336. * \brief Get the orientation of a display
  337. *
  338. * \return The orientation of the display, or SDL_ORIENTATION_UNKNOWN if it isn't available.
  339. *
  340. * \sa SDL_GetNumVideoDisplays()
  341. */
  342. extern DECLSPEC SDL_DisplayOrientation SDLCALL SDL_GetDisplayOrientation(int displayIndex);
  343. /**
  344. * \brief Returns the number of available display modes.
  345. *
  346. * \sa SDL_GetDisplayMode()
  347. */
  348. extern DECLSPEC int SDLCALL SDL_GetNumDisplayModes(int displayIndex);
  349. /**
  350. * \brief Fill in information about a specific display mode.
  351. *
  352. * \note The display modes are sorted in this priority:
  353. * \li bits per pixel -> more colors to fewer colors
  354. * \li width -> largest to smallest
  355. * \li height -> largest to smallest
  356. * \li refresh rate -> highest to lowest
  357. *
  358. * \sa SDL_GetNumDisplayModes()
  359. */
  360. extern DECLSPEC int SDLCALL SDL_GetDisplayMode(int displayIndex, int modeIndex,
  361. SDL_DisplayMode * mode);
  362. /**
  363. * \brief Fill in information about the desktop display mode.
  364. */
  365. extern DECLSPEC int SDLCALL SDL_GetDesktopDisplayMode(int displayIndex, SDL_DisplayMode * mode);
  366. /**
  367. * \brief Fill in information about the current display mode.
  368. */
  369. extern DECLSPEC int SDLCALL SDL_GetCurrentDisplayMode(int displayIndex, SDL_DisplayMode * mode);
  370. /**
  371. * \brief Get the closest match to the requested display mode.
  372. *
  373. * \param displayIndex The index of display from which mode should be queried.
  374. * \param mode The desired display mode
  375. * \param closest A pointer to a display mode to be filled in with the closest
  376. * match of the available display modes.
  377. *
  378. * \return The passed in value \c closest, or NULL if no matching video mode
  379. * was available.
  380. *
  381. * The available display modes are scanned, and \c closest is filled in with the
  382. * closest mode matching the requested mode and returned. The mode format and
  383. * refresh_rate default to the desktop mode if they are 0. The modes are
  384. * scanned with size being first priority, format being second priority, and
  385. * finally checking the refresh_rate. If all the available modes are too
  386. * small, then NULL is returned.
  387. *
  388. * \sa SDL_GetNumDisplayModes()
  389. * \sa SDL_GetDisplayMode()
  390. */
  391. extern DECLSPEC SDL_DisplayMode * SDLCALL SDL_GetClosestDisplayMode(int displayIndex, const SDL_DisplayMode * mode, SDL_DisplayMode * closest);
  392. /**
  393. * \brief Get the display index associated with a window.
  394. *
  395. * \return the display index of the display containing the center of the
  396. * window, or -1 on error.
  397. */
  398. extern DECLSPEC int SDLCALL SDL_GetWindowDisplayIndex(SDL_Window * window);
  399. /**
  400. * \brief Set the display mode used when a fullscreen window is visible.
  401. *
  402. * By default the window's dimensions and the desktop format and refresh rate
  403. * are used.
  404. *
  405. * \param window The window for which the display mode should be set.
  406. * \param mode The mode to use, or NULL for the default mode.
  407. *
  408. * \return 0 on success, or -1 if setting the display mode failed.
  409. *
  410. * \sa SDL_GetWindowDisplayMode()
  411. * \sa SDL_SetWindowFullscreen()
  412. */
  413. extern DECLSPEC int SDLCALL SDL_SetWindowDisplayMode(SDL_Window * window,
  414. const SDL_DisplayMode
  415. * mode);
  416. /**
  417. * \brief Fill in information about the display mode used when a fullscreen
  418. * window is visible.
  419. *
  420. * \sa SDL_SetWindowDisplayMode()
  421. * \sa SDL_SetWindowFullscreen()
  422. */
  423. extern DECLSPEC int SDLCALL SDL_GetWindowDisplayMode(SDL_Window * window,
  424. SDL_DisplayMode * mode);
  425. /**
  426. * \brief Get the pixel format associated with the window.
  427. */
  428. extern DECLSPEC Uint32 SDLCALL SDL_GetWindowPixelFormat(SDL_Window * window);
  429. /**
  430. * \brief Create a window with the specified position, dimensions, and flags.
  431. *
  432. * \param title The title of the window, in UTF-8 encoding.
  433. * \param x The x position of the window, ::SDL_WINDOWPOS_CENTERED, or
  434. * ::SDL_WINDOWPOS_UNDEFINED.
  435. * \param y The y position of the window, ::SDL_WINDOWPOS_CENTERED, or
  436. * ::SDL_WINDOWPOS_UNDEFINED.
  437. * \param w The width of the window, in screen coordinates.
  438. * \param h The height of the window, in screen coordinates.
  439. * \param flags The flags for the window, a mask of any of the following:
  440. * ::SDL_WINDOW_FULLSCREEN, ::SDL_WINDOW_OPENGL,
  441. * ::SDL_WINDOW_HIDDEN, ::SDL_WINDOW_BORDERLESS,
  442. * ::SDL_WINDOW_RESIZABLE, ::SDL_WINDOW_MAXIMIZED,
  443. * ::SDL_WINDOW_MINIMIZED, ::SDL_WINDOW_INPUT_GRABBED,
  444. * ::SDL_WINDOW_ALLOW_HIGHDPI, ::SDL_WINDOW_VULKAN.
  445. *
  446. * \return The created window, or NULL if window creation failed.
  447. *
  448. * If the window is created with the SDL_WINDOW_ALLOW_HIGHDPI flag, its size
  449. * in pixels may differ from its size in screen coordinates on platforms with
  450. * high-DPI support (e.g. iOS and Mac OS X). Use SDL_GetWindowSize() to query
  451. * the client area's size in screen coordinates, and SDL_GL_GetDrawableSize(),
  452. * SDL_Vulkan_GetDrawableSize(), or SDL_GetRendererOutputSize() to query the
  453. * drawable size in pixels.
  454. *
  455. * If the window is created with any of the SDL_WINDOW_OPENGL or
  456. * SDL_WINDOW_VULKAN flags, then the corresponding LoadLibrary function
  457. * (SDL_GL_LoadLibrary or SDL_Vulkan_LoadLibrary) is called and the
  458. * corresponding UnloadLibrary function is called by SDL_DestroyWindow().
  459. *
  460. * If SDL_WINDOW_VULKAN is specified and there isn't a working Vulkan driver,
  461. * SDL_CreateWindow() will fail because SDL_Vulkan_LoadLibrary() will fail.
  462. *
  463. * \note On non-Apple devices, SDL requires you to either not link to the
  464. * Vulkan loader or link to a dynamic library version. This limitation
  465. * may be removed in a future version of SDL.
  466. *
  467. * \sa SDL_DestroyWindow()
  468. * \sa SDL_GL_LoadLibrary()
  469. * \sa SDL_Vulkan_LoadLibrary()
  470. */
  471. extern DECLSPEC SDL_Window * SDLCALL SDL_CreateWindow(const char *title,
  472. int x, int y, int w,
  473. int h, Uint32 flags);
  474. /**
  475. * \brief Create an SDL window from an existing native window.
  476. *
  477. * \param data A pointer to driver-dependent window creation data
  478. *
  479. * \return The created window, or NULL if window creation failed.
  480. *
  481. * \sa SDL_DestroyWindow()
  482. */
  483. extern DECLSPEC SDL_Window * SDLCALL SDL_CreateWindowFrom(const void *data);
  484. /**
  485. * \brief Get the numeric ID of a window, for logging purposes.
  486. */
  487. extern DECLSPEC Uint32 SDLCALL SDL_GetWindowID(SDL_Window * window);
  488. /**
  489. * \brief Get a window from a stored ID, or NULL if it doesn't exist.
  490. */
  491. extern DECLSPEC SDL_Window * SDLCALL SDL_GetWindowFromID(Uint32 id);
  492. /**
  493. * \brief Get the window flags.
  494. */
  495. extern DECLSPEC Uint32 SDLCALL SDL_GetWindowFlags(SDL_Window * window);
  496. /**
  497. * \brief Set the title of a window, in UTF-8 format.
  498. *
  499. * \sa SDL_GetWindowTitle()
  500. */
  501. extern DECLSPEC void SDLCALL SDL_SetWindowTitle(SDL_Window * window,
  502. const char *title);
  503. /**
  504. * \brief Get the title of a window, in UTF-8 format.
  505. *
  506. * \sa SDL_SetWindowTitle()
  507. */
  508. extern DECLSPEC const char *SDLCALL SDL_GetWindowTitle(SDL_Window * window);
  509. /**
  510. * \brief Set the icon for a window.
  511. *
  512. * \param window The window for which the icon should be set.
  513. * \param icon The icon for the window.
  514. */
  515. extern DECLSPEC void SDLCALL SDL_SetWindowIcon(SDL_Window * window,
  516. SDL_Surface * icon);
  517. /**
  518. * \brief Associate an arbitrary named pointer with a window.
  519. *
  520. * \param window The window to associate with the pointer.
  521. * \param name The name of the pointer.
  522. * \param userdata The associated pointer.
  523. *
  524. * \return The previous value associated with 'name'
  525. *
  526. * \note The name is case-sensitive.
  527. *
  528. * \sa SDL_GetWindowData()
  529. */
  530. extern DECLSPEC void* SDLCALL SDL_SetWindowData(SDL_Window * window,
  531. const char *name,
  532. void *userdata);
  533. /**
  534. * \brief Retrieve the data pointer associated with a window.
  535. *
  536. * \param window The window to query.
  537. * \param name The name of the pointer.
  538. *
  539. * \return The value associated with 'name'
  540. *
  541. * \sa SDL_SetWindowData()
  542. */
  543. extern DECLSPEC void *SDLCALL SDL_GetWindowData(SDL_Window * window,
  544. const char *name);
  545. /**
  546. * \brief Set the position of a window.
  547. *
  548. * \param window The window to reposition.
  549. * \param x The x coordinate of the window in screen coordinates, or
  550. * ::SDL_WINDOWPOS_CENTERED or ::SDL_WINDOWPOS_UNDEFINED.
  551. * \param y The y coordinate of the window in screen coordinates, or
  552. * ::SDL_WINDOWPOS_CENTERED or ::SDL_WINDOWPOS_UNDEFINED.
  553. *
  554. * \note The window coordinate origin is the upper left of the display.
  555. *
  556. * \sa SDL_GetWindowPosition()
  557. */
  558. extern DECLSPEC void SDLCALL SDL_SetWindowPosition(SDL_Window * window,
  559. int x, int y);
  560. /**
  561. * \brief Get the position of a window.
  562. *
  563. * \param window The window to query.
  564. * \param x Pointer to variable for storing the x position, in screen
  565. * coordinates. May be NULL.
  566. * \param y Pointer to variable for storing the y position, in screen
  567. * coordinates. May be NULL.
  568. *
  569. * \sa SDL_SetWindowPosition()
  570. */
  571. extern DECLSPEC void SDLCALL SDL_GetWindowPosition(SDL_Window * window,
  572. int *x, int *y);
  573. /**
  574. * \brief Set the size of a window's client area.
  575. *
  576. * \param window The window to resize.
  577. * \param w The width of the window, in screen coordinates. Must be >0.
  578. * \param h The height of the window, in screen coordinates. Must be >0.
  579. *
  580. * \note Fullscreen windows automatically match the size of the display mode,
  581. * and you should use SDL_SetWindowDisplayMode() to change their size.
  582. *
  583. * The window size in screen coordinates may differ from the size in pixels, if
  584. * the window was created with SDL_WINDOW_ALLOW_HIGHDPI on a platform with
  585. * high-dpi support (e.g. iOS or OS X). Use SDL_GL_GetDrawableSize() or
  586. * SDL_GetRendererOutputSize() to get the real client area size in pixels.
  587. *
  588. * \sa SDL_GetWindowSize()
  589. * \sa SDL_SetWindowDisplayMode()
  590. */
  591. extern DECLSPEC void SDLCALL SDL_SetWindowSize(SDL_Window * window, int w,
  592. int h);
  593. /**
  594. * \brief Get the size of a window's client area.
  595. *
  596. * \param window The window to query.
  597. * \param w Pointer to variable for storing the width, in screen
  598. * coordinates. May be NULL.
  599. * \param h Pointer to variable for storing the height, in screen
  600. * coordinates. May be NULL.
  601. *
  602. * The window size in screen coordinates may differ from the size in pixels, if
  603. * the window was created with SDL_WINDOW_ALLOW_HIGHDPI on a platform with
  604. * high-dpi support (e.g. iOS or OS X). Use SDL_GL_GetDrawableSize() or
  605. * SDL_GetRendererOutputSize() to get the real client area size in pixels.
  606. *
  607. * \sa SDL_SetWindowSize()
  608. */
  609. extern DECLSPEC void SDLCALL SDL_GetWindowSize(SDL_Window * window, int *w,
  610. int *h);
  611. /**
  612. * \brief Get the size of a window's borders (decorations) around the client area.
  613. *
  614. * \param window The window to query.
  615. * \param top Pointer to variable for storing the size of the top border. NULL is permitted.
  616. * \param left Pointer to variable for storing the size of the left border. NULL is permitted.
  617. * \param bottom Pointer to variable for storing the size of the bottom border. NULL is permitted.
  618. * \param right Pointer to variable for storing the size of the right border. NULL is permitted.
  619. *
  620. * \return 0 on success, or -1 if getting this information is not supported.
  621. *
  622. * \note if this function fails (returns -1), the size values will be
  623. * initialized to 0, 0, 0, 0 (if a non-NULL pointer is provided), as
  624. * if the window in question was borderless.
  625. */
  626. extern DECLSPEC int SDLCALL SDL_GetWindowBordersSize(SDL_Window * window,
  627. int *top, int *left,
  628. int *bottom, int *right);
  629. /**
  630. * \brief Set the minimum size of a window's client area.
  631. *
  632. * \param window The window to set a new minimum size.
  633. * \param min_w The minimum width of the window, must be >0
  634. * \param min_h The minimum height of the window, must be >0
  635. *
  636. * \note You can't change the minimum size of a fullscreen window, it
  637. * automatically matches the size of the display mode.
  638. *
  639. * \sa SDL_GetWindowMinimumSize()
  640. * \sa SDL_SetWindowMaximumSize()
  641. */
  642. extern DECLSPEC void SDLCALL SDL_SetWindowMinimumSize(SDL_Window * window,
  643. int min_w, int min_h);
  644. /**
  645. * \brief Get the minimum size of a window's client area.
  646. *
  647. * \param window The window to query.
  648. * \param w Pointer to variable for storing the minimum width, may be NULL
  649. * \param h Pointer to variable for storing the minimum height, may be NULL
  650. *
  651. * \sa SDL_GetWindowMaximumSize()
  652. * \sa SDL_SetWindowMinimumSize()
  653. */
  654. extern DECLSPEC void SDLCALL SDL_GetWindowMinimumSize(SDL_Window * window,
  655. int *w, int *h);
  656. /**
  657. * \brief Set the maximum size of a window's client area.
  658. *
  659. * \param window The window to set a new maximum size.
  660. * \param max_w The maximum width of the window, must be >0
  661. * \param max_h The maximum height of the window, must be >0
  662. *
  663. * \note You can't change the maximum size of a fullscreen window, it
  664. * automatically matches the size of the display mode.
  665. *
  666. * \sa SDL_GetWindowMaximumSize()
  667. * \sa SDL_SetWindowMinimumSize()
  668. */
  669. extern DECLSPEC void SDLCALL SDL_SetWindowMaximumSize(SDL_Window * window,
  670. int max_w, int max_h);
  671. /**
  672. * \brief Get the maximum size of a window's client area.
  673. *
  674. * \param window The window to query.
  675. * \param w Pointer to variable for storing the maximum width, may be NULL
  676. * \param h Pointer to variable for storing the maximum height, may be NULL
  677. *
  678. * \sa SDL_GetWindowMinimumSize()
  679. * \sa SDL_SetWindowMaximumSize()
  680. */
  681. extern DECLSPEC void SDLCALL SDL_GetWindowMaximumSize(SDL_Window * window,
  682. int *w, int *h);
  683. /**
  684. * \brief Set the border state of a window.
  685. *
  686. * This will add or remove the window's SDL_WINDOW_BORDERLESS flag and
  687. * add or remove the border from the actual window. This is a no-op if the
  688. * window's border already matches the requested state.
  689. *
  690. * \param window The window of which to change the border state.
  691. * \param bordered SDL_FALSE to remove border, SDL_TRUE to add border.
  692. *
  693. * \note You can't change the border state of a fullscreen window.
  694. *
  695. * \sa SDL_GetWindowFlags()
  696. */
  697. extern DECLSPEC void SDLCALL SDL_SetWindowBordered(SDL_Window * window,
  698. SDL_bool bordered);
  699. /**
  700. * \brief Set the user-resizable state of a window.
  701. *
  702. * This will add or remove the window's SDL_WINDOW_RESIZABLE flag and
  703. * allow/disallow user resizing of the window. This is a no-op if the
  704. * window's resizable state already matches the requested state.
  705. *
  706. * \param window The window of which to change the resizable state.
  707. * \param resizable SDL_TRUE to allow resizing, SDL_FALSE to disallow.
  708. *
  709. * \note You can't change the resizable state of a fullscreen window.
  710. *
  711. * \sa SDL_GetWindowFlags()
  712. */
  713. extern DECLSPEC void SDLCALL SDL_SetWindowResizable(SDL_Window * window,
  714. SDL_bool resizable);
  715. /**
  716. * \brief Show a window.
  717. *
  718. * \sa SDL_HideWindow()
  719. */
  720. extern DECLSPEC void SDLCALL SDL_ShowWindow(SDL_Window * window);
  721. /**
  722. * \brief Hide a window.
  723. *
  724. * \sa SDL_ShowWindow()
  725. */
  726. extern DECLSPEC void SDLCALL SDL_HideWindow(SDL_Window * window);
  727. /**
  728. * \brief Raise a window above other windows and set the input focus.
  729. */
  730. extern DECLSPEC void SDLCALL SDL_RaiseWindow(SDL_Window * window);
  731. /**
  732. * \brief Make a window as large as possible.
  733. *
  734. * \sa SDL_RestoreWindow()
  735. */
  736. extern DECLSPEC void SDLCALL SDL_MaximizeWindow(SDL_Window * window);
  737. /**
  738. * \brief Minimize a window to an iconic representation.
  739. *
  740. * \sa SDL_RestoreWindow()
  741. */
  742. extern DECLSPEC void SDLCALL SDL_MinimizeWindow(SDL_Window * window);
  743. /**
  744. * \brief Restore the size and position of a minimized or maximized window.
  745. *
  746. * \sa SDL_MaximizeWindow()
  747. * \sa SDL_MinimizeWindow()
  748. */
  749. extern DECLSPEC void SDLCALL SDL_RestoreWindow(SDL_Window * window);
  750. /**
  751. * \brief Set a window's fullscreen state.
  752. *
  753. * \return 0 on success, or -1 if setting the display mode failed.
  754. *
  755. * \sa SDL_SetWindowDisplayMode()
  756. * \sa SDL_GetWindowDisplayMode()
  757. */
  758. extern DECLSPEC int SDLCALL SDL_SetWindowFullscreen(SDL_Window * window,
  759. Uint32 flags);
  760. /**
  761. * \brief Get the SDL surface associated with the window.
  762. *
  763. * \return The window's framebuffer surface, or NULL on error.
  764. *
  765. * A new surface will be created with the optimal format for the window,
  766. * if necessary. This surface will be freed when the window is destroyed.
  767. *
  768. * \note You may not combine this with 3D or the rendering API on this window.
  769. *
  770. * \sa SDL_UpdateWindowSurface()
  771. * \sa SDL_UpdateWindowSurfaceRects()
  772. */
  773. extern DECLSPEC SDL_Surface * SDLCALL SDL_GetWindowSurface(SDL_Window * window);
  774. /**
  775. * \brief Copy the window surface to the screen.
  776. *
  777. * \return 0 on success, or -1 on error.
  778. *
  779. * \sa SDL_GetWindowSurface()
  780. * \sa SDL_UpdateWindowSurfaceRects()
  781. */
  782. extern DECLSPEC int SDLCALL SDL_UpdateWindowSurface(SDL_Window * window);
  783. /**
  784. * \brief Copy a number of rectangles on the window surface to the screen.
  785. *
  786. * \return 0 on success, or -1 on error.
  787. *
  788. * \sa SDL_GetWindowSurface()
  789. * \sa SDL_UpdateWindowSurface()
  790. */
  791. extern DECLSPEC int SDLCALL SDL_UpdateWindowSurfaceRects(SDL_Window * window,
  792. const SDL_Rect * rects,
  793. int numrects);
  794. /**
  795. * \brief Set a window's input grab mode.
  796. *
  797. * \param window The window for which the input grab mode should be set.
  798. * \param grabbed This is SDL_TRUE to grab input, and SDL_FALSE to release input.
  799. *
  800. * If the caller enables a grab while another window is currently grabbed,
  801. * the other window loses its grab in favor of the caller's window.
  802. *
  803. * \sa SDL_GetWindowGrab()
  804. */
  805. extern DECLSPEC void SDLCALL SDL_SetWindowGrab(SDL_Window * window,
  806. SDL_bool grabbed);
  807. /**
  808. * \brief Get a window's input grab mode.
  809. *
  810. * \return This returns SDL_TRUE if input is grabbed, and SDL_FALSE otherwise.
  811. *
  812. * \sa SDL_SetWindowGrab()
  813. */
  814. extern DECLSPEC SDL_bool SDLCALL SDL_GetWindowGrab(SDL_Window * window);
  815. /**
  816. * \brief Get the window that currently has an input grab enabled.
  817. *
  818. * \return This returns the window if input is grabbed, and NULL otherwise.
  819. *
  820. * \sa SDL_SetWindowGrab()
  821. */
  822. extern DECLSPEC SDL_Window * SDLCALL SDL_GetGrabbedWindow(void);
  823. /**
  824. * \brief Set the brightness (gamma correction) for a window.
  825. *
  826. * \return 0 on success, or -1 if setting the brightness isn't supported.
  827. *
  828. * \sa SDL_GetWindowBrightness()
  829. * \sa SDL_SetWindowGammaRamp()
  830. */
  831. extern DECLSPEC int SDLCALL SDL_SetWindowBrightness(SDL_Window * window, float brightness);
  832. /**
  833. * \brief Get the brightness (gamma correction) for a window.
  834. *
  835. * \return The last brightness value passed to SDL_SetWindowBrightness()
  836. *
  837. * \sa SDL_SetWindowBrightness()
  838. */
  839. extern DECLSPEC float SDLCALL SDL_GetWindowBrightness(SDL_Window * window);
  840. /**
  841. * \brief Set the opacity for a window
  842. *
  843. * \param window The window which will be made transparent or opaque
  844. * \param opacity Opacity (0.0f - transparent, 1.0f - opaque) This will be
  845. * clamped internally between 0.0f and 1.0f.
  846. *
  847. * \return 0 on success, or -1 if setting the opacity isn't supported.
  848. *
  849. * \sa SDL_GetWindowOpacity()
  850. */
  851. extern DECLSPEC int SDLCALL SDL_SetWindowOpacity(SDL_Window * window, float opacity);
  852. /**
  853. * \brief Get the opacity of a window.
  854. *
  855. * If transparency isn't supported on this platform, opacity will be reported
  856. * as 1.0f without error.
  857. *
  858. * \param window The window in question.
  859. * \param out_opacity Opacity (0.0f - transparent, 1.0f - opaque)
  860. *
  861. * \return 0 on success, or -1 on error (invalid window, etc).
  862. *
  863. * \sa SDL_SetWindowOpacity()
  864. */
  865. extern DECLSPEC int SDLCALL SDL_GetWindowOpacity(SDL_Window * window, float * out_opacity);
  866. /**
  867. * \brief Sets the window as a modal for another window (TODO: reconsider this function and/or its name)
  868. *
  869. * \param modal_window The window that should be modal
  870. * \param parent_window The parent window
  871. *
  872. * \return 0 on success, or -1 otherwise.
  873. */
  874. extern DECLSPEC int SDLCALL SDL_SetWindowModalFor(SDL_Window * modal_window, SDL_Window * parent_window);
  875. /**
  876. * \brief Explicitly sets input focus to the window.
  877. *
  878. * You almost certainly want SDL_RaiseWindow() instead of this function. Use
  879. * this with caution, as you might give focus to a window that's completely
  880. * obscured by other windows.
  881. *
  882. * \param window The window that should get the input focus
  883. *
  884. * \return 0 on success, or -1 otherwise.
  885. * \sa SDL_RaiseWindow()
  886. */
  887. extern DECLSPEC int SDLCALL SDL_SetWindowInputFocus(SDL_Window * window);
  888. /**
  889. * \brief Set the gamma ramp for a window.
  890. *
  891. * \param window The window for which the gamma ramp should be set.
  892. * \param red The translation table for the red channel, or NULL.
  893. * \param green The translation table for the green channel, or NULL.
  894. * \param blue The translation table for the blue channel, or NULL.
  895. *
  896. * \return 0 on success, or -1 if gamma ramps are unsupported.
  897. *
  898. * Set the gamma translation table for the red, green, and blue channels
  899. * of the video hardware. Each table is an array of 256 16-bit quantities,
  900. * representing a mapping between the input and output for that channel.
  901. * The input is the index into the array, and the output is the 16-bit
  902. * gamma value at that index, scaled to the output color precision.
  903. *
  904. * \sa SDL_GetWindowGammaRamp()
  905. */
  906. extern DECLSPEC int SDLCALL SDL_SetWindowGammaRamp(SDL_Window * window,
  907. const Uint16 * red,
  908. const Uint16 * green,
  909. const Uint16 * blue);
  910. /**
  911. * \brief Get the gamma ramp for a window.
  912. *
  913. * \param window The window from which the gamma ramp should be queried.
  914. * \param red A pointer to a 256 element array of 16-bit quantities to hold
  915. * the translation table for the red channel, or NULL.
  916. * \param green A pointer to a 256 element array of 16-bit quantities to hold
  917. * the translation table for the green channel, or NULL.
  918. * \param blue A pointer to a 256 element array of 16-bit quantities to hold
  919. * the translation table for the blue channel, or NULL.
  920. *
  921. * \return 0 on success, or -1 if gamma ramps are unsupported.
  922. *
  923. * \sa SDL_SetWindowGammaRamp()
  924. */
  925. extern DECLSPEC int SDLCALL SDL_GetWindowGammaRamp(SDL_Window * window,
  926. Uint16 * red,
  927. Uint16 * green,
  928. Uint16 * blue);
  929. /**
  930. * \brief Possible return values from the SDL_HitTest callback.
  931. *
  932. * \sa SDL_HitTest
  933. */
  934. typedef enum
  935. {
  936. SDL_HITTEST_NORMAL, /**< Region is normal. No special properties. */
  937. SDL_HITTEST_DRAGGABLE, /**< Region can drag entire window. */
  938. SDL_HITTEST_RESIZE_TOPLEFT,
  939. SDL_HITTEST_RESIZE_TOP,
  940. SDL_HITTEST_RESIZE_TOPRIGHT,
  941. SDL_HITTEST_RESIZE_RIGHT,
  942. SDL_HITTEST_RESIZE_BOTTOMRIGHT,
  943. SDL_HITTEST_RESIZE_BOTTOM,
  944. SDL_HITTEST_RESIZE_BOTTOMLEFT,
  945. SDL_HITTEST_RESIZE_LEFT
  946. } SDL_HitTestResult;
  947. /**
  948. * \brief Callback used for hit-testing.
  949. *
  950. * \sa SDL_SetWindowHitTest
  951. */
  952. typedef SDL_HitTestResult (SDLCALL *SDL_HitTest)(SDL_Window *win,
  953. const SDL_Point *area,
  954. void *data);
  955. /**
  956. * \brief Provide a callback that decides if a window region has special properties.
  957. *
  958. * Normally windows are dragged and resized by decorations provided by the
  959. * system window manager (a title bar, borders, etc), but for some apps, it
  960. * makes sense to drag them from somewhere else inside the window itself; for
  961. * example, one might have a borderless window that wants to be draggable
  962. * from any part, or simulate its own title bar, etc.
  963. *
  964. * This function lets the app provide a callback that designates pieces of
  965. * a given window as special. This callback is run during event processing
  966. * if we need to tell the OS to treat a region of the window specially; the
  967. * use of this callback is known as "hit testing."
  968. *
  969. * Mouse input may not be delivered to your application if it is within
  970. * a special area; the OS will often apply that input to moving the window or
  971. * resizing the window and not deliver it to the application.
  972. *
  973. * Specifying NULL for a callback disables hit-testing. Hit-testing is
  974. * disabled by default.
  975. *
  976. * Platforms that don't support this functionality will return -1
  977. * unconditionally, even if you're attempting to disable hit-testing.
  978. *
  979. * Your callback may fire at any time, and its firing does not indicate any
  980. * specific behavior (for example, on Windows, this certainly might fire
  981. * when the OS is deciding whether to drag your window, but it fires for lots
  982. * of other reasons, too, some unrelated to anything you probably care about
  983. * _and when the mouse isn't actually at the location it is testing_).
  984. * Since this can fire at any time, you should try to keep your callback
  985. * efficient, devoid of allocations, etc.
  986. *
  987. * \param window The window to set hit-testing on.
  988. * \param callback The callback to call when doing a hit-test.
  989. * \param callback_data An app-defined void pointer passed to the callback.
  990. * \return 0 on success, -1 on error (including unsupported).
  991. */
  992. extern DECLSPEC int SDLCALL SDL_SetWindowHitTest(SDL_Window * window,
  993. SDL_HitTest callback,
  994. void *callback_data);
  995. /**
  996. * \brief Destroy a window.
  997. */
  998. extern DECLSPEC void SDLCALL SDL_DestroyWindow(SDL_Window * window);
  999. /**
  1000. * \brief Returns whether the screensaver is currently enabled (default off).
  1001. *
  1002. * \sa SDL_EnableScreenSaver()
  1003. * \sa SDL_DisableScreenSaver()
  1004. */
  1005. extern DECLSPEC SDL_bool SDLCALL SDL_IsScreenSaverEnabled(void);
  1006. /**
  1007. * \brief Allow the screen to be blanked by a screensaver
  1008. *
  1009. * \sa SDL_IsScreenSaverEnabled()
  1010. * \sa SDL_DisableScreenSaver()
  1011. */
  1012. extern DECLSPEC void SDLCALL SDL_EnableScreenSaver(void);
  1013. /**
  1014. * \brief Prevent the screen from being blanked by a screensaver
  1015. *
  1016. * \sa SDL_IsScreenSaverEnabled()
  1017. * \sa SDL_EnableScreenSaver()
  1018. */
  1019. extern DECLSPEC void SDLCALL SDL_DisableScreenSaver(void);
  1020. /**
  1021. * \name OpenGL support functions
  1022. */
  1023. /* @{ */
  1024. /**
  1025. * \brief Dynamically load an OpenGL library.
  1026. *
  1027. * \param path The platform dependent OpenGL library name, or NULL to open the
  1028. * default OpenGL library.
  1029. *
  1030. * \return 0 on success, or -1 if the library couldn't be loaded.
  1031. *
  1032. * This should be done after initializing the video driver, but before
  1033. * creating any OpenGL windows. If no OpenGL library is loaded, the default
  1034. * library will be loaded upon creation of the first OpenGL window.
  1035. *
  1036. * \note If you do this, you need to retrieve all of the GL functions used in
  1037. * your program from the dynamic library using SDL_GL_GetProcAddress().
  1038. *
  1039. * \sa SDL_GL_GetProcAddress()
  1040. * \sa SDL_GL_UnloadLibrary()
  1041. */
  1042. extern DECLSPEC int SDLCALL SDL_GL_LoadLibrary(const char *path);
  1043. /**
  1044. * \brief Get the address of an OpenGL function.
  1045. */
  1046. extern DECLSPEC void *SDLCALL SDL_GL_GetProcAddress(const char *proc);
  1047. /**
  1048. * \brief Unload the OpenGL library previously loaded by SDL_GL_LoadLibrary().
  1049. *
  1050. * \sa SDL_GL_LoadLibrary()
  1051. */
  1052. extern DECLSPEC void SDLCALL SDL_GL_UnloadLibrary(void);
  1053. /**
  1054. * \brief Return true if an OpenGL extension is supported for the current
  1055. * context.
  1056. */
  1057. extern DECLSPEC SDL_bool SDLCALL SDL_GL_ExtensionSupported(const char
  1058. *extension);
  1059. /**
  1060. * \brief Reset all previously set OpenGL context attributes to their default values
  1061. */
  1062. extern DECLSPEC void SDLCALL SDL_GL_ResetAttributes(void);
  1063. /**
  1064. * \brief Set an OpenGL window attribute before window creation.
  1065. *
  1066. * \return 0 on success, or -1 if the attribute could not be set.
  1067. */
  1068. extern DECLSPEC int SDLCALL SDL_GL_SetAttribute(SDL_GLattr attr, int value);
  1069. /**
  1070. * \brief Get the actual value for an attribute from the current context.
  1071. *
  1072. * \return 0 on success, or -1 if the attribute could not be retrieved.
  1073. * The integer at \c value will be modified in either case.
  1074. */
  1075. extern DECLSPEC int SDLCALL SDL_GL_GetAttribute(SDL_GLattr attr, int *value);
  1076. /**
  1077. * \brief Create an OpenGL context for use with an OpenGL window, and make it
  1078. * current.
  1079. *
  1080. * \sa SDL_GL_DeleteContext()
  1081. */
  1082. extern DECLSPEC SDL_GLContext SDLCALL SDL_GL_CreateContext(SDL_Window *
  1083. window);
  1084. /**
  1085. * \brief Set up an OpenGL context for rendering into an OpenGL window.
  1086. *
  1087. * \note The context must have been created with a compatible window.
  1088. */
  1089. extern DECLSPEC int SDLCALL SDL_GL_MakeCurrent(SDL_Window * window,
  1090. SDL_GLContext context);
  1091. /**
  1092. * \brief Get the currently active OpenGL window.
  1093. */
  1094. extern DECLSPEC SDL_Window* SDLCALL SDL_GL_GetCurrentWindow(void);
  1095. /**
  1096. * \brief Get the currently active OpenGL context.
  1097. */
  1098. extern DECLSPEC SDL_GLContext SDLCALL SDL_GL_GetCurrentContext(void);
  1099. /**
  1100. * \brief Get the size of a window's underlying drawable in pixels (for use
  1101. * with glViewport).
  1102. *
  1103. * \param window Window from which the drawable size should be queried
  1104. * \param w Pointer to variable for storing the width in pixels, may be NULL
  1105. * \param h Pointer to variable for storing the height in pixels, may be NULL
  1106. *
  1107. * This may differ from SDL_GetWindowSize() if we're rendering to a high-DPI
  1108. * drawable, i.e. the window was created with SDL_WINDOW_ALLOW_HIGHDPI on a
  1109. * platform with high-DPI support (Apple calls this "Retina"), and not disabled
  1110. * by the SDL_HINT_VIDEO_HIGHDPI_DISABLED hint.
  1111. *
  1112. * \sa SDL_GetWindowSize()
  1113. * \sa SDL_CreateWindow()
  1114. */
  1115. extern DECLSPEC void SDLCALL SDL_GL_GetDrawableSize(SDL_Window * window, int *w,
  1116. int *h);
  1117. /**
  1118. * \brief Set the swap interval for the current OpenGL context.
  1119. *
  1120. * \param interval 0 for immediate updates, 1 for updates synchronized with the
  1121. * vertical retrace. If the system supports it, you may
  1122. * specify -1 to allow late swaps to happen immediately
  1123. * instead of waiting for the next retrace.
  1124. *
  1125. * \return 0 on success, or -1 if setting the swap interval is not supported.
  1126. *
  1127. * \sa SDL_GL_GetSwapInterval()
  1128. */
  1129. extern DECLSPEC int SDLCALL SDL_GL_SetSwapInterval(int interval);
  1130. /**
  1131. * \brief Get the swap interval for the current OpenGL context.
  1132. *
  1133. * \return 0 if there is no vertical retrace synchronization, 1 if the buffer
  1134. * swap is synchronized with the vertical retrace, and -1 if late
  1135. * swaps happen immediately instead of waiting for the next retrace.
  1136. * If the system can't determine the swap interval, or there isn't a
  1137. * valid current context, this will return 0 as a safe default.
  1138. *
  1139. * \sa SDL_GL_SetSwapInterval()
  1140. */
  1141. extern DECLSPEC int SDLCALL SDL_GL_GetSwapInterval(void);
  1142. /**
  1143. * \brief Swap the OpenGL buffers for a window, if double-buffering is
  1144. * supported.
  1145. */
  1146. extern DECLSPEC void SDLCALL SDL_GL_SwapWindow(SDL_Window * window);
  1147. /**
  1148. * \brief Delete an OpenGL context.
  1149. *
  1150. * \sa SDL_GL_CreateContext()
  1151. */
  1152. extern DECLSPEC void SDLCALL SDL_GL_DeleteContext(SDL_GLContext context);
  1153. /* @} *//* OpenGL support functions */
  1154. /* Ends C function definitions when using C++ */
  1155. #ifdef __cplusplus
  1156. }
  1157. #endif
  1158. #include "close_code.h"
  1159. #endif /* SDL_video_h_ */
  1160. /* vi: set ts=4 sw=4 expandtab: */