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