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