include/SDL_video.h
author Sam Lantinga <slouken@libsdl.org>
Mon, 30 Sep 2013 21:57:03 -0700
changeset 7769 cf8dd3177612
parent 7752 0947d51f3d1d
child 7853 4861edda71d1
permissions -rw-r--r--
Fixed bug 2119 - compiler warnings (-pedantic) SDL_video.h:111:42
slouken@0
     1
/*
slouken@5535
     2
  Simple DirectMedia Layer
slouken@6885
     3
  Copyright (C) 1997-2013 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 */
slouken@7769
   111
    SDL_WINDOW_ALLOW_HIGHDPI = 0x00002000       /**< window should be created in high-DPI mode if supported */
slouken@1895
   112
} SDL_WindowFlags;
slouken@0
   113
slouken@1895
   114
/**
slouken@3407
   115
 *  \brief Used to indicate that you don't care what the window position is.
slouken@1895
   116
 */
slouken@5246
   117
#define SDL_WINDOWPOS_UNDEFINED_MASK    0x1FFF0000
slouken@5246
   118
#define SDL_WINDOWPOS_UNDEFINED_DISPLAY(X)  (SDL_WINDOWPOS_UNDEFINED_MASK|(X))
slouken@5246
   119
#define SDL_WINDOWPOS_UNDEFINED         SDL_WINDOWPOS_UNDEFINED_DISPLAY(0)
slouken@5246
   120
#define SDL_WINDOWPOS_ISUNDEFINED(X)    \
slouken@5246
   121
            (((X)&0xFFFF0000) == SDL_WINDOWPOS_UNDEFINED_MASK)
slouken@3407
   122
slouken@1895
   123
/**
slouken@3407
   124
 *  \brief Used to indicate that the window position should be centered.
slouken@1895
   125
 */
slouken@5246
   126
#define SDL_WINDOWPOS_CENTERED_MASK    0x2FFF0000
slouken@5246
   127
#define SDL_WINDOWPOS_CENTERED_DISPLAY(X)  (SDL_WINDOWPOS_CENTERED_MASK|(X))
slouken@5246
   128
#define SDL_WINDOWPOS_CENTERED         SDL_WINDOWPOS_CENTERED_DISPLAY(0)
slouken@5246
   129
#define SDL_WINDOWPOS_ISCENTERED(X)    \
slouken@5246
   130
            (((X)&0xFFFF0000) == SDL_WINDOWPOS_CENTERED_MASK)
slouken@1895
   131
slouken@1895
   132
/**
slouken@3407
   133
 *  \brief Event subtype for window events
slouken@1895
   134
 */
slouken@1895
   135
typedef enum
slouken@1895
   136
{
slouken@3407
   137
    SDL_WINDOWEVENT_NONE,           /**< Never used */
slouken@3407
   138
    SDL_WINDOWEVENT_SHOWN,          /**< Window has been shown */
slouken@3407
   139
    SDL_WINDOWEVENT_HIDDEN,         /**< Window has been hidden */
slouken@7191
   140
    SDL_WINDOWEVENT_EXPOSED,        /**< Window has been exposed and should be
slouken@3407
   141
                                         redrawn */
slouken@7191
   142
    SDL_WINDOWEVENT_MOVED,          /**< Window has been moved to data1, data2
slouken@3407
   143
                                     */
slouken@5276
   144
    SDL_WINDOWEVENT_RESIZED,        /**< Window has been resized to data1xdata2 */
slouken@5276
   145
    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
   146
    SDL_WINDOWEVENT_MINIMIZED,      /**< Window has been minimized */
slouken@3407
   147
    SDL_WINDOWEVENT_MAXIMIZED,      /**< Window has been maximized */
slouken@3407
   148
    SDL_WINDOWEVENT_RESTORED,       /**< Window has been restored to normal size
slouken@3407
   149
                                         and position */
slouken@3691
   150
    SDL_WINDOWEVENT_ENTER,          /**< Window has gained mouse focus */
slouken@3691
   151
    SDL_WINDOWEVENT_LEAVE,          /**< Window has lost mouse focus */
slouken@3691
   152
    SDL_WINDOWEVENT_FOCUS_GAINED,   /**< Window has gained keyboard focus */
slouken@3691
   153
    SDL_WINDOWEVENT_FOCUS_LOST,     /**< Window has lost keyboard focus */
slouken@7191
   154
    SDL_WINDOWEVENT_CLOSE           /**< The window manager requests that the
slouken@3407
   155
                                         window be closed */
slouken@1895
   156
} SDL_WindowEventID;
slouken@1895
   157
slouken@1895
   158
/**
slouken@3407
   159
 *  \brief An opaque handle to an OpenGL context.
slouken@1895
   160
 */
slouken@1895
   161
typedef void *SDL_GLContext;
slouken@1895
   162
slouken@1895
   163
/**
slouken@3407
   164
 *  \brief OpenGL configuration attributes
slouken@0
   165
 */
slouken@1895
   166
typedef enum
slouken@1895
   167
{
slouken@0
   168
    SDL_GL_RED_SIZE,
slouken@0
   169
    SDL_GL_GREEN_SIZE,
slouken@0
   170
    SDL_GL_BLUE_SIZE,
slouken@0
   171
    SDL_GL_ALPHA_SIZE,
slouken@0
   172
    SDL_GL_BUFFER_SIZE,
slouken@0
   173
    SDL_GL_DOUBLEBUFFER,
slouken@0
   174
    SDL_GL_DEPTH_SIZE,
slouken@0
   175
    SDL_GL_STENCIL_SIZE,
slouken@0
   176
    SDL_GL_ACCUM_RED_SIZE,
slouken@0
   177
    SDL_GL_ACCUM_GREEN_SIZE,
slouken@0
   178
    SDL_GL_ACCUM_BLUE_SIZE,
slouken@450
   179
    SDL_GL_ACCUM_ALPHA_SIZE,
slouken@655
   180
    SDL_GL_STEREO,
slouken@656
   181
    SDL_GL_MULTISAMPLEBUFFERS,
slouken@1736
   182
    SDL_GL_MULTISAMPLESAMPLES,
hfutrell@2747
   183
    SDL_GL_ACCELERATED_VISUAL,
slouken@3100
   184
    SDL_GL_RETAINED_BACKING,
slouken@3139
   185
    SDL_GL_CONTEXT_MAJOR_VERSION,
slouken@6296
   186
    SDL_GL_CONTEXT_MINOR_VERSION,
slouken@6370
   187
    SDL_GL_CONTEXT_EGL,
slouken@6296
   188
    SDL_GL_CONTEXT_FLAGS,
slouken@6393
   189
    SDL_GL_CONTEXT_PROFILE_MASK,
slouken@6393
   190
    SDL_GL_SHARE_WITH_CURRENT_CONTEXT
slouken@0
   191
} SDL_GLattr;
slouken@0
   192
slouken@6296
   193
typedef enum
slouken@6296
   194
{
slouken@6296
   195
    SDL_GL_CONTEXT_PROFILE_CORE           = 0x0001,
slouken@6296
   196
    SDL_GL_CONTEXT_PROFILE_COMPATIBILITY  = 0x0002,
gabomdq@7659
   197
    SDL_GL_CONTEXT_PROFILE_ES             = 0x0004 /* GLX_CONTEXT_ES2_PROFILE_BIT_EXT */
slouken@6296
   198
} SDL_GLprofile;
slouken@6296
   199
slouken@6296
   200
typedef enum
slouken@6296
   201
{
slouken@6296
   202
    SDL_GL_CONTEXT_DEBUG_FLAG              = 0x0001,
slouken@6296
   203
    SDL_GL_CONTEXT_FORWARD_COMPATIBLE_FLAG = 0x0002,
slouken@6393
   204
    SDL_GL_CONTEXT_ROBUST_ACCESS_FLAG      = 0x0004,
slouken@6393
   205
    SDL_GL_CONTEXT_RESET_ISOLATION_FLAG    = 0x0008
slouken@6296
   206
} SDL_GLcontextFlag;
slouken@6296
   207
slouken@0
   208
slouken@0
   209
/* Function prototypes */
slouken@0
   210
slouken@1895
   211
/**
slouken@3407
   212
 *  \brief Get the number of video drivers compiled into SDL
slouken@7191
   213
 *
slouken@3407
   214
 *  \sa SDL_GetVideoDriver()
slouken@0
   215
 */
slouken@1895
   216
extern DECLSPEC int SDLCALL SDL_GetNumVideoDrivers(void);
slouken@1895
   217
slouken@1895
   218
/**
slouken@3407
   219
 *  \brief Get the name of a built in video driver.
slouken@7191
   220
 *
slouken@3407
   221
 *  \note The video drivers are presented in the order in which they are
slouken@3407
   222
 *        normally checked during initialization.
slouken@7191
   223
 *
slouken@3407
   224
 *  \sa SDL_GetNumVideoDrivers()
slouken@1895
   225
 */
slouken@1895
   226
extern DECLSPEC const char *SDLCALL SDL_GetVideoDriver(int index);
slouken@1895
   227
slouken@1895
   228
/**
slouken@3407
   229
 *  \brief Initialize the video subsystem, optionally specifying a video driver.
slouken@7191
   230
 *
slouken@7191
   231
 *  \param driver_name Initialize a specific driver by name, or NULL for the
slouken@3407
   232
 *                     default video driver.
slouken@7191
   233
 *
slouken@3407
   234
 *  \return 0 on success, -1 on error
slouken@7191
   235
 *
slouken@3407
   236
 *  This function initializes the video subsystem; setting up a connection
slouken@3407
   237
 *  to the window manager, etc, and determines the available display modes
slouken@3407
   238
 *  and pixel formats, but does not initialize a window or graphics mode.
slouken@7191
   239
 *
slouken@3407
   240
 *  \sa SDL_VideoQuit()
slouken@1895
   241
 */
slouken@5123
   242
extern DECLSPEC int SDLCALL SDL_VideoInit(const char *driver_name);
slouken@1895
   243
slouken@1895
   244
/**
slouken@3407
   245
 *  \brief Shuts down the video subsystem.
slouken@7191
   246
 *
slouken@3407
   247
 *  This function closes all windows, and restores the original video mode.
slouken@7191
   248
 *
slouken@3407
   249
 *  \sa SDL_VideoInit()
slouken@1895
   250
 */
slouken@337
   251
extern DECLSPEC void SDLCALL SDL_VideoQuit(void);
slouken@0
   252
slouken@1895
   253
/**
slouken@3407
   254
 *  \brief Returns the name of the currently initialized video driver.
slouken@7191
   255
 *
slouken@3407
   256
 *  \return The name of the current video driver or NULL if no driver
slouken@3407
   257
 *          has been initialized
slouken@7191
   258
 *
slouken@3407
   259
 *  \sa SDL_GetNumVideoDrivers()
slouken@3407
   260
 *  \sa SDL_GetVideoDriver()
slouken@0
   261
 */
slouken@1895
   262
extern DECLSPEC const char *SDLCALL SDL_GetCurrentVideoDriver(void);
slouken@0
   263
slouken@1895
   264
/**
slouken@3407
   265
 *  \brief Returns the number of available video displays.
slouken@7191
   266
 *
slouken@3528
   267
 *  \sa SDL_GetDisplayBounds()
slouken@0
   268
 */
slouken@1895
   269
extern DECLSPEC int SDLCALL SDL_GetNumVideoDisplays(void);
slouken@0
   270
slouken@1895
   271
/**
slouken@6787
   272
 *  \brief Get the name of a display in UTF-8 encoding
slouken@7191
   273
 *
slouken@6787
   274
 *  \return The name of a display, or NULL for an invalid display index.
slouken@7191
   275
 *
slouken@6787
   276
 *  \sa SDL_GetNumVideoDisplays()
slouken@6787
   277
 */
slouken@6787
   278
extern DECLSPEC const char * SDLCALL SDL_GetDisplayName(int displayIndex);
slouken@6787
   279
slouken@6787
   280
/**
slouken@3528
   281
 *  \brief Get the desktop area represented by a display, with the primary
slouken@3528
   282
 *         display located at 0,0
slouken@7191
   283
 *
slouken@3528
   284
 *  \return 0 on success, or -1 if the index is out of range.
slouken@7191
   285
 *
slouken@3528
   286
 *  \sa SDL_GetNumVideoDisplays()
slouken@3528
   287
 */
slouken@5244
   288
extern DECLSPEC int SDLCALL SDL_GetDisplayBounds(int displayIndex, SDL_Rect * rect);
slouken@3528
   289
slouken@3528
   290
/**
slouken@5244
   291
 *  \brief Returns the number of available display modes.
slouken@7191
   292
 *
slouken@3407
   293
 *  \sa SDL_GetDisplayMode()
slouken@0
   294
 */
slouken@5244
   295
extern DECLSPEC int SDLCALL SDL_GetNumDisplayModes(int displayIndex);
slouken@0
   296
slouken@1895
   297
/**
slouken@3407
   298
 *  \brief Fill in information about a specific display mode.
slouken@7191
   299
 *
slouken@3407
   300
 *  \note The display modes are sorted in this priority:
slouken@3407
   301
 *        \li bits per pixel -> more colors to fewer colors
slouken@3407
   302
 *        \li width -> largest to smallest
slouken@3407
   303
 *        \li height -> largest to smallest
slouken@3407
   304
 *        \li refresh rate -> highest to lowest
slouken@7191
   305
 *
slouken@3407
   306
 *  \sa SDL_GetNumDisplayModes()
slouken@0
   307
 */
slouken@5244
   308
extern DECLSPEC int SDLCALL SDL_GetDisplayMode(int displayIndex, int modeIndex,
slouken@1967
   309
                                               SDL_DisplayMode * mode);
slouken@0
   310
slouken@1895
   311
/**
slouken@5244
   312
 *  \brief Fill in information about the desktop display mode.
slouken@1895
   313
 */
slouken@5244
   314
extern DECLSPEC int SDLCALL SDL_GetDesktopDisplayMode(int displayIndex, SDL_DisplayMode * mode);
slouken@1895
   315
slouken@1895
   316
/**
slouken@3407
   317
 *  \brief Fill in information about the current display mode.
slouken@1895
   318
 */
slouken@5244
   319
extern DECLSPEC int SDLCALL SDL_GetCurrentDisplayMode(int displayIndex, SDL_DisplayMode * mode);
slouken@1895
   320
slouken@3400
   321
slouken@1895
   322
/**
slouken@3407
   323
 *  \brief Get the closest match to the requested display mode.
slouken@7191
   324
 *
philipp@7188
   325
 *  \param displayIndex The index of display from which mode should be queried.
slouken@3407
   326
 *  \param mode The desired display mode
slouken@7191
   327
 *  \param closest A pointer to a display mode to be filled in with the closest
slouken@3407
   328
 *                 match of the available display modes.
slouken@7191
   329
 *
slouken@7191
   330
 *  \return The passed in value \c closest, or NULL if no matching video mode
slouken@3407
   331
 *          was available.
slouken@7191
   332
 *
slouken@3407
   333
 *  The available display modes are scanned, and \c closest is filled in with the
slouken@7191
   334
 *  closest mode matching the requested mode and returned.  The mode format and
slouken@7191
   335
 *  refresh_rate default to the desktop mode if they are 0.  The modes are
slouken@7191
   336
 *  scanned with size being first priority, format being second priority, and
slouken@7191
   337
 *  finally checking the refresh_rate.  If all the available modes are too
slouken@3407
   338
 *  small, then NULL is returned.
slouken@7191
   339
 *
slouken@3407
   340
 *  \sa SDL_GetNumDisplayModes()
slouken@3407
   341
 *  \sa SDL_GetDisplayMode()
slouken@1895
   342
 */
slouken@5244
   343
extern DECLSPEC SDL_DisplayMode * SDLCALL SDL_GetClosestDisplayMode(int displayIndex, const SDL_DisplayMode * mode, SDL_DisplayMode * closest);
slouken@1895
   344
slouken@1895
   345
/**
slouken@5246
   346
 *  \brief Get the display index associated with a window.
slouken@7191
   347
 *
slouken@5246
   348
 *  \return the display index of the display containing the center of the
slouken@5246
   349
 *          window, or -1 on error.
slouken@5246
   350
 */
slouken@6786
   351
extern DECLSPEC int SDLCALL SDL_GetWindowDisplayIndex(SDL_Window * window);
slouken@5246
   352
slouken@5246
   353
/**
slouken@5244
   354
 *  \brief Set the display mode used when a fullscreen window is visible.
slouken@5244
   355
 *
slouken@5244
   356
 *  By default the window's dimensions and the desktop format and refresh rate
slouken@5244
   357
 *  are used.
slouken@7191
   358
 *
philipp@7188
   359
 *  \param window The window for which the display mode should be set.
slouken@3500
   360
 *  \param mode The mode to use, or NULL for the default mode.
slouken@7191
   361
 *
slouken@3407
   362
 *  \return 0 on success, or -1 if setting the display mode failed.
slouken@7191
   363
 *
slouken@3522
   364
 *  \sa SDL_GetWindowDisplayMode()
slouken@3407
   365
 *  \sa SDL_SetWindowFullscreen()
slouken@0
   366
 */
slouken@3685
   367
extern DECLSPEC int SDLCALL SDL_SetWindowDisplayMode(SDL_Window * window,
slouken@3500
   368
                                                     const SDL_DisplayMode
slouken@1895
   369
                                                         * mode);
slouken@0
   370
slouken@1895
   371
/**
slouken@3407
   372
 *  \brief Fill in information about the display mode used when a fullscreen
slouken@5244
   373
 *         window is visible.
slouken@3522
   374
 *
slouken@3522
   375
 *  \sa SDL_SetWindowDisplayMode()
slouken@3522
   376
 *  \sa SDL_SetWindowFullscreen()
slouken@0
   377
 */
slouken@3685
   378
extern DECLSPEC int SDLCALL SDL_GetWindowDisplayMode(SDL_Window * window,
slouken@3500
   379
                                                     SDL_DisplayMode * mode);
slouken@0
   380
slouken@1895
   381
/**
slouken@5154
   382
 *  \brief Get the pixel format associated with the window.
slouken@5154
   383
 */
slouken@5154
   384
extern DECLSPEC Uint32 SDLCALL SDL_GetWindowPixelFormat(SDL_Window * window);
slouken@5154
   385
slouken@5154
   386
/**
slouken@3407
   387
 *  \brief Create a window with the specified position, dimensions, and flags.
slouken@7191
   388
 *
slouken@3407
   389
 *  \param title The title of the window, in UTF-8 encoding.
slouken@7191
   390
 *  \param x     The x position of the window, ::SDL_WINDOWPOS_CENTERED, or
slouken@3407
   391
 *               ::SDL_WINDOWPOS_UNDEFINED.
slouken@7191
   392
 *  \param y     The y position of the window, ::SDL_WINDOWPOS_CENTERED, or
slouken@3407
   393
 *               ::SDL_WINDOWPOS_UNDEFINED.
slouken@3407
   394
 *  \param w     The width of the window.
slouken@3407
   395
 *  \param h     The height of the window.
slouken@7191
   396
 *  \param flags The flags for the window, a mask of any of the following:
urkle@7746
   397
 *               ::SDL_WINDOW_FULLSCREEN,    ::SDL_WINDOW_OPENGL,
urkle@7746
   398
 *               ::SDL_WINDOW_HIDDEN,        ::SDL_WINDOW_BORDERLESS,
urkle@7746
   399
 *               ::SDL_WINDOW_RESIZABLE,     ::SDL_WINDOW_MAXIMIZED,
urkle@7746
   400
 *               ::SDL_WINDOW_MINIMIZED,     ::SDL_WINDOW_INPUT_GRABBED,
urkle@7746
   401
 *               ::SDL_WINDOW_ALLOW_HIGHDPI.
slouken@7191
   402
 *
slouken@3407
   403
 *  \return The id of the window created, or zero if window creation failed.
slouken@7191
   404
 *
slouken@3407
   405
 *  \sa SDL_DestroyWindow()
slouken@0
   406
 */
slouken@3685
   407
extern DECLSPEC SDL_Window * SDLCALL SDL_CreateWindow(const char *title,
slouken@1895
   408
                                                      int x, int y, int w,
slouken@1895
   409
                                                      int h, Uint32 flags);
slouken@0
   410
slouken@1895
   411
/**
slouken@3493
   412
 *  \brief Create an SDL window from an existing native window.
slouken@7191
   413
 *
slouken@3407
   414
 *  \param data A pointer to driver-dependent window creation data
slouken@7191
   415
 *
slouken@3407
   416
 *  \return The id of the window created, or zero if window creation failed.
slouken@7191
   417
 *
slouken@3407
   418
 *  \sa SDL_DestroyWindow()
slouken@0
   419
 */
slouken@3685
   420
extern DECLSPEC SDL_Window * SDLCALL SDL_CreateWindowFrom(const void *data);
slouken@3685
   421
slouken@3685
   422
/**
slouken@4883
   423
 *  \brief Get the numeric ID of a window, for logging purposes.
slouken@3685
   424
 */
slouken@3685
   425
extern DECLSPEC Uint32 SDLCALL SDL_GetWindowID(SDL_Window * window);
slouken@3685
   426
slouken@3685
   427
/**
slouken@3685
   428
 *  \brief Get a window from a stored ID, or NULL if it doesn't exist.
slouken@3685
   429
 */
slouken@3685
   430
extern DECLSPEC SDL_Window * SDLCALL SDL_GetWindowFromID(Uint32 id);
slouken@1895
   431
slouken@1895
   432
/**
slouken@3407
   433
 *  \brief Get the window flags.
slouken@1895
   434
 */
slouken@3685
   435
extern DECLSPEC Uint32 SDLCALL SDL_GetWindowFlags(SDL_Window * window);
slouken@1895
   436
slouken@1895
   437
/**
slouken@4883
   438
 *  \brief Set the title of a window, in UTF-8 format.
slouken@7191
   439
 *
slouken@3407
   440
 *  \sa SDL_GetWindowTitle()
slouken@1895
   441
 */
slouken@3685
   442
extern DECLSPEC void SDLCALL SDL_SetWindowTitle(SDL_Window * window,
slouken@1895
   443
                                                const char *title);
slouken@1895
   444
slouken@1895
   445
/**
slouken@4883
   446
 *  \brief Get the title of a window, in UTF-8 format.
slouken@7191
   447
 *
slouken@3407
   448
 *  \sa SDL_SetWindowTitle()
slouken@1895
   449
 */
slouken@3685
   450
extern DECLSPEC const char *SDLCALL SDL_GetWindowTitle(SDL_Window * window);
slouken@1895
   451
slouken@1895
   452
/**
slouken@4887
   453
 *  \brief Set the icon for a window.
slouken@7191
   454
 *
philipp@7188
   455
 *  \param window The window for which the icon should be set.
slouken@4887
   456
 *  \param icon The icon for the window.
slouken@1895
   457
 */
slouken@3685
   458
extern DECLSPEC void SDLCALL SDL_SetWindowIcon(SDL_Window * window,
slouken@2990
   459
                                               SDL_Surface * icon);
slouken@1895
   460
slouken@1895
   461
/**
slouken@5165
   462
 *  \brief Associate an arbitrary named pointer with a window.
slouken@7191
   463
 *
slouken@5165
   464
 *  \param window   The window to associate with the pointer.
slouken@5165
   465
 *  \param name     The name of the pointer.
slouken@5165
   466
 *  \param userdata The associated pointer.
slouken@5165
   467
 *
slouken@5165
   468
 *  \return The previous value associated with 'name'
slouken@5165
   469
 *
slouken@5165
   470
 *  \note The name is case-sensitive.
slouken@5165
   471
 *
slouken@3407
   472
 *  \sa SDL_GetWindowData()
slouken@1895
   473
 */
slouken@5165
   474
extern DECLSPEC void* SDLCALL SDL_SetWindowData(SDL_Window * window,
slouken@5165
   475
                                                const char *name,
slouken@5165
   476
                                                void *userdata);
slouken@1895
   477
slouken@1895
   478
/**
slouken@4883
   479
 *  \brief Retrieve the data pointer associated with a window.
slouken@7191
   480
 *
slouken@5165
   481
 *  \param window   The window to query.
slouken@5165
   482
 *  \param name     The name of the pointer.
slouken@5165
   483
 *
slouken@5165
   484
 *  \return The value associated with 'name'
slouken@7191
   485
 *
slouken@3407
   486
 *  \sa SDL_SetWindowData()
slouken@1895
   487
 */
slouken@5165
   488
extern DECLSPEC void *SDLCALL SDL_GetWindowData(SDL_Window * window,
slouken@5165
   489
                                                const char *name);
slouken@1895
   490
slouken@1895
   491
/**
slouken@4883
   492
 *  \brief Set the position of a window.
slouken@7191
   493
 *
slouken@5165
   494
 *  \param window   The window to reposition.
slouken@3407
   495
 *  \param x        The x coordinate of the window, ::SDL_WINDOWPOS_CENTERED, or
slouken@3407
   496
                    ::SDL_WINDOWPOS_UNDEFINED.
slouken@3407
   497
 *  \param y        The y coordinate of the window, ::SDL_WINDOWPOS_CENTERED, or
slouken@3407
   498
                    ::SDL_WINDOWPOS_UNDEFINED.
slouken@7191
   499
 *
slouken@3407
   500
 *  \note The window coordinate origin is the upper left of the display.
slouken@7191
   501
 *
slouken@3407
   502
 *  \sa SDL_GetWindowPosition()
slouken@1895
   503
 */
slouken@3685
   504
extern DECLSPEC void SDLCALL SDL_SetWindowPosition(SDL_Window * window,
slouken@1895
   505
                                                   int x, int y);
slouken@1895
   506
slouken@1895
   507
/**
slouken@4883
   508
 *  \brief Get the position of a window.
slouken@7191
   509
 *
philipp@7175
   510
 *  \param window   The window to query.
aschiffler@6984
   511
 *  \param x        Pointer to variable for storing the x position, may be NULL
aschiffler@6984
   512
 *  \param y        Pointer to variable for storing the y position, may be NULL
aschiffler@6984
   513
 *
slouken@3407
   514
 *  \sa SDL_SetWindowPosition()
slouken@1895
   515
 */
slouken@3685
   516
extern DECLSPEC void SDLCALL SDL_GetWindowPosition(SDL_Window * window,
slouken@1895
   517
                                                   int *x, int *y);
slouken@1895
   518
slouken@1895
   519
/**
slouken@4883
   520
 *  \brief Set the size of a window's client area.
slouken@7191
   521
 *
philipp@7175
   522
 *  \param window   The window to resize.
aschiffler@6984
   523
 *  \param w        The width of the window, must be >0
aschiffler@6984
   524
 *  \param h        The height of the window, must be >0
aschiffler@6984
   525
 *
slouken@3407
   526
 *  \note You can't change the size of a fullscreen window, it automatically
slouken@3407
   527
 *        matches the size of the display mode.
slouken@7191
   528
 *
slouken@3407
   529
 *  \sa SDL_GetWindowSize()
slouken@1895
   530
 */
slouken@3685
   531
extern DECLSPEC void SDLCALL SDL_SetWindowSize(SDL_Window * window, int w,
slouken@1895
   532
                                               int h);
slouken@1895
   533
slouken@1895
   534
/**
slouken@4883
   535
 *  \brief Get the size of a window's client area.
slouken@7191
   536
 *
philipp@7175
   537
 *  \param window   The window to query.
aschiffler@6984
   538
 *  \param w        Pointer to variable for storing the width, may be NULL
aschiffler@6984
   539
 *  \param h        Pointer to variable for storing the height, may be NULL
slouken@7191
   540
 *
slouken@3407
   541
 *  \sa SDL_SetWindowSize()
slouken@1895
   542
 */
slouken@3685
   543
extern DECLSPEC void SDLCALL SDL_GetWindowSize(SDL_Window * window, int *w,
slouken@1895
   544
                                               int *h);
slouken@7191
   545
stopiccot@6681
   546
/**
stopiccot@6681
   547
 *  \brief Set the minimum size of a window's client area.
slouken@7191
   548
 *
philipp@7175
   549
 *  \param window    The window to set a new minimum size.
aschiffler@6984
   550
 *  \param min_w     The minimum width of the window, must be >0
aschiffler@6984
   551
 *  \param min_h     The minimum height of the window, must be >0
stopiccot@6681
   552
 *
stopiccot@6681
   553
 *  \note You can't change the minimum size of a fullscreen window, it
stopiccot@6681
   554
 *        automatically matches the size of the display mode.
stopiccot@6681
   555
 *
stopiccot@6681
   556
 *  \sa SDL_GetWindowMinimumSize()
slouken@6788
   557
 *  \sa SDL_SetWindowMaximumSize()
stopiccot@6681
   558
 */
stopiccot@6681
   559
extern DECLSPEC void SDLCALL SDL_SetWindowMinimumSize(SDL_Window * window,
stopiccot@6681
   560
                                                      int min_w, int min_h);
slouken@7191
   561
stopiccot@6681
   562
/**
stopiccot@6681
   563
 *  \brief Get the minimum size of a window's client area.
slouken@7191
   564
 *
philipp@7175
   565
 *  \param window   The window to query.
aschiffler@6984
   566
 *  \param w        Pointer to variable for storing the minimum width, may be NULL
aschiffler@6984
   567
 *  \param h        Pointer to variable for storing the minimum height, may be NULL
slouken@7191
   568
 *
slouken@6788
   569
 *  \sa SDL_GetWindowMaximumSize()
stopiccot@6681
   570
 *  \sa SDL_SetWindowMinimumSize()
stopiccot@6681
   571
 */
stopiccot@6681
   572
extern DECLSPEC void SDLCALL SDL_GetWindowMinimumSize(SDL_Window * window,
stopiccot@6681
   573
                                                      int *w, int *h);
slouken@1895
   574
slouken@1895
   575
/**
slouken@6788
   576
 *  \brief Set the maximum size of a window's client area.
slouken@6788
   577
 *
philipp@7175
   578
 *  \param window    The window to set a new maximum size.
aschiffler@6984
   579
 *  \param max_w     The maximum width of the window, must be >0
aschiffler@6984
   580
 *  \param max_h     The maximum height of the window, must be >0
aschiffler@6984
   581
 *
slouken@6788
   582
 *  \note You can't change the maximum size of a fullscreen window, it
slouken@6788
   583
 *        automatically matches the size of the display mode.
slouken@6788
   584
 *
slouken@6788
   585
 *  \sa SDL_GetWindowMaximumSize()
slouken@6788
   586
 *  \sa SDL_SetWindowMinimumSize()
slouken@6788
   587
 */
slouken@6788
   588
extern DECLSPEC void SDLCALL SDL_SetWindowMaximumSize(SDL_Window * window,
slouken@6788
   589
                                                      int max_w, int max_h);
slouken@7191
   590
slouken@6788
   591
/**
slouken@6788
   592
 *  \brief Get the maximum size of a window's client area.
slouken@7191
   593
 *
philipp@7175
   594
 *  \param window   The window to query.
aschiffler@6984
   595
 *  \param w        Pointer to variable for storing the maximum width, may be NULL
aschiffler@6984
   596
 *  \param h        Pointer to variable for storing the maximum height, may be NULL
slouken@6788
   597
 *
slouken@6788
   598
 *  \sa SDL_GetWindowMinimumSize()
slouken@6788
   599
 *  \sa SDL_SetWindowMaximumSize()
slouken@6788
   600
 */
slouken@6788
   601
extern DECLSPEC void SDLCALL SDL_GetWindowMaximumSize(SDL_Window * window,
slouken@6788
   602
                                                      int *w, int *h);
slouken@6788
   603
slouken@6788
   604
/**
icculus@6422
   605
 *  \brief Set the border state of a window.
icculus@6422
   606
 *
icculus@6422
   607
 *  This will add or remove the window's SDL_WINDOW_BORDERLESS flag and
icculus@6422
   608
 *  add or remove the border from the actual window. This is a no-op if the
icculus@6422
   609
 *  window's border already matches the requested state.
icculus@6422
   610
 *
icculus@6422
   611
 *  \param window The window of which to change the border state.
icculus@6422
   612
 *  \param bordered SDL_FALSE to remove border, SDL_TRUE to add border.
icculus@6422
   613
 *
icculus@6422
   614
 *  \note You can't change the border state of a fullscreen window.
slouken@7191
   615
 *
icculus@6422
   616
 *  \sa SDL_GetWindowFlags()
icculus@6422
   617
 */
icculus@6422
   618
extern DECLSPEC void SDLCALL SDL_SetWindowBordered(SDL_Window * window,
icculus@6422
   619
                                                   SDL_bool bordered);
icculus@6422
   620
icculus@6422
   621
/**
slouken@4883
   622
 *  \brief Show a window.
slouken@7191
   623
 *
slouken@3407
   624
 *  \sa SDL_HideWindow()
slouken@1895
   625
 */
slouken@3685
   626
extern DECLSPEC void SDLCALL SDL_ShowWindow(SDL_Window * window);
slouken@1895
   627
slouken@1895
   628
/**
slouken@4883
   629
 *  \brief Hide a window.
slouken@7191
   630
 *
slouken@3407
   631
 *  \sa SDL_ShowWindow()
slouken@1895
   632
 */
slouken@3685
   633
extern DECLSPEC void SDLCALL SDL_HideWindow(SDL_Window * window);
slouken@1895
   634
slouken@1895
   635
/**
slouken@4883
   636
 *  \brief Raise a window above other windows and set the input focus.
slouken@1895
   637
 */
slouken@3685
   638
extern DECLSPEC void SDLCALL SDL_RaiseWindow(SDL_Window * window);
slouken@1895
   639
slouken@1895
   640
/**
slouken@4883
   641
 *  \brief Make a window as large as possible.
slouken@7191
   642
 *
slouken@3407
   643
 *  \sa SDL_RestoreWindow()
slouken@1895
   644
 */
slouken@3685
   645
extern DECLSPEC void SDLCALL SDL_MaximizeWindow(SDL_Window * window);
slouken@1895
   646
slouken@1895
   647
/**
slouken@4883
   648
 *  \brief Minimize a window to an iconic representation.
slouken@7191
   649
 *
slouken@3407
   650
 *  \sa SDL_RestoreWindow()
slouken@1895
   651
 */
slouken@3685
   652
extern DECLSPEC void SDLCALL SDL_MinimizeWindow(SDL_Window * window);
slouken@1895
   653
slouken@1895
   654
/**
slouken@3407
   655
 *  \brief Restore the size and position of a minimized or maximized window.
slouken@7191
   656
 *
slouken@3407
   657
 *  \sa SDL_MaximizeWindow()
slouken@3407
   658
 *  \sa SDL_MinimizeWindow()
slouken@1895
   659
 */
slouken@3685
   660
extern DECLSPEC void SDLCALL SDL_RestoreWindow(SDL_Window * window);
slouken@1895
   661
slouken@1895
   662
/**
slouken@4883
   663
 *  \brief Set a window's fullscreen state.
slouken@7191
   664
 *
slouken@3407
   665
 *  \return 0 on success, or -1 if setting the display mode failed.
slouken@7191
   666
 *
slouken@3522
   667
 *  \sa SDL_SetWindowDisplayMode()
slouken@3522
   668
 *  \sa SDL_GetWindowDisplayMode()
slouken@1895
   669
 */
slouken@3685
   670
extern DECLSPEC int SDLCALL SDL_SetWindowFullscreen(SDL_Window * window,
slouken@6755
   671
                                                    Uint32 flags);
slouken@1895
   672
slouken@1895
   673
/**
slouken@5546
   674
 *  \brief Get the SDL surface associated with the window.
slouken@5166
   675
 *
slouken@7191
   676
 *  \return The window's framebuffer surface, or NULL on error.
slouken@5546
   677
 *
slouken@5546
   678
 *  A new surface will be created with the optimal format for the window,
slouken@5546
   679
 *  if necessary. This surface will be freed when the window is destroyed.
slouken@5166
   680
 *
slouken@5166
   681
 *  \note You may not combine this with 3D or the rendering API on this window.
slouken@5166
   682
 *
slouken@5166
   683
 *  \sa SDL_UpdateWindowSurface()
slouken@5166
   684
 *  \sa SDL_UpdateWindowSurfaceRects()
slouken@5166
   685
 */
slouken@5166
   686
extern DECLSPEC SDL_Surface * SDLCALL SDL_GetWindowSurface(SDL_Window * window);
slouken@5166
   687
slouken@5166
   688
/**
slouken@5166
   689
 *  \brief Copy the window surface to the screen.
slouken@5166
   690
 *
slouken@5166
   691
 *  \return 0 on success, or -1 on error.
slouken@5166
   692
 *
slouken@5166
   693
 *  \sa SDL_GetWindowSurface()
slouken@5166
   694
 *  \sa SDL_UpdateWindowSurfaceRects()
slouken@5166
   695
 */
slouken@5166
   696
extern DECLSPEC int SDLCALL SDL_UpdateWindowSurface(SDL_Window * window);
slouken@5166
   697
slouken@5166
   698
/**
slouken@5166
   699
 *  \brief Copy a number of rectangles on the window surface to the screen.
slouken@5166
   700
 *
slouken@5166
   701
 *  \return 0 on success, or -1 on error.
slouken@5166
   702
 *
slouken@5166
   703
 *  \sa SDL_GetWindowSurface()
slouken@5166
   704
 *  \sa SDL_UpdateWindowSurfaceRect()
slouken@5166
   705
 */
slouken@5166
   706
extern DECLSPEC int SDLCALL SDL_UpdateWindowSurfaceRects(SDL_Window * window,
slouken@7014
   707
                                                         const SDL_Rect * rects,
slouken@5297
   708
                                                         int numrects);
slouken@5166
   709
slouken@5166
   710
/**
slouken@4883
   711
 *  \brief Set a window's input grab mode.
slouken@7191
   712
 *
philipp@7188
   713
 *  \param window The window for which the input grab mode should be set.
slouken@5403
   714
 *  \param grabbed This is SDL_TRUE to grab input, and SDL_FALSE to release input.
slouken@7191
   715
 *
slouken@3407
   716
 *  \sa SDL_GetWindowGrab()
slouken@1895
   717
 */
slouken@3685
   718
extern DECLSPEC void SDLCALL SDL_SetWindowGrab(SDL_Window * window,
slouken@5403
   719
                                               SDL_bool grabbed);
slouken@1895
   720
slouken@1895
   721
/**
slouken@4883
   722
 *  \brief Get a window's input grab mode.
slouken@7191
   723
 *
slouken@5403
   724
 *  \return This returns SDL_TRUE if input is grabbed, and SDL_FALSE otherwise.
slouken@7191
   725
 *
slouken@3407
   726
 *  \sa SDL_SetWindowGrab()
slouken@1895
   727
 */
slouken@5403
   728
extern DECLSPEC SDL_bool SDLCALL SDL_GetWindowGrab(SDL_Window * window);
slouken@1895
   729
slouken@1895
   730
/**
slouken@5466
   731
 *  \brief Set the brightness (gamma correction) for a window.
slouken@7191
   732
 *
slouken@5466
   733
 *  \return 0 on success, or -1 if setting the brightness isn't supported.
slouken@7191
   734
 *
slouken@5466
   735
 *  \sa SDL_GetWindowBrightness()
slouken@5466
   736
 *  \sa SDL_SetWindowGammaRamp()
slouken@5466
   737
 */
slouken@5466
   738
extern DECLSPEC int SDLCALL SDL_SetWindowBrightness(SDL_Window * window, float brightness);
slouken@5466
   739
slouken@5466
   740
/**
slouken@5466
   741
 *  \brief Get the brightness (gamma correction) for a window.
slouken@7191
   742
 *
slouken@5466
   743
 *  \return The last brightness value passed to SDL_SetWindowBrightness()
slouken@7191
   744
 *
slouken@5466
   745
 *  \sa SDL_SetWindowBrightness()
slouken@5466
   746
 */
slouken@5466
   747
extern DECLSPEC float SDLCALL SDL_GetWindowBrightness(SDL_Window * window);
slouken@5466
   748
slouken@5466
   749
/**
slouken@5466
   750
 *  \brief Set the gamma ramp for a window.
slouken@7191
   751
 *
philipp@7188
   752
 *  \param window The window for which the gamma ramp should be set.
slouken@5466
   753
 *  \param red The translation table for the red channel, or NULL.
slouken@5466
   754
 *  \param green The translation table for the green channel, or NULL.
slouken@5466
   755
 *  \param blue The translation table for the blue channel, or NULL.
slouken@7191
   756
 *
slouken@5466
   757
 *  \return 0 on success, or -1 if gamma ramps are unsupported.
slouken@7191
   758
 *
slouken@5466
   759
 *  Set the gamma translation table for the red, green, and blue channels
slouken@5466
   760
 *  of the video hardware.  Each table is an array of 256 16-bit quantities,
slouken@5466
   761
 *  representing a mapping between the input and output for that channel.
slouken@5466
   762
 *  The input is the index into the array, and the output is the 16-bit
slouken@5466
   763
 *  gamma value at that index, scaled to the output color precision.
slouken@5466
   764
 *
slouken@5504
   765
 *  \sa SDL_GetWindowGammaRamp()
slouken@5466
   766
 */
slouken@5466
   767
extern DECLSPEC int SDLCALL SDL_SetWindowGammaRamp(SDL_Window * window,
slouken@5466
   768
                                                   const Uint16 * red,
slouken@5466
   769
                                                   const Uint16 * green,
slouken@5466
   770
                                                   const Uint16 * blue);
slouken@5466
   771
slouken@5466
   772
/**
slouken@5466
   773
 *  \brief Get the gamma ramp for a window.
slouken@7191
   774
 *
philipp@7188
   775
 *  \param window The window from which the gamma ramp should be queried.
slouken@7191
   776
 *  \param red   A pointer to a 256 element array of 16-bit quantities to hold
slouken@5466
   777
 *               the translation table for the red channel, or NULL.
slouken@7191
   778
 *  \param green A pointer to a 256 element array of 16-bit quantities to hold
slouken@5466
   779
 *               the translation table for the green channel, or NULL.
slouken@7191
   780
 *  \param blue  A pointer to a 256 element array of 16-bit quantities to hold
slouken@5466
   781
 *               the translation table for the blue channel, or NULL.
slouken@7191
   782
 *
slouken@5466
   783
 *  \return 0 on success, or -1 if gamma ramps are unsupported.
slouken@7191
   784
 *
slouken@5466
   785
 *  \sa SDL_SetWindowGammaRamp()
slouken@5466
   786
 */
slouken@5466
   787
extern DECLSPEC int SDLCALL SDL_GetWindowGammaRamp(SDL_Window * window,
slouken@5466
   788
                                                   Uint16 * red,
slouken@5466
   789
                                                   Uint16 * green,
slouken@5466
   790
                                                   Uint16 * blue);
slouken@5466
   791
slouken@5466
   792
/**
slouken@3407
   793
 *  \brief Destroy a window.
slouken@1895
   794
 */
slouken@3685
   795
extern DECLSPEC void SDLCALL SDL_DestroyWindow(SDL_Window * window);
slouken@1895
   796
slouken@0
   797
slouken@3025
   798
/**
slouken@4875
   799
 *  \brief Returns whether the screensaver is currently enabled (default on).
slouken@7191
   800
 *
slouken@3407
   801
 *  \sa SDL_EnableScreenSaver()
slouken@3407
   802
 *  \sa SDL_DisableScreenSaver()
slouken@3025
   803
 */
couriersud@3033
   804
extern DECLSPEC SDL_bool SDLCALL SDL_IsScreenSaverEnabled(void);
slouken@3025
   805
slouken@3025
   806
/**
slouken@3407
   807
 *  \brief Allow the screen to be blanked by a screensaver
slouken@7191
   808
 *
slouken@3407
   809
 *  \sa SDL_IsScreenSaverEnabled()
slouken@3407
   810
 *  \sa SDL_DisableScreenSaver()
slouken@3025
   811
 */
couriersud@3033
   812
extern DECLSPEC void SDLCALL SDL_EnableScreenSaver(void);
slouken@3025
   813
slouken@3025
   814
/**
slouken@3407
   815
 *  \brief Prevent the screen from being blanked by a screensaver
slouken@7191
   816
 *
slouken@3407
   817
 *  \sa SDL_IsScreenSaverEnabled()
slouken@3407
   818
 *  \sa SDL_EnableScreenSaver()
slouken@3025
   819
 */
couriersud@3033
   820
extern DECLSPEC void SDLCALL SDL_DisableScreenSaver(void);
slouken@3025
   821
slouken@0
   822
slouken@3407
   823
/**
slouken@3407
   824
 *  \name OpenGL support functions
slouken@3407
   825
 */
gabomdq@7678
   826
/* @{ */
slouken@0
   827
slouken@1895
   828
/**
slouken@3407
   829
 *  \brief Dynamically load an OpenGL library.
slouken@7191
   830
 *
slouken@7191
   831
 *  \param path The platform dependent OpenGL library name, or NULL to open the
slouken@3407
   832
 *              default OpenGL library.
slouken@7191
   833
 *
slouken@3407
   834
 *  \return 0 on success, or -1 if the library couldn't be loaded.
slouken@7191
   835
 *
slouken@3407
   836
 *  This should be done after initializing the video driver, but before
slouken@3407
   837
 *  creating any OpenGL windows.  If no OpenGL library is loaded, the default
slouken@3407
   838
 *  library will be loaded upon creation of the first OpenGL window.
slouken@7191
   839
 *
slouken@3407
   840
 *  \note If you do this, you need to retrieve all of the GL functions used in
slouken@3407
   841
 *        your program from the dynamic library using SDL_GL_GetProcAddress().
slouken@7191
   842
 *
slouken@3407
   843
 *  \sa SDL_GL_GetProcAddress()
slouken@3407
   844
 *  \sa SDL_GL_UnloadLibrary()
slouken@0
   845
 */
slouken@337
   846
extern DECLSPEC int SDLCALL SDL_GL_LoadLibrary(const char *path);
slouken@0
   847
slouken@1895
   848
/**
slouken@3407
   849
 *  \brief Get the address of an OpenGL function.
slouken@0
   850
 */
slouken@1895
   851
extern DECLSPEC void *SDLCALL SDL_GL_GetProcAddress(const char *proc);
slouken@0
   852
slouken@1895
   853
/**
slouken@3407
   854
 *  \brief Unload the OpenGL library previously loaded by SDL_GL_LoadLibrary().
slouken@7191
   855
 *
slouken@3407
   856
 *  \sa SDL_GL_LoadLibrary()
slouken@3057
   857
 */
slouken@3057
   858
extern DECLSPEC void SDLCALL SDL_GL_UnloadLibrary(void);
slouken@3057
   859
slouken@3057
   860
/**
slouken@7191
   861
 *  \brief Return true if an OpenGL extension is supported for the current
slouken@3407
   862
 *         context.
slouken@1926
   863
 */
slouken@1926
   864
extern DECLSPEC SDL_bool SDLCALL SDL_GL_ExtensionSupported(const char
slouken@1926
   865
                                                           *extension);
slouken@1926
   866
slouken@1926
   867
/**
slouken@3407
   868
 *  \brief Set an OpenGL window attribute before window creation.
slouken@0
   869
 */
slouken@337
   870
extern DECLSPEC int SDLCALL SDL_GL_SetAttribute(SDL_GLattr attr, int value);
slouken@0
   871
slouken@1895
   872
/**
slouken@3407
   873
 *  \brief Get the actual value for an attribute from the current context.
slouken@0
   874
 */
slouken@1936
   875
extern DECLSPEC int SDLCALL SDL_GL_GetAttribute(SDL_GLattr attr, int *value);
slouken@0
   876
slouken@1895
   877
/**
slouken@7191
   878
 *  \brief Create an OpenGL context for use with an OpenGL window, and make it
slouken@3407
   879
 *         current.
slouken@7191
   880
 *
slouken@3407
   881
 *  \sa SDL_GL_DeleteContext()
slouken@1895
   882
 */
slouken@3685
   883
extern DECLSPEC SDL_GLContext SDLCALL SDL_GL_CreateContext(SDL_Window *
slouken@3685
   884
                                                           window);
slouken@1895
   885
slouken@1895
   886
/**
slouken@3407
   887
 *  \brief Set up an OpenGL context for rendering into an OpenGL window.
slouken@7191
   888
 *
slouken@3407
   889
 *  \note The context must have been created with a compatible window.
slouken@1895
   890
 */
slouken@3685
   891
extern DECLSPEC int SDLCALL SDL_GL_MakeCurrent(SDL_Window * window,
slouken@1895
   892
                                               SDL_GLContext context);
slouken@1895
   893
slouken@1895
   894
/**
slouken@7412
   895
 *  \brief Get the currently active OpenGL window.
slouken@7412
   896
 */
slouken@7412
   897
extern DECLSPEC SDL_Window* SDLCALL SDL_GL_GetCurrentWindow(void);
slouken@7412
   898
slouken@7412
   899
/**
slouken@7412
   900
 *  \brief Get the currently active OpenGL context.
slouken@7412
   901
 */
slouken@7412
   902
extern DECLSPEC SDL_GLContext SDLCALL SDL_GL_GetCurrentContext(void);
slouken@7412
   903
slouken@7412
   904
/**
urkle@7746
   905
 *  \brief Get the size of a window's underlying drawable (for use with glViewport).
urkle@7746
   906
 *
philipp@7752
   907
 *  \param window   Window from which the drawable size should be queried
urkle@7746
   908
 *  \param w        Pointer to variable for storing the width, may be NULL
urkle@7746
   909
 *  \param h        Pointer to variable for storing the height, may be NULL
urkle@7746
   910
 *
urkle@7746
   911
 * This may differ from SDL_GetWindowSize if we're rendering to a high-DPI
urkle@7746
   912
 * drawable, i.e. the window was created with SDL_WINDOW_ALLOW_HIGHDPI on a
urkle@7746
   913
 * platform with high-DPI support (Apple calls this "Retina"), and not disabled
urkle@7746
   914
 * by the SDL_HINT_VIDEO_HIGHDPI_DISABLED hint.
urkle@7746
   915
 *
urkle@7746
   916
 *  \sa SDL_GetWindowSize()
urkle@7746
   917
 *  \sa SDL_CreateWindow()
urkle@7746
   918
 */
urkle@7746
   919
extern DECLSPEC void SDLCALL SDL_GL_GetDrawableSize(SDL_Window * window, int *w,
urkle@7746
   920
                                                    int *h);
urkle@7746
   921
urkle@7746
   922
/**
slouken@3407
   923
 *  \brief Set the swap interval for the current OpenGL context.
slouken@7191
   924
 *
slouken@3407
   925
 *  \param interval 0 for immediate updates, 1 for updates synchronized with the
icculus@6382
   926
 *                  vertical retrace. If the system supports it, you may
icculus@6382
   927
 *                  specify -1 to allow late swaps to happen immediately
icculus@6382
   928
 *                  instead of waiting for the next retrace.
slouken@7191
   929
 *
slouken@3407
   930
 *  \return 0 on success, or -1 if setting the swap interval is not supported.
slouken@7191
   931
 *
slouken@3407
   932
 *  \sa SDL_GL_GetSwapInterval()
slouken@1895
   933
 */
slouken@1895
   934
extern DECLSPEC int SDLCALL SDL_GL_SetSwapInterval(int interval);
slouken@1895
   935
slouken@1895
   936
/**
slouken@3407
   937
 *  \brief Get the swap interval for the current OpenGL context.
slouken@7191
   938
 *
slouken@7191
   939
 *  \return 0 if there is no vertical retrace synchronization, 1 if the buffer
icculus@6382
   940
 *          swap is synchronized with the vertical retrace, and -1 if late
icculus@6382
   941
 *          swaps happen immediately instead of waiting for the next retrace.
icculus@6382
   942
 *          If the system can't determine the swap interval, or there isn't a
icculus@6382
   943
 *          valid current context, this will return 0 as a safe default.
slouken@7191
   944
 *
slouken@3407
   945
 *  \sa SDL_GL_SetSwapInterval()
slouken@1895
   946
 */
slouken@1895
   947
extern DECLSPEC int SDLCALL SDL_GL_GetSwapInterval(void);
slouken@1895
   948
slouken@1895
   949
/**
slouken@7191
   950
 * \brief Swap the OpenGL buffers for a window, if double-buffering is
slouken@3407
   951
 *        supported.
slouken@0
   952
 */
slouken@3685
   953
extern DECLSPEC void SDLCALL SDL_GL_SwapWindow(SDL_Window * window);
slouken@0
   954
slouken@1895
   955
/**
slouken@3407
   956
 *  \brief Delete an OpenGL context.
slouken@7191
   957
 *
slouken@3407
   958
 *  \sa SDL_GL_CreateContext()
slouken@0
   959
 */
slouken@1895
   960
extern DECLSPEC void SDLCALL SDL_GL_DeleteContext(SDL_GLContext context);
slouken@0
   961
gabomdq@7678
   962
/* @} *//* OpenGL support functions */
slouken@3407
   963
slouken@0
   964
slouken@0
   965
/* Ends C function definitions when using C++ */
slouken@0
   966
#ifdef __cplusplus
slouken@0
   967
}
slouken@0
   968
#endif
slouken@0
   969
#include "close_code.h"
slouken@0
   970
slouken@0
   971
#endif /* _SDL_video_h */
slouken@1895
   972
slouken@1895
   973
/* vi: set ts=4 sw=4 expandtab: */