include/SDL_video.h
author stopiccot
Sun, 18 Nov 2012 15:45:12 +0300
changeset 6681 5a0396a933b5
parent 6429 ff5e34883bf8
child 6755 af77e1a6faf0
permissions -rw-r--r--
SetMinimumWindowSize for OS X
slouken@0
     1
/*
slouken@5535
     2
  Simple DirectMedia Layer
slouken@6138
     3
  Copyright (C) 1997-2012 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@3407
    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@1895
    39
/* *INDENT-OFF* */
slouken@0
    40
extern "C" {
slouken@1895
    41
/* *INDENT-ON* */
slouken@0
    42
#endif
slouken@0
    43
slouken@1895
    44
/**
slouken@3407
    45
 *  \brief  The structure that defines a display mode
slouken@3407
    46
 *  
slouken@3407
    47
 *  \sa SDL_GetNumDisplayModes()
slouken@3407
    48
 *  \sa SDL_GetDisplayMode()
slouken@3407
    49
 *  \sa SDL_GetDesktopDisplayMode()
slouken@3407
    50
 *  \sa SDL_GetCurrentDisplayMode()
slouken@3407
    51
 *  \sa SDL_GetClosestDisplayMode()
slouken@3500
    52
 *  \sa SDL_SetWindowDisplayMode()
slouken@3500
    53
 *  \sa SDL_GetWindowDisplayMode()
slouken@1895
    54
 */
slouken@1895
    55
typedef struct
slouken@1895
    56
{
slouken@1895
    57
    Uint32 format;              /**< pixel format */
slouken@1895
    58
    int w;                      /**< width */
slouken@1895
    59
    int h;                      /**< height */
slouken@1895
    60
    int refresh_rate;           /**< refresh rate (or zero for unspecified) */
slouken@1895
    61
    void *driverdata;           /**< driver-specific data, initialize to 0 */
slouken@1895
    62
} SDL_DisplayMode;
slouken@0
    63
slouken@1895
    64
/**
slouken@3407
    65
 *  \brief The type used to identify a window
slouken@3407
    66
 *  
slouken@3407
    67
 *  \sa SDL_CreateWindow()
slouken@3407
    68
 *  \sa SDL_CreateWindowFrom()
slouken@3407
    69
 *  \sa SDL_DestroyWindow()
slouken@3407
    70
 *  \sa SDL_GetWindowData()
slouken@3407
    71
 *  \sa SDL_GetWindowFlags()
slouken@3407
    72
 *  \sa SDL_GetWindowGrab()
slouken@3407
    73
 *  \sa SDL_GetWindowPosition()
slouken@3407
    74
 *  \sa SDL_GetWindowSize()
slouken@3407
    75
 *  \sa SDL_GetWindowTitle()
slouken@3407
    76
 *  \sa SDL_HideWindow()
slouken@3407
    77
 *  \sa SDL_MaximizeWindow()
slouken@3407
    78
 *  \sa SDL_MinimizeWindow()
slouken@3407
    79
 *  \sa SDL_RaiseWindow()
slouken@3407
    80
 *  \sa SDL_RestoreWindow()
slouken@3407
    81
 *  \sa SDL_SetWindowData()
slouken@3407
    82
 *  \sa SDL_SetWindowFullscreen()
slouken@3407
    83
 *  \sa SDL_SetWindowGrab()
slouken@3407
    84
 *  \sa SDL_SetWindowIcon()
slouken@3407
    85
 *  \sa SDL_SetWindowPosition()
slouken@3407
    86
 *  \sa SDL_SetWindowSize()
icculus@6429
    87
 *  \sa SDL_SetWindowBordered()
slouken@3407
    88
 *  \sa SDL_SetWindowTitle()
slouken@3407
    89
 *  \sa SDL_ShowWindow()
slouken@1895
    90
 */
slouken@3685
    91
typedef struct SDL_Window SDL_Window;
slouken@0
    92
slouken@1895
    93
/**
slouken@3407
    94
 *  \brief The flags on a window
slouken@3407
    95
 *  
slouken@3407
    96
 *  \sa SDL_GetWindowFlags()
slouken@1895
    97
 */
slouken@1895
    98
typedef enum
slouken@1895
    99
{
slouken@5380
   100
    SDL_WINDOW_FULLSCREEN = 0x00000001,         /**< fullscreen window */
slouken@1895
   101
    SDL_WINDOW_OPENGL = 0x00000002,             /**< window usable with OpenGL context */
slouken@1895
   102
    SDL_WINDOW_SHOWN = 0x00000004,              /**< window is visible */
slouken@5380
   103
    SDL_WINDOW_HIDDEN = 0x00000008,             /**< window is not visible */
slouken@5380
   104
    SDL_WINDOW_BORDERLESS = 0x00000010,         /**< no window decoration */
slouken@5380
   105
    SDL_WINDOW_RESIZABLE = 0x00000020,          /**< window can be resized */
slouken@5380
   106
    SDL_WINDOW_MINIMIZED = 0x00000040,          /**< window is minimized */
slouken@5380
   107
    SDL_WINDOW_MAXIMIZED = 0x00000080,          /**< window is maximized */
slouken@1895
   108
    SDL_WINDOW_INPUT_GRABBED = 0x00000100,      /**< window has grabbed input focus */
slouken@1895
   109
    SDL_WINDOW_INPUT_FOCUS = 0x00000200,        /**< window has input focus */
slouken@3057
   110
    SDL_WINDOW_MOUSE_FOCUS = 0x00000400,        /**< window has mouse focus */
slouken@3057
   111
    SDL_WINDOW_FOREIGN = 0x00000800             /**< window not created by SDL */
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@3407
   140
    SDL_WINDOWEVENT_EXPOSED,        /**< Window has been exposed and should be 
slouken@3407
   141
                                         redrawn */
slouken@3407
   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@3407
   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,
slouken@6394
   197
    SDL_GL_CONTEXT_PROFILE_ES             = 0x0004
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@3407
   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@3407
   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@3407
   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@3407
   230
 *  
slouken@3407
   231
 *  \param driver_name Initialize a specific driver by name, or NULL for the 
slouken@3407
   232
 *                     default video driver.
slouken@3407
   233
 *  
slouken@3407
   234
 *  \return 0 on success, -1 on error
slouken@3407
   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@3407
   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@3407
   246
 *  
slouken@3407
   247
 *  This function closes all windows, and restores the original video mode.
slouken@3407
   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@3407
   255
 *  
slouken@3407
   256
 *  \return The name of the current video driver or NULL if no driver
slouken@3407
   257
 *          has been initialized
slouken@3407
   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@3407
   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@3528
   272
 *  \brief Get the desktop area represented by a display, with the primary
slouken@3528
   273
 *         display located at 0,0
slouken@3528
   274
 *  
slouken@3528
   275
 *  \return 0 on success, or -1 if the index is out of range.
slouken@3528
   276
 *  
slouken@3528
   277
 *  \sa SDL_GetNumVideoDisplays()
slouken@3528
   278
 */
slouken@5244
   279
extern DECLSPEC int SDLCALL SDL_GetDisplayBounds(int displayIndex, SDL_Rect * rect);
slouken@3528
   280
slouken@3528
   281
/**
slouken@5244
   282
 *  \brief Returns the number of available display modes.
slouken@3407
   283
 *  
slouken@3407
   284
 *  \sa SDL_GetDisplayMode()
slouken@0
   285
 */
slouken@5244
   286
extern DECLSPEC int SDLCALL SDL_GetNumDisplayModes(int displayIndex);
slouken@0
   287
slouken@1895
   288
/**
slouken@3407
   289
 *  \brief Fill in information about a specific display mode.
slouken@3407
   290
 *  
slouken@3407
   291
 *  \note The display modes are sorted in this priority:
slouken@3407
   292
 *        \li bits per pixel -> more colors to fewer colors
slouken@3407
   293
 *        \li width -> largest to smallest
slouken@3407
   294
 *        \li height -> largest to smallest
slouken@3407
   295
 *        \li refresh rate -> highest to lowest
slouken@3407
   296
 *  
slouken@3407
   297
 *  \sa SDL_GetNumDisplayModes()
slouken@0
   298
 */
slouken@5244
   299
extern DECLSPEC int SDLCALL SDL_GetDisplayMode(int displayIndex, int modeIndex,
slouken@1967
   300
                                               SDL_DisplayMode * mode);
slouken@0
   301
slouken@1895
   302
/**
slouken@5244
   303
 *  \brief Fill in information about the desktop display mode.
slouken@1895
   304
 */
slouken@5244
   305
extern DECLSPEC int SDLCALL SDL_GetDesktopDisplayMode(int displayIndex, SDL_DisplayMode * mode);
slouken@1895
   306
slouken@1895
   307
/**
slouken@3407
   308
 *  \brief Fill in information about the current display mode.
slouken@1895
   309
 */
slouken@5244
   310
extern DECLSPEC int SDLCALL SDL_GetCurrentDisplayMode(int displayIndex, SDL_DisplayMode * mode);
slouken@1895
   311
slouken@3400
   312
slouken@1895
   313
/**
slouken@3407
   314
 *  \brief Get the closest match to the requested display mode.
slouken@3407
   315
 *  
slouken@3407
   316
 *  \param mode The desired display mode
slouken@3407
   317
 *  \param closest A pointer to a display mode to be filled in with the closest 
slouken@3407
   318
 *                 match of the available display modes.
slouken@3407
   319
 *  
slouken@3407
   320
 *  \return The passed in value \c closest, or NULL if no matching video mode 
slouken@3407
   321
 *          was available.
slouken@3407
   322
 *  
slouken@3407
   323
 *  The available display modes are scanned, and \c closest is filled in with the
slouken@3407
   324
 *  closest mode matching the requested mode and returned.  The mode format and 
slouken@3407
   325
 *  refresh_rate default to the desktop mode if they are 0.  The modes are 
slouken@3407
   326
 *  scanned with size being first priority, format being second priority, and 
slouken@3407
   327
 *  finally checking the refresh_rate.  If all the available modes are too 
slouken@3407
   328
 *  small, then NULL is returned.
slouken@3407
   329
 *  
slouken@3407
   330
 *  \sa SDL_GetNumDisplayModes()
slouken@3407
   331
 *  \sa SDL_GetDisplayMode()
slouken@1895
   332
 */
slouken@5244
   333
extern DECLSPEC SDL_DisplayMode * SDLCALL SDL_GetClosestDisplayMode(int displayIndex, const SDL_DisplayMode * mode, SDL_DisplayMode * closest);
slouken@1895
   334
slouken@1895
   335
/**
slouken@5246
   336
 *  \brief Get the display index associated with a window.
slouken@5246
   337
 *  
slouken@5246
   338
 *  \return the display index of the display containing the center of the
slouken@5246
   339
 *          window, or -1 on error.
slouken@5246
   340
 */
slouken@5246
   341
extern DECLSPEC int SDLCALL SDL_GetWindowDisplay(SDL_Window * window);
slouken@5246
   342
slouken@5246
   343
/**
slouken@5244
   344
 *  \brief Set the display mode used when a fullscreen window is visible.
slouken@5244
   345
 *
slouken@5244
   346
 *  By default the window's dimensions and the desktop format and refresh rate
slouken@5244
   347
 *  are used.
slouken@3407
   348
 *  
slouken@3500
   349
 *  \param mode The mode to use, or NULL for the default mode.
slouken@3407
   350
 *  
slouken@3407
   351
 *  \return 0 on success, or -1 if setting the display mode failed.
slouken@3407
   352
 *  
slouken@3522
   353
 *  \sa SDL_GetWindowDisplayMode()
slouken@3407
   354
 *  \sa SDL_SetWindowFullscreen()
slouken@0
   355
 */
slouken@3685
   356
extern DECLSPEC int SDLCALL SDL_SetWindowDisplayMode(SDL_Window * window,
slouken@3500
   357
                                                     const SDL_DisplayMode
slouken@1895
   358
                                                         * mode);
slouken@0
   359
slouken@1895
   360
/**
slouken@3407
   361
 *  \brief Fill in information about the display mode used when a fullscreen
slouken@5244
   362
 *         window is visible.
slouken@3522
   363
 *
slouken@3522
   364
 *  \sa SDL_SetWindowDisplayMode()
slouken@3522
   365
 *  \sa SDL_SetWindowFullscreen()
slouken@0
   366
 */
slouken@3685
   367
extern DECLSPEC int SDLCALL SDL_GetWindowDisplayMode(SDL_Window * window,
slouken@3500
   368
                                                     SDL_DisplayMode * mode);
slouken@0
   369
slouken@1895
   370
/**
slouken@5154
   371
 *  \brief Get the pixel format associated with the window.
slouken@5154
   372
 */
slouken@5154
   373
extern DECLSPEC Uint32 SDLCALL SDL_GetWindowPixelFormat(SDL_Window * window);
slouken@5154
   374
slouken@5154
   375
/**
slouken@3407
   376
 *  \brief Create a window with the specified position, dimensions, and flags.
slouken@3407
   377
 *  
slouken@3407
   378
 *  \param title The title of the window, in UTF-8 encoding.
slouken@3407
   379
 *  \param x     The x position of the window, ::SDL_WINDOWPOS_CENTERED, or 
slouken@3407
   380
 *               ::SDL_WINDOWPOS_UNDEFINED.
slouken@3407
   381
 *  \param y     The y position of the window, ::SDL_WINDOWPOS_CENTERED, or 
slouken@3407
   382
 *               ::SDL_WINDOWPOS_UNDEFINED.
slouken@3407
   383
 *  \param w     The width of the window.
slouken@3407
   384
 *  \param h     The height of the window.
slouken@3407
   385
 *  \param flags The flags for the window, a mask of any of the following: 
slouken@3407
   386
 *               ::SDL_WINDOW_FULLSCREEN, ::SDL_WINDOW_OPENGL, 
slouken@3407
   387
 *               ::SDL_WINDOW_SHOWN,      ::SDL_WINDOW_BORDERLESS, 
slouken@3407
   388
 *               ::SDL_WINDOW_RESIZABLE,  ::SDL_WINDOW_MAXIMIZED, 
slouken@3407
   389
 *               ::SDL_WINDOW_MINIMIZED,  ::SDL_WINDOW_INPUT_GRABBED.
slouken@3407
   390
 *  
slouken@3407
   391
 *  \return The id of the window created, or zero if window creation failed.
slouken@3407
   392
 *  
slouken@3407
   393
 *  \sa SDL_DestroyWindow()
slouken@0
   394
 */
slouken@3685
   395
extern DECLSPEC SDL_Window * SDLCALL SDL_CreateWindow(const char *title,
slouken@1895
   396
                                                      int x, int y, int w,
slouken@1895
   397
                                                      int h, Uint32 flags);
slouken@0
   398
slouken@1895
   399
/**
slouken@3493
   400
 *  \brief Create an SDL window from an existing native window.
slouken@3407
   401
 *  
slouken@3407
   402
 *  \param data A pointer to driver-dependent window creation data
slouken@3407
   403
 *  
slouken@3407
   404
 *  \return The id of the window created, or zero if window creation failed.
slouken@3407
   405
 *  
slouken@3407
   406
 *  \sa SDL_DestroyWindow()
slouken@0
   407
 */
slouken@3685
   408
extern DECLSPEC SDL_Window * SDLCALL SDL_CreateWindowFrom(const void *data);
slouken@3685
   409
slouken@3685
   410
/**
slouken@4883
   411
 *  \brief Get the numeric ID of a window, for logging purposes.
slouken@3685
   412
 */
slouken@3685
   413
extern DECLSPEC Uint32 SDLCALL SDL_GetWindowID(SDL_Window * window);
slouken@3685
   414
slouken@3685
   415
/**
slouken@3685
   416
 *  \brief Get a window from a stored ID, or NULL if it doesn't exist.
slouken@3685
   417
 */
slouken@3685
   418
extern DECLSPEC SDL_Window * SDLCALL SDL_GetWindowFromID(Uint32 id);
slouken@1895
   419
slouken@1895
   420
/**
slouken@3407
   421
 *  \brief Get the window flags.
slouken@1895
   422
 */
slouken@3685
   423
extern DECLSPEC Uint32 SDLCALL SDL_GetWindowFlags(SDL_Window * window);
slouken@1895
   424
slouken@1895
   425
/**
slouken@4883
   426
 *  \brief Set the title of a window, in UTF-8 format.
slouken@3407
   427
 *  
slouken@3407
   428
 *  \sa SDL_GetWindowTitle()
slouken@1895
   429
 */
slouken@3685
   430
extern DECLSPEC void SDLCALL SDL_SetWindowTitle(SDL_Window * window,
slouken@1895
   431
                                                const char *title);
slouken@1895
   432
slouken@1895
   433
/**
slouken@4883
   434
 *  \brief Get the title of a window, in UTF-8 format.
slouken@3407
   435
 *  
slouken@3407
   436
 *  \sa SDL_SetWindowTitle()
slouken@1895
   437
 */
slouken@3685
   438
extern DECLSPEC const char *SDLCALL SDL_GetWindowTitle(SDL_Window * window);
slouken@1895
   439
slouken@1895
   440
/**
slouken@4887
   441
 *  \brief Set the icon for a window.
slouken@3407
   442
 *  
slouken@4887
   443
 *  \param icon The icon for the window.
slouken@1895
   444
 */
slouken@3685
   445
extern DECLSPEC void SDLCALL SDL_SetWindowIcon(SDL_Window * window,
slouken@2990
   446
                                               SDL_Surface * icon);
slouken@1895
   447
slouken@1895
   448
/**
slouken@5165
   449
 *  \brief Associate an arbitrary named pointer with a window.
slouken@3407
   450
 *  
slouken@5165
   451
 *  \param window   The window to associate with the pointer.
slouken@5165
   452
 *  \param name     The name of the pointer.
slouken@5165
   453
 *  \param userdata The associated pointer.
slouken@5165
   454
 *
slouken@5165
   455
 *  \return The previous value associated with 'name'
slouken@5165
   456
 *
slouken@5165
   457
 *  \note The name is case-sensitive.
slouken@5165
   458
 *
slouken@3407
   459
 *  \sa SDL_GetWindowData()
slouken@1895
   460
 */
slouken@5165
   461
extern DECLSPEC void* SDLCALL SDL_SetWindowData(SDL_Window * window,
slouken@5165
   462
                                                const char *name,
slouken@5165
   463
                                                void *userdata);
slouken@1895
   464
slouken@1895
   465
/**
slouken@4883
   466
 *  \brief Retrieve the data pointer associated with a window.
slouken@3407
   467
 *  
slouken@5165
   468
 *  \param window   The window to query.
slouken@5165
   469
 *  \param name     The name of the pointer.
slouken@5165
   470
 *
slouken@5165
   471
 *  \return The value associated with 'name'
slouken@5165
   472
 *  
slouken@3407
   473
 *  \sa SDL_SetWindowData()
slouken@1895
   474
 */
slouken@5165
   475
extern DECLSPEC void *SDLCALL SDL_GetWindowData(SDL_Window * window,
slouken@5165
   476
                                                const char *name);
slouken@1895
   477
slouken@1895
   478
/**
slouken@4883
   479
 *  \brief Set the position of a window.
slouken@3407
   480
 *  
slouken@5165
   481
 *  \param window   The window to reposition.
slouken@3407
   482
 *  \param x        The x coordinate of the window, ::SDL_WINDOWPOS_CENTERED, or
slouken@3407
   483
                    ::SDL_WINDOWPOS_UNDEFINED.
slouken@3407
   484
 *  \param y        The y coordinate of the window, ::SDL_WINDOWPOS_CENTERED, or
slouken@3407
   485
                    ::SDL_WINDOWPOS_UNDEFINED.
slouken@3407
   486
 *  
slouken@3407
   487
 *  \note The window coordinate origin is the upper left of the display.
slouken@3407
   488
 *  
slouken@3407
   489
 *  \sa SDL_GetWindowPosition()
slouken@1895
   490
 */
slouken@3685
   491
extern DECLSPEC void SDLCALL SDL_SetWindowPosition(SDL_Window * window,
slouken@1895
   492
                                                   int x, int y);
slouken@1895
   493
slouken@1895
   494
/**
slouken@4883
   495
 *  \brief Get the position of a window.
slouken@3407
   496
 *  
slouken@3407
   497
 *  \sa SDL_SetWindowPosition()
slouken@1895
   498
 */
slouken@3685
   499
extern DECLSPEC void SDLCALL SDL_GetWindowPosition(SDL_Window * window,
slouken@1895
   500
                                                   int *x, int *y);
slouken@1895
   501
slouken@1895
   502
/**
slouken@4883
   503
 *  \brief Set the size of a window's client area.
slouken@3407
   504
 *  
slouken@3407
   505
 *  \note You can't change the size of a fullscreen window, it automatically
slouken@3407
   506
 *        matches the size of the display mode.
slouken@3407
   507
 *  
slouken@3407
   508
 *  \sa SDL_GetWindowSize()
slouken@1895
   509
 */
slouken@3685
   510
extern DECLSPEC void SDLCALL SDL_SetWindowSize(SDL_Window * window, int w,
slouken@1895
   511
                                               int h);
slouken@1895
   512
slouken@1895
   513
/**
slouken@4883
   514
 *  \brief Get the size of a window's client area.
slouken@3407
   515
 *  
slouken@3407
   516
 *  \sa SDL_SetWindowSize()
slouken@1895
   517
 */
slouken@3685
   518
extern DECLSPEC void SDLCALL SDL_GetWindowSize(SDL_Window * window, int *w,
slouken@1895
   519
                                               int *h);
stopiccot@6681
   520
    
stopiccot@6681
   521
/**
stopiccot@6681
   522
 *  \brief Set the minimum size of a window's client area.
stopiccot@6681
   523
 *
stopiccot@6681
   524
 *  \note You can't change the minimum size of a fullscreen window, it
stopiccot@6681
   525
 *        automatically matches the size of the display mode.
stopiccot@6681
   526
 *
stopiccot@6681
   527
 *  \sa SDL_GetWindowMinimumSize()
stopiccot@6681
   528
 */
stopiccot@6681
   529
extern DECLSPEC void SDLCALL SDL_SetWindowMinimumSize(SDL_Window * window,
stopiccot@6681
   530
                                                      int min_w, int min_h);
stopiccot@6681
   531
    
stopiccot@6681
   532
/**
stopiccot@6681
   533
 *  \brief Get the minimum size of a window's client area.
stopiccot@6681
   534
 *
stopiccot@6681
   535
 *  \sa SDL_SetWindowMinimumSize()
stopiccot@6681
   536
 */
stopiccot@6681
   537
extern DECLSPEC void SDLCALL SDL_GetWindowMinimumSize(SDL_Window * window,
stopiccot@6681
   538
                                                      int *w, int *h);
slouken@1895
   539
slouken@1895
   540
/**
icculus@6422
   541
 *  \brief Set the border state of a window.
icculus@6422
   542
 *
icculus@6422
   543
 *  This will add or remove the window's SDL_WINDOW_BORDERLESS flag and
icculus@6422
   544
 *  add or remove the border from the actual window. This is a no-op if the
icculus@6422
   545
 *  window's border already matches the requested state.
icculus@6422
   546
 *
icculus@6422
   547
 *  \param window The window of which to change the border state.
icculus@6422
   548
 *  \param bordered SDL_FALSE to remove border, SDL_TRUE to add border.
icculus@6422
   549
 *
icculus@6422
   550
 *  \note You can't change the border state of a fullscreen window.
icculus@6422
   551
 *  
icculus@6422
   552
 *  \sa SDL_GetWindowFlags()
icculus@6422
   553
 */
icculus@6422
   554
extern DECLSPEC void SDLCALL SDL_SetWindowBordered(SDL_Window * window,
icculus@6422
   555
                                                   SDL_bool bordered);
icculus@6422
   556
icculus@6422
   557
/**
slouken@4883
   558
 *  \brief Show a window.
slouken@3407
   559
 *  
slouken@3407
   560
 *  \sa SDL_HideWindow()
slouken@1895
   561
 */
slouken@3685
   562
extern DECLSPEC void SDLCALL SDL_ShowWindow(SDL_Window * window);
slouken@1895
   563
slouken@1895
   564
/**
slouken@4883
   565
 *  \brief Hide a window.
slouken@3407
   566
 *  
slouken@3407
   567
 *  \sa SDL_ShowWindow()
slouken@1895
   568
 */
slouken@3685
   569
extern DECLSPEC void SDLCALL SDL_HideWindow(SDL_Window * window);
slouken@1895
   570
slouken@1895
   571
/**
slouken@4883
   572
 *  \brief Raise a window above other windows and set the input focus.
slouken@1895
   573
 */
slouken@3685
   574
extern DECLSPEC void SDLCALL SDL_RaiseWindow(SDL_Window * window);
slouken@1895
   575
slouken@1895
   576
/**
slouken@4883
   577
 *  \brief Make a window as large as possible.
slouken@3407
   578
 *  
slouken@3407
   579
 *  \sa SDL_RestoreWindow()
slouken@1895
   580
 */
slouken@3685
   581
extern DECLSPEC void SDLCALL SDL_MaximizeWindow(SDL_Window * window);
slouken@1895
   582
slouken@1895
   583
/**
slouken@4883
   584
 *  \brief Minimize a window to an iconic representation.
slouken@3407
   585
 *  
slouken@3407
   586
 *  \sa SDL_RestoreWindow()
slouken@1895
   587
 */
slouken@3685
   588
extern DECLSPEC void SDLCALL SDL_MinimizeWindow(SDL_Window * window);
slouken@1895
   589
slouken@1895
   590
/**
slouken@3407
   591
 *  \brief Restore the size and position of a minimized or maximized window.
slouken@3407
   592
 *  
slouken@3407
   593
 *  \sa SDL_MaximizeWindow()
slouken@3407
   594
 *  \sa SDL_MinimizeWindow()
slouken@1895
   595
 */
slouken@3685
   596
extern DECLSPEC void SDLCALL SDL_RestoreWindow(SDL_Window * window);
slouken@1895
   597
slouken@1895
   598
/**
slouken@4883
   599
 *  \brief Set a window's fullscreen state.
slouken@3407
   600
 *  
slouken@3407
   601
 *  \return 0 on success, or -1 if setting the display mode failed.
slouken@3407
   602
 *  
slouken@3522
   603
 *  \sa SDL_SetWindowDisplayMode()
slouken@3522
   604
 *  \sa SDL_GetWindowDisplayMode()
slouken@1895
   605
 */
slouken@3685
   606
extern DECLSPEC int SDLCALL SDL_SetWindowFullscreen(SDL_Window * window,
slouken@5246
   607
                                                    SDL_bool fullscreen);
slouken@1895
   608
slouken@1895
   609
/**
slouken@5546
   610
 *  \brief Get the SDL surface associated with the window.
slouken@5166
   611
 *
slouken@5546
   612
 *  \return The window's framebuffer surface, or NULL on error. 
slouken@5546
   613
 *
slouken@5546
   614
 *  A new surface will be created with the optimal format for the window,
slouken@5546
   615
 *  if necessary. This surface will be freed when the window is destroyed.
slouken@5166
   616
 *
slouken@5166
   617
 *  \note You may not combine this with 3D or the rendering API on this window.
slouken@5166
   618
 *
slouken@5166
   619
 *  \sa SDL_UpdateWindowSurface()
slouken@5166
   620
 *  \sa SDL_UpdateWindowSurfaceRects()
slouken@5166
   621
 */
slouken@5166
   622
extern DECLSPEC SDL_Surface * SDLCALL SDL_GetWindowSurface(SDL_Window * window);
slouken@5166
   623
slouken@5166
   624
/**
slouken@5166
   625
 *  \brief Copy the window surface to the screen.
slouken@5166
   626
 *
slouken@5166
   627
 *  \return 0 on success, or -1 on error.
slouken@5166
   628
 *
slouken@5166
   629
 *  \sa SDL_GetWindowSurface()
slouken@5166
   630
 *  \sa SDL_UpdateWindowSurfaceRects()
slouken@5166
   631
 */
slouken@5166
   632
extern DECLSPEC int SDLCALL SDL_UpdateWindowSurface(SDL_Window * window);
slouken@5166
   633
slouken@5166
   634
/**
slouken@5166
   635
 *  \brief Copy a number of rectangles on the window surface to the screen.
slouken@5166
   636
 *
slouken@5166
   637
 *  \return 0 on success, or -1 on error.
slouken@5166
   638
 *
slouken@5166
   639
 *  \sa SDL_GetWindowSurface()
slouken@5166
   640
 *  \sa SDL_UpdateWindowSurfaceRect()
slouken@5166
   641
 */
slouken@5166
   642
extern DECLSPEC int SDLCALL SDL_UpdateWindowSurfaceRects(SDL_Window * window,
slouken@5297
   643
                                                         SDL_Rect * rects,
slouken@5297
   644
                                                         int numrects);
slouken@5166
   645
slouken@5166
   646
/**
slouken@4883
   647
 *  \brief Set a window's input grab mode.
slouken@3407
   648
 *  
slouken@5403
   649
 *  \param grabbed This is SDL_TRUE to grab input, and SDL_FALSE to release input.
slouken@3407
   650
 *  
slouken@3407
   651
 *  \sa SDL_GetWindowGrab()
slouken@1895
   652
 */
slouken@3685
   653
extern DECLSPEC void SDLCALL SDL_SetWindowGrab(SDL_Window * window,
slouken@5403
   654
                                               SDL_bool grabbed);
slouken@1895
   655
slouken@1895
   656
/**
slouken@4883
   657
 *  \brief Get a window's input grab mode.
slouken@3407
   658
 *  
slouken@5403
   659
 *  \return This returns SDL_TRUE if input is grabbed, and SDL_FALSE otherwise.
slouken@3407
   660
 *  
slouken@3407
   661
 *  \sa SDL_SetWindowGrab()
slouken@1895
   662
 */
slouken@5403
   663
extern DECLSPEC SDL_bool SDLCALL SDL_GetWindowGrab(SDL_Window * window);
slouken@1895
   664
slouken@1895
   665
/**
slouken@5466
   666
 *  \brief Set the brightness (gamma correction) for a window.
slouken@5466
   667
 *  
slouken@5466
   668
 *  \return 0 on success, or -1 if setting the brightness isn't supported.
slouken@5466
   669
 *  
slouken@5466
   670
 *  \sa SDL_GetWindowBrightness()
slouken@5466
   671
 *  \sa SDL_SetWindowGammaRamp()
slouken@5466
   672
 */
slouken@5466
   673
extern DECLSPEC int SDLCALL SDL_SetWindowBrightness(SDL_Window * window, float brightness);
slouken@5466
   674
slouken@5466
   675
/**
slouken@5466
   676
 *  \brief Get the brightness (gamma correction) for a window.
slouken@5466
   677
 *  
slouken@5466
   678
 *  \return The last brightness value passed to SDL_SetWindowBrightness()
slouken@5466
   679
 *  
slouken@5466
   680
 *  \sa SDL_SetWindowBrightness()
slouken@5466
   681
 */
slouken@5466
   682
extern DECLSPEC float SDLCALL SDL_GetWindowBrightness(SDL_Window * window);
slouken@5466
   683
slouken@5466
   684
/**
slouken@5466
   685
 *  \brief Set the gamma ramp for a window.
slouken@5466
   686
 *  
slouken@5466
   687
 *  \param red The translation table for the red channel, or NULL.
slouken@5466
   688
 *  \param green The translation table for the green channel, or NULL.
slouken@5466
   689
 *  \param blue The translation table for the blue channel, or NULL.
slouken@5466
   690
 *  
slouken@5466
   691
 *  \return 0 on success, or -1 if gamma ramps are unsupported.
slouken@5466
   692
 *  
slouken@5466
   693
 *  Set the gamma translation table for the red, green, and blue channels
slouken@5466
   694
 *  of the video hardware.  Each table is an array of 256 16-bit quantities,
slouken@5466
   695
 *  representing a mapping between the input and output for that channel.
slouken@5466
   696
 *  The input is the index into the array, and the output is the 16-bit
slouken@5466
   697
 *  gamma value at that index, scaled to the output color precision.
slouken@5466
   698
 *
slouken@5504
   699
 *  \sa SDL_GetWindowGammaRamp()
slouken@5466
   700
 */
slouken@5466
   701
extern DECLSPEC int SDLCALL SDL_SetWindowGammaRamp(SDL_Window * window,
slouken@5466
   702
                                                   const Uint16 * red,
slouken@5466
   703
                                                   const Uint16 * green,
slouken@5466
   704
                                                   const Uint16 * blue);
slouken@5466
   705
slouken@5466
   706
/**
slouken@5466
   707
 *  \brief Get the gamma ramp for a window.
slouken@5466
   708
 *  
slouken@5466
   709
 *  \param red   A pointer to a 256 element array of 16-bit quantities to hold 
slouken@5466
   710
 *               the translation table for the red channel, or NULL.
slouken@5466
   711
 *  \param green A pointer to a 256 element array of 16-bit quantities to hold 
slouken@5466
   712
 *               the translation table for the green channel, or NULL.
slouken@5466
   713
 *  \param blue  A pointer to a 256 element array of 16-bit quantities to hold 
slouken@5466
   714
 *               the translation table for the blue channel, or NULL.
slouken@5466
   715
 *   
slouken@5466
   716
 *  \return 0 on success, or -1 if gamma ramps are unsupported.
slouken@5466
   717
 *  
slouken@5466
   718
 *  \sa SDL_SetWindowGammaRamp()
slouken@5466
   719
 */
slouken@5466
   720
extern DECLSPEC int SDLCALL SDL_GetWindowGammaRamp(SDL_Window * window,
slouken@5466
   721
                                                   Uint16 * red,
slouken@5466
   722
                                                   Uint16 * green,
slouken@5466
   723
                                                   Uint16 * blue);
slouken@5466
   724
slouken@5466
   725
/**
slouken@3407
   726
 *  \brief Destroy a window.
slouken@1895
   727
 */
slouken@3685
   728
extern DECLSPEC void SDLCALL SDL_DestroyWindow(SDL_Window * window);
slouken@1895
   729
slouken@0
   730
slouken@3025
   731
/**
slouken@4875
   732
 *  \brief Returns whether the screensaver is currently enabled (default on).
slouken@3407
   733
 *  
slouken@3407
   734
 *  \sa SDL_EnableScreenSaver()
slouken@3407
   735
 *  \sa SDL_DisableScreenSaver()
slouken@3025
   736
 */
couriersud@3033
   737
extern DECLSPEC SDL_bool SDLCALL SDL_IsScreenSaverEnabled(void);
slouken@3025
   738
slouken@3025
   739
/**
slouken@3407
   740
 *  \brief Allow the screen to be blanked by a screensaver
slouken@3407
   741
 *  
slouken@3407
   742
 *  \sa SDL_IsScreenSaverEnabled()
slouken@3407
   743
 *  \sa SDL_DisableScreenSaver()
slouken@3025
   744
 */
couriersud@3033
   745
extern DECLSPEC void SDLCALL SDL_EnableScreenSaver(void);
slouken@3025
   746
slouken@3025
   747
/**
slouken@3407
   748
 *  \brief Prevent the screen from being blanked by a screensaver
slouken@3407
   749
 *  
slouken@3407
   750
 *  \sa SDL_IsScreenSaverEnabled()
slouken@3407
   751
 *  \sa SDL_EnableScreenSaver()
slouken@3025
   752
 */
couriersud@3033
   753
extern DECLSPEC void SDLCALL SDL_DisableScreenSaver(void);
slouken@3025
   754
slouken@0
   755
slouken@3407
   756
/**
slouken@3407
   757
 *  \name OpenGL support functions
slouken@3407
   758
 */
slouken@3407
   759
/*@{*/
slouken@0
   760
slouken@1895
   761
/**
slouken@3407
   762
 *  \brief Dynamically load an OpenGL library.
slouken@3407
   763
 *  
slouken@3407
   764
 *  \param path The platform dependent OpenGL library name, or NULL to open the 
slouken@3407
   765
 *              default OpenGL library.
slouken@3407
   766
 *  
slouken@3407
   767
 *  \return 0 on success, or -1 if the library couldn't be loaded.
slouken@3407
   768
 *  
slouken@3407
   769
 *  This should be done after initializing the video driver, but before
slouken@3407
   770
 *  creating any OpenGL windows.  If no OpenGL library is loaded, the default
slouken@3407
   771
 *  library will be loaded upon creation of the first OpenGL window.
slouken@3407
   772
 *  
slouken@3407
   773
 *  \note If you do this, you need to retrieve all of the GL functions used in
slouken@3407
   774
 *        your program from the dynamic library using SDL_GL_GetProcAddress().
slouken@3407
   775
 *  
slouken@3407
   776
 *  \sa SDL_GL_GetProcAddress()
slouken@3407
   777
 *  \sa SDL_GL_UnloadLibrary()
slouken@0
   778
 */
slouken@337
   779
extern DECLSPEC int SDLCALL SDL_GL_LoadLibrary(const char *path);
slouken@0
   780
slouken@1895
   781
/**
slouken@3407
   782
 *  \brief Get the address of an OpenGL function.
slouken@0
   783
 */
slouken@1895
   784
extern DECLSPEC void *SDLCALL SDL_GL_GetProcAddress(const char *proc);
slouken@0
   785
slouken@1895
   786
/**
slouken@3407
   787
 *  \brief Unload the OpenGL library previously loaded by SDL_GL_LoadLibrary().
slouken@3407
   788
 *  
slouken@3407
   789
 *  \sa SDL_GL_LoadLibrary()
slouken@3057
   790
 */
slouken@3057
   791
extern DECLSPEC void SDLCALL SDL_GL_UnloadLibrary(void);
slouken@3057
   792
slouken@3057
   793
/**
slouken@3407
   794
 *  \brief Return true if an OpenGL extension is supported for the current 
slouken@3407
   795
 *         context.
slouken@1926
   796
 */
slouken@1926
   797
extern DECLSPEC SDL_bool SDLCALL SDL_GL_ExtensionSupported(const char
slouken@1926
   798
                                                           *extension);
slouken@1926
   799
slouken@1926
   800
/**
slouken@3407
   801
 *  \brief Set an OpenGL window attribute before window creation.
slouken@0
   802
 */
slouken@337
   803
extern DECLSPEC int SDLCALL SDL_GL_SetAttribute(SDL_GLattr attr, int value);
slouken@0
   804
slouken@1895
   805
/**
slouken@3407
   806
 *  \brief Get the actual value for an attribute from the current context.
slouken@0
   807
 */
slouken@1936
   808
extern DECLSPEC int SDLCALL SDL_GL_GetAttribute(SDL_GLattr attr, int *value);
slouken@0
   809
slouken@1895
   810
/**
slouken@3407
   811
 *  \brief Create an OpenGL context for use with an OpenGL window, and make it 
slouken@3407
   812
 *         current.
slouken@3407
   813
 *  
slouken@3407
   814
 *  \sa SDL_GL_DeleteContext()
slouken@1895
   815
 */
slouken@3685
   816
extern DECLSPEC SDL_GLContext SDLCALL SDL_GL_CreateContext(SDL_Window *
slouken@3685
   817
                                                           window);
slouken@1895
   818
slouken@1895
   819
/**
slouken@3407
   820
 *  \brief Set up an OpenGL context for rendering into an OpenGL window.
slouken@3407
   821
 *  
slouken@3407
   822
 *  \note The context must have been created with a compatible window.
slouken@1895
   823
 */
slouken@3685
   824
extern DECLSPEC int SDLCALL SDL_GL_MakeCurrent(SDL_Window * window,
slouken@1895
   825
                                               SDL_GLContext context);
slouken@1895
   826
slouken@1895
   827
/**
slouken@3407
   828
 *  \brief Set the swap interval for the current OpenGL context.
slouken@3407
   829
 *  
slouken@3407
   830
 *  \param interval 0 for immediate updates, 1 for updates synchronized with the
icculus@6382
   831
 *                  vertical retrace. If the system supports it, you may
icculus@6382
   832
 *                  specify -1 to allow late swaps to happen immediately
icculus@6382
   833
 *                  instead of waiting for the next retrace.
slouken@3407
   834
 *  
slouken@3407
   835
 *  \return 0 on success, or -1 if setting the swap interval is not supported.
slouken@3407
   836
 *  
slouken@3407
   837
 *  \sa SDL_GL_GetSwapInterval()
slouken@1895
   838
 */
slouken@1895
   839
extern DECLSPEC int SDLCALL SDL_GL_SetSwapInterval(int interval);
slouken@1895
   840
slouken@1895
   841
/**
slouken@3407
   842
 *  \brief Get the swap interval for the current OpenGL context.
slouken@3407
   843
 *  
slouken@3407
   844
 *  \return 0 if there is no vertical retrace synchronization, 1 if the buffer 
icculus@6382
   845
 *          swap is synchronized with the vertical retrace, and -1 if late
icculus@6382
   846
 *          swaps happen immediately instead of waiting for the next retrace.
icculus@6382
   847
 *          If the system can't determine the swap interval, or there isn't a
icculus@6382
   848
 *          valid current context, this will return 0 as a safe default.
slouken@3407
   849
 *  
slouken@3407
   850
 *  \sa SDL_GL_SetSwapInterval()
slouken@1895
   851
 */
slouken@1895
   852
extern DECLSPEC int SDLCALL SDL_GL_GetSwapInterval(void);
slouken@1895
   853
slouken@1895
   854
/**
slouken@4883
   855
 * \brief Swap the OpenGL buffers for a window, if double-buffering is 
slouken@3407
   856
 *        supported.
slouken@0
   857
 */
slouken@3685
   858
extern DECLSPEC void SDLCALL SDL_GL_SwapWindow(SDL_Window * window);
slouken@0
   859
slouken@1895
   860
/**
slouken@3407
   861
 *  \brief Delete an OpenGL context.
slouken@3407
   862
 *  
slouken@3407
   863
 *  \sa SDL_GL_CreateContext()
slouken@0
   864
 */
slouken@1895
   865
extern DECLSPEC void SDLCALL SDL_GL_DeleteContext(SDL_GLContext context);
slouken@0
   866
slouken@3407
   867
/*@}*//*OpenGL support functions*/
slouken@3407
   868
slouken@0
   869
slouken@0
   870
/* Ends C function definitions when using C++ */
slouken@0
   871
#ifdef __cplusplus
slouken@1895
   872
/* *INDENT-OFF* */
slouken@0
   873
}
slouken@1895
   874
/* *INDENT-ON* */
slouken@0
   875
#endif
slouken@0
   876
#include "close_code.h"
slouken@0
   877
slouken@0
   878
#endif /* _SDL_video_h */
slouken@1895
   879
slouken@1895
   880
/* vi: set ts=4 sw=4 expandtab: */