include/SDL_video.h
author Sam Lantinga <slouken@libsdl.org>
Thu, 03 Feb 2011 11:16:57 -0800
changeset 5165 2b1989f59674
parent 5154 fb424691cfc7
child 5166 4d39eeaad00b
permissions -rw-r--r--
Extended SDL_SetWindowData() to allow arbitrary named values.
slouken@0
     1
/*
slouken@0
     2
    SDL - Simple DirectMedia Layer
slouken@3697
     3
    Copyright (C) 1997-2010 Sam Lantinga
slouken@0
     4
slouken@0
     5
    This library is free software; you can redistribute it and/or
slouken@1312
     6
    modify it under the terms of the GNU Lesser General Public
slouken@0
     7
    License as published by the Free Software Foundation; either
slouken@1312
     8
    version 2.1 of the License, or (at your option) any later version.
slouken@0
     9
slouken@0
    10
    This library is distributed in the hope that it will be useful,
slouken@0
    11
    but WITHOUT ANY WARRANTY; without even the implied warranty of
slouken@0
    12
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
slouken@1312
    13
    Lesser General Public License for more details.
slouken@0
    14
slouken@1312
    15
    You should have received a copy of the GNU Lesser General Public
slouken@1312
    16
    License along with this library; if not, write to the Free Software
slouken@1312
    17
    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
slouken@0
    18
slouken@0
    19
    Sam Lantinga
slouken@251
    20
    slouken@libsdl.org
slouken@0
    21
*/
slouken@0
    22
slouken@1895
    23
/**
slouken@3407
    24
 *  \file SDL_video.h
slouken@3407
    25
 *  
slouken@3407
    26
 *  Header file for SDL video functions.
slouken@1895
    27
 */
slouken@0
    28
slouken@0
    29
#ifndef _SDL_video_h
slouken@0
    30
#define _SDL_video_h
slouken@0
    31
slouken@1356
    32
#include "SDL_stdinc.h"
slouken@1895
    33
#include "SDL_pixels.h"
slouken@2275
    34
#include "SDL_rect.h"
slouken@2275
    35
#include "SDL_surface.h"
slouken@0
    36
slouken@0
    37
#include "begin_code.h"
slouken@0
    38
/* Set up for C function definitions, even when using C++ */
slouken@0
    39
#ifdef __cplusplus
slouken@1895
    40
/* *INDENT-OFF* */
slouken@0
    41
extern "C" {
slouken@1895
    42
/* *INDENT-ON* */
slouken@0
    43
#endif
slouken@0
    44
slouken@1895
    45
/**
slouken@3407
    46
 *  \brief  The structure that defines a display mode
slouken@3407
    47
 *  
slouken@3407
    48
 *  \sa SDL_GetNumDisplayModes()
slouken@3407
    49
 *  \sa SDL_GetDisplayMode()
slouken@3407
    50
 *  \sa SDL_GetDesktopDisplayMode()
slouken@3407
    51
 *  \sa SDL_GetCurrentDisplayMode()
slouken@3407
    52
 *  \sa SDL_GetClosestDisplayMode()
slouken@3500
    53
 *  \sa SDL_SetWindowDisplayMode()
slouken@3500
    54
 *  \sa SDL_GetWindowDisplayMode()
slouken@1895
    55
 */
slouken@1895
    56
typedef struct
slouken@1895
    57
{
slouken@1895
    58
    Uint32 format;              /**< pixel format */
slouken@1895
    59
    int w;                      /**< width */
slouken@1895
    60
    int h;                      /**< height */
slouken@1895
    61
    int refresh_rate;           /**< refresh rate (or zero for unspecified) */
slouken@1895
    62
    void *driverdata;           /**< driver-specific data, initialize to 0 */
slouken@1895
    63
} SDL_DisplayMode;
slouken@0
    64
slouken@1895
    65
/**
slouken@3407
    66
 *  \brief The type used to identify a window
slouken@3407
    67
 *  
slouken@3407
    68
 *  \sa SDL_CreateWindow()
slouken@3407
    69
 *  \sa SDL_CreateWindowFrom()
slouken@3407
    70
 *  \sa SDL_DestroyWindow()
slouken@3407
    71
 *  \sa SDL_GetWindowData()
slouken@3407
    72
 *  \sa SDL_GetWindowFlags()
slouken@3407
    73
 *  \sa SDL_GetWindowGrab()
slouken@3407
    74
 *  \sa SDL_GetWindowPosition()
slouken@3407
    75
 *  \sa SDL_GetWindowSize()
slouken@3407
    76
 *  \sa SDL_GetWindowTitle()
slouken@3407
    77
 *  \sa SDL_HideWindow()
slouken@3407
    78
 *  \sa SDL_MaximizeWindow()
slouken@3407
    79
 *  \sa SDL_MinimizeWindow()
slouken@3407
    80
 *  \sa SDL_RaiseWindow()
slouken@3407
    81
 *  \sa SDL_RestoreWindow()
slouken@3407
    82
 *  \sa SDL_SetWindowData()
slouken@3407
    83
 *  \sa SDL_SetWindowFullscreen()
slouken@3407
    84
 *  \sa SDL_SetWindowGrab()
slouken@3407
    85
 *  \sa SDL_SetWindowIcon()
slouken@3407
    86
 *  \sa SDL_SetWindowPosition()
slouken@3407
    87
 *  \sa SDL_SetWindowSize()
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@1895
   100
    SDL_WINDOW_FULLSCREEN = 0x00000001,         /**< fullscreen window, implies borderless */
slouken@1895
   101
    SDL_WINDOW_OPENGL = 0x00000002,             /**< window usable with OpenGL context */
slouken@1895
   102
    SDL_WINDOW_SHOWN = 0x00000004,              /**< window is visible */
slouken@1895
   103
    SDL_WINDOW_BORDERLESS = 0x00000008,         /**< no window decoration */
slouken@1895
   104
    SDL_WINDOW_RESIZABLE = 0x00000010,          /**< window can be resized */
slouken@3523
   105
    SDL_WINDOW_MINIMIZED = 0x00000020,          /**< window is minimized */
slouken@3523
   106
    SDL_WINDOW_MAXIMIZED = 0x00000040,          /**< window is maximized */
slouken@1895
   107
    SDL_WINDOW_INPUT_GRABBED = 0x00000100,      /**< window has grabbed input focus */
slouken@1895
   108
    SDL_WINDOW_INPUT_FOCUS = 0x00000200,        /**< window has input focus */
slouken@3057
   109
    SDL_WINDOW_MOUSE_FOCUS = 0x00000400,        /**< window has mouse focus */
slouken@3057
   110
    SDL_WINDOW_FOREIGN = 0x00000800             /**< window not created by SDL */
slouken@1895
   111
} SDL_WindowFlags;
slouken@0
   112
slouken@1895
   113
/**
slouken@3407
   114
 *  \brief Used to indicate that you don't care what the window position is.
slouken@1895
   115
 */
slouken@1895
   116
#define SDL_WINDOWPOS_UNDEFINED 0x7FFFFFF
slouken@3407
   117
slouken@1895
   118
/**
slouken@3407
   119
 *  \brief Used to indicate that the window position should be centered.
slouken@1895
   120
 */
slouken@1895
   121
#define SDL_WINDOWPOS_CENTERED  0x7FFFFFE
slouken@1895
   122
slouken@1895
   123
/**
slouken@3407
   124
 *  \brief Event subtype for window events
slouken@1895
   125
 */
slouken@1895
   126
typedef enum
slouken@1895
   127
{
slouken@3407
   128
    SDL_WINDOWEVENT_NONE,           /**< Never used */
slouken@3407
   129
    SDL_WINDOWEVENT_SHOWN,          /**< Window has been shown */
slouken@3407
   130
    SDL_WINDOWEVENT_HIDDEN,         /**< Window has been hidden */
slouken@3407
   131
    SDL_WINDOWEVENT_EXPOSED,        /**< Window has been exposed and should be 
slouken@3407
   132
                                         redrawn */
slouken@3407
   133
    SDL_WINDOWEVENT_MOVED,          /**< Window has been moved to data1, data2 
slouken@3407
   134
                                     */
slouken@3407
   135
    SDL_WINDOWEVENT_RESIZED,        /**< Window size changed to data1xdata2 */
slouken@3407
   136
    SDL_WINDOWEVENT_MINIMIZED,      /**< Window has been minimized */
slouken@3407
   137
    SDL_WINDOWEVENT_MAXIMIZED,      /**< Window has been maximized */
slouken@3407
   138
    SDL_WINDOWEVENT_RESTORED,       /**< Window has been restored to normal size
slouken@3407
   139
                                         and position */
slouken@3691
   140
    SDL_WINDOWEVENT_ENTER,          /**< Window has gained mouse focus */
slouken@3691
   141
    SDL_WINDOWEVENT_LEAVE,          /**< Window has lost mouse focus */
slouken@3691
   142
    SDL_WINDOWEVENT_FOCUS_GAINED,   /**< Window has gained keyboard focus */
slouken@3691
   143
    SDL_WINDOWEVENT_FOCUS_LOST,     /**< Window has lost keyboard focus */
slouken@3407
   144
    SDL_WINDOWEVENT_CLOSE           /**< The window manager requests that the 
slouken@3407
   145
                                         window be closed */
slouken@1895
   146
} SDL_WindowEventID;
slouken@1895
   147
slouken@1895
   148
/**
slouken@3407
   149
 *  \brief An opaque handle to an OpenGL context.
slouken@1895
   150
 */
slouken@1895
   151
typedef void *SDL_GLContext;
slouken@1895
   152
slouken@1895
   153
/**
slouken@3407
   154
 *  \brief OpenGL configuration attributes
slouken@0
   155
 */
slouken@1895
   156
typedef enum
slouken@1895
   157
{
slouken@0
   158
    SDL_GL_RED_SIZE,
slouken@0
   159
    SDL_GL_GREEN_SIZE,
slouken@0
   160
    SDL_GL_BLUE_SIZE,
slouken@0
   161
    SDL_GL_ALPHA_SIZE,
slouken@0
   162
    SDL_GL_BUFFER_SIZE,
slouken@0
   163
    SDL_GL_DOUBLEBUFFER,
slouken@0
   164
    SDL_GL_DEPTH_SIZE,
slouken@0
   165
    SDL_GL_STENCIL_SIZE,
slouken@0
   166
    SDL_GL_ACCUM_RED_SIZE,
slouken@0
   167
    SDL_GL_ACCUM_GREEN_SIZE,
slouken@0
   168
    SDL_GL_ACCUM_BLUE_SIZE,
slouken@450
   169
    SDL_GL_ACCUM_ALPHA_SIZE,
slouken@655
   170
    SDL_GL_STEREO,
slouken@656
   171
    SDL_GL_MULTISAMPLEBUFFERS,
slouken@1736
   172
    SDL_GL_MULTISAMPLESAMPLES,
hfutrell@2747
   173
    SDL_GL_ACCELERATED_VISUAL,
slouken@3100
   174
    SDL_GL_RETAINED_BACKING,
slouken@3139
   175
    SDL_GL_CONTEXT_MAJOR_VERSION,
slouken@3139
   176
    SDL_GL_CONTEXT_MINOR_VERSION
slouken@0
   177
} SDL_GLattr;
slouken@0
   178
slouken@0
   179
slouken@0
   180
/* Function prototypes */
slouken@0
   181
slouken@1895
   182
/**
slouken@3407
   183
 *  \brief Get the number of video drivers compiled into SDL
slouken@3407
   184
 *  
slouken@3407
   185
 *  \sa SDL_GetVideoDriver()
slouken@0
   186
 */
slouken@1895
   187
extern DECLSPEC int SDLCALL SDL_GetNumVideoDrivers(void);
slouken@1895
   188
slouken@1895
   189
/**
slouken@3407
   190
 *  \brief Get the name of a built in video driver.
slouken@3407
   191
 *  
slouken@3407
   192
 *  \note The video drivers are presented in the order in which they are
slouken@3407
   193
 *        normally checked during initialization.
slouken@3407
   194
 *  
slouken@3407
   195
 *  \sa SDL_GetNumVideoDrivers()
slouken@1895
   196
 */
slouken@1895
   197
extern DECLSPEC const char *SDLCALL SDL_GetVideoDriver(int index);
slouken@1895
   198
slouken@1895
   199
/**
slouken@3407
   200
 *  \brief Initialize the video subsystem, optionally specifying a video driver.
slouken@3407
   201
 *  
slouken@3407
   202
 *  \param driver_name Initialize a specific driver by name, or NULL for the 
slouken@3407
   203
 *                     default video driver.
slouken@3407
   204
 *  
slouken@3407
   205
 *  \return 0 on success, -1 on error
slouken@3407
   206
 *  
slouken@3407
   207
 *  This function initializes the video subsystem; setting up a connection
slouken@3407
   208
 *  to the window manager, etc, and determines the available display modes
slouken@3407
   209
 *  and pixel formats, but does not initialize a window or graphics mode.
slouken@3407
   210
 *  
slouken@3407
   211
 *  \sa SDL_VideoQuit()
slouken@1895
   212
 */
slouken@5123
   213
extern DECLSPEC int SDLCALL SDL_VideoInit(const char *driver_name);
slouken@1895
   214
slouken@1895
   215
/**
slouken@3407
   216
 *  \brief Shuts down the video subsystem.
slouken@3407
   217
 *  
slouken@3407
   218
 *  This function closes all windows, and restores the original video mode.
slouken@3407
   219
 *  
slouken@3407
   220
 *  \sa SDL_VideoInit()
slouken@1895
   221
 */
slouken@337
   222
extern DECLSPEC void SDLCALL SDL_VideoQuit(void);
slouken@0
   223
slouken@1895
   224
/**
slouken@3407
   225
 *  \brief Returns the name of the currently initialized video driver.
slouken@3407
   226
 *  
slouken@3407
   227
 *  \return The name of the current video driver or NULL if no driver
slouken@3407
   228
 *          has been initialized
slouken@3407
   229
 *  
slouken@3407
   230
 *  \sa SDL_GetNumVideoDrivers()
slouken@3407
   231
 *  \sa SDL_GetVideoDriver()
slouken@0
   232
 */
slouken@1895
   233
extern DECLSPEC const char *SDLCALL SDL_GetCurrentVideoDriver(void);
slouken@0
   234
slouken@1895
   235
/**
slouken@3407
   236
 *  \brief Returns the number of available video displays.
slouken@3407
   237
 *  
slouken@3528
   238
 *  \sa SDL_GetDisplayBounds()
slouken@3407
   239
 *  \sa SDL_SelectVideoDisplay()
slouken@0
   240
 */
slouken@1895
   241
extern DECLSPEC int SDLCALL SDL_GetNumVideoDisplays(void);
slouken@0
   242
slouken@1895
   243
/**
slouken@3528
   244
 *  \brief Get the desktop area represented by a display, with the primary
slouken@3528
   245
 *         display located at 0,0
slouken@3528
   246
 *  
slouken@3528
   247
 *  \return 0 on success, or -1 if the index is out of range.
slouken@3528
   248
 *  
slouken@3528
   249
 *  \sa SDL_GetNumVideoDisplays()
slouken@3528
   250
 */
slouken@3528
   251
extern DECLSPEC int SDLCALL SDL_GetDisplayBounds(int index, SDL_Rect * rect);
slouken@3528
   252
slouken@3528
   253
/**
slouken@3407
   254
 *  \brief Set the index of the currently selected display.
slouken@3407
   255
 *  
slouken@3407
   256
 *  \return 0 on success, or -1 if the index is out of range.
slouken@3407
   257
 *  
slouken@3407
   258
 *  \sa SDL_GetNumVideoDisplays()
slouken@3407
   259
 *  \sa SDL_GetCurrentVideoDisplay()
slouken@1963
   260
 */
slouken@1963
   261
extern DECLSPEC int SDLCALL SDL_SelectVideoDisplay(int index);
slouken@1963
   262
slouken@1963
   263
/**
slouken@3407
   264
 *  \brief Get the index of the currently selected display.
slouken@3407
   265
 *  
slouken@3407
   266
 *  \return The index of the currently selected display.
slouken@3407
   267
 *  
slouken@3407
   268
 *  \sa SDL_GetNumVideoDisplays()
slouken@3407
   269
 *  \sa SDL_SelectVideoDisplay()
slouken@0
   270
 */
slouken@1963
   271
extern DECLSPEC int SDLCALL SDL_GetCurrentVideoDisplay(void);
slouken@0
   272
slouken@1895
   273
/**
slouken@3407
   274
 *  \brief Returns the number of available display modes for the current display.
slouken@3407
   275
 *  
slouken@3407
   276
 *  \sa SDL_GetDisplayMode()
slouken@0
   277
 */
slouken@1895
   278
extern DECLSPEC int SDLCALL SDL_GetNumDisplayModes(void);
slouken@0
   279
slouken@1895
   280
/**
slouken@3407
   281
 *  \brief Fill in information about a specific display mode.
slouken@3407
   282
 *  
slouken@3407
   283
 *  \note The display modes are sorted in this priority:
slouken@3407
   284
 *        \li bits per pixel -> more colors to fewer colors
slouken@3407
   285
 *        \li width -> largest to smallest
slouken@3407
   286
 *        \li height -> largest to smallest
slouken@3407
   287
 *        \li refresh rate -> highest to lowest
slouken@3407
   288
 *  
slouken@3407
   289
 *  \sa SDL_GetNumDisplayModes()
slouken@0
   290
 */
slouken@1967
   291
extern DECLSPEC int SDLCALL SDL_GetDisplayMode(int index,
slouken@1967
   292
                                               SDL_DisplayMode * mode);
slouken@0
   293
slouken@1895
   294
/**
slouken@3407
   295
 *  \brief Fill in information about the desktop display mode for the current 
slouken@3407
   296
 *         display.
slouken@1895
   297
 */
slouken@1967
   298
extern DECLSPEC int SDLCALL SDL_GetDesktopDisplayMode(SDL_DisplayMode * mode);
slouken@1895
   299
slouken@1895
   300
/**
slouken@3407
   301
 *  \brief Fill in information about the current display mode.
slouken@1895
   302
 */
slouken@1967
   303
extern DECLSPEC int SDLCALL SDL_GetCurrentDisplayMode(SDL_DisplayMode * mode);
slouken@1895
   304
slouken@3400
   305
slouken@1895
   306
/**
slouken@3407
   307
 *  \brief Get the closest match to the requested display mode.
slouken@3407
   308
 *  
slouken@3407
   309
 *  \param mode The desired display mode
slouken@3407
   310
 *  \param closest A pointer to a display mode to be filled in with the closest 
slouken@3407
   311
 *                 match of the available display modes.
slouken@3407
   312
 *  
slouken@3407
   313
 *  \return The passed in value \c closest, or NULL if no matching video mode 
slouken@3407
   314
 *          was available.
slouken@3407
   315
 *  
slouken@3407
   316
 *  The available display modes are scanned, and \c closest is filled in with the
slouken@3407
   317
 *  closest mode matching the requested mode and returned.  The mode format and 
slouken@3407
   318
 *  refresh_rate default to the desktop mode if they are 0.  The modes are 
slouken@3407
   319
 *  scanned with size being first priority, format being second priority, and 
slouken@3407
   320
 *  finally checking the refresh_rate.  If all the available modes are too 
slouken@3407
   321
 *  small, then NULL is returned.
slouken@3407
   322
 *  
slouken@3407
   323
 *  \sa SDL_GetNumDisplayModes()
slouken@3407
   324
 *  \sa SDL_GetDisplayMode()
slouken@1895
   325
 */
slouken@1895
   326
extern DECLSPEC SDL_DisplayMode *SDLCALL SDL_GetClosestDisplayMode(const
slouken@1895
   327
                                                                   SDL_DisplayMode
slouken@1895
   328
                                                                   * mode,
slouken@1895
   329
                                                                   SDL_DisplayMode
slouken@1895
   330
                                                                   * closest);
slouken@1895
   331
slouken@1895
   332
/**
slouken@3407
   333
 *  \brief Set the display mode used when a fullscreen window is visible
slouken@3500
   334
 *         on the currently selected display.  By default the window's
slouken@3500
   335
 *         dimensions and the desktop format and refresh rate are used.
slouken@3407
   336
 *  
slouken@3500
   337
 *  \param mode The mode to use, or NULL for the default mode.
slouken@3407
   338
 *  
slouken@3407
   339
 *  \return 0 on success, or -1 if setting the display mode failed.
slouken@3407
   340
 *  
slouken@3522
   341
 *  \sa SDL_GetWindowDisplayMode()
slouken@3407
   342
 *  \sa SDL_SetWindowFullscreen()
slouken@0
   343
 */
slouken@3685
   344
extern DECLSPEC int SDLCALL SDL_SetWindowDisplayMode(SDL_Window * window,
slouken@3500
   345
                                                     const SDL_DisplayMode
slouken@1895
   346
                                                         * mode);
slouken@0
   347
slouken@1895
   348
/**
slouken@3407
   349
 *  \brief Fill in information about the display mode used when a fullscreen
slouken@3407
   350
 *         window is visible on the currently selected display.
slouken@3522
   351
 *
slouken@3522
   352
 *  \sa SDL_SetWindowDisplayMode()
slouken@3522
   353
 *  \sa SDL_SetWindowFullscreen()
slouken@0
   354
 */
slouken@3685
   355
extern DECLSPEC int SDLCALL SDL_GetWindowDisplayMode(SDL_Window * window,
slouken@3500
   356
                                                     SDL_DisplayMode * mode);
slouken@0
   357
slouken@1895
   358
/**
slouken@5154
   359
 *  \brief Get the pixel format associated with the window.
slouken@5154
   360
 */
slouken@5154
   361
extern DECLSPEC Uint32 SDLCALL SDL_GetWindowPixelFormat(SDL_Window * window);
slouken@5154
   362
slouken@5154
   363
/**
slouken@3407
   364
 *  \brief Set the gamma correction for each of the color channels on the 
slouken@3407
   365
 *         currently selected display.
slouken@3407
   366
 *  
slouken@3407
   367
 *  \return 0 on success, or -1 if setting the gamma isn't supported.
slouken@3407
   368
 *  
slouken@3407
   369
 *  \sa SDL_SetGammaRamp()
slouken@0
   370
 */
slouken@337
   371
extern DECLSPEC int SDLCALL SDL_SetGamma(float red, float green, float blue);
slouken@0
   372
slouken@1895
   373
/**
slouken@3407
   374
 *  \brief Set the gamma ramp for the currently selected display.
slouken@3407
   375
 *  
slouken@3407
   376
 *  \param red The translation table for the red channel, or NULL.
slouken@3407
   377
 *  \param green The translation table for the green channel, or NULL.
slouken@3407
   378
 *  \param blue The translation table for the blue channel, or NULL.
slouken@3407
   379
 *  
slouken@3407
   380
 *  \return 0 on success, or -1 if gamma ramps are unsupported.
slouken@3407
   381
 *  
slouken@3407
   382
 *  Set the gamma translation table for the red, green, and blue channels
slouken@3407
   383
 *  of the video hardware.  Each table is an array of 256 16-bit quantities,
slouken@3407
   384
 *  representing a mapping between the input and output for that channel.
slouken@3407
   385
 *  The input is the index into the array, and the output is the 16-bit
slouken@3407
   386
 *  gamma value at that index, scaled to the output color precision.
slouken@3407
   387
 *  
slouken@3407
   388
 *  \sa SDL_GetGammaRamp()
slouken@0
   389
 */
slouken@1895
   390
extern DECLSPEC int SDLCALL SDL_SetGammaRamp(const Uint16 * red,
slouken@1895
   391
                                             const Uint16 * green,
slouken@1895
   392
                                             const Uint16 * blue);
slouken@0
   393
slouken@1895
   394
/**
slouken@3407
   395
 *  \brief Get the gamma ramp for the currently selected display.
slouken@3407
   396
 *  
slouken@3407
   397
 *  \param red   A pointer to a 256 element array of 16-bit quantities to hold 
slouken@3407
   398
 *               the translation table for the red channel, or NULL.
slouken@3407
   399
 *  \param green A pointer to a 256 element array of 16-bit quantities to hold 
slouken@3407
   400
 *               the translation table for the green channel, or NULL.
slouken@3407
   401
 *  \param blue  A pointer to a 256 element array of 16-bit quantities to hold 
slouken@3407
   402
 *               the translation table for the blue channel, or NULL.
slouken@3407
   403
 *   
slouken@3407
   404
 *  \return 0 on success, or -1 if gamma ramps are unsupported.
slouken@3407
   405
 *  
slouken@3407
   406
 *  \sa SDL_SetGammaRamp()
slouken@0
   407
 */
slouken@1895
   408
extern DECLSPEC int SDLCALL SDL_GetGammaRamp(Uint16 * red, Uint16 * green,
slouken@1895
   409
                                             Uint16 * blue);
slouken@0
   410
slouken@1895
   411
slouken@1895
   412
/**
slouken@3407
   413
 *  \brief Create a window with the specified position, dimensions, and flags.
slouken@3407
   414
 *  
slouken@3407
   415
 *  \param title The title of the window, in UTF-8 encoding.
slouken@3407
   416
 *  \param x     The x position of the window, ::SDL_WINDOWPOS_CENTERED, or 
slouken@3407
   417
 *               ::SDL_WINDOWPOS_UNDEFINED.
slouken@3407
   418
 *  \param y     The y position of the window, ::SDL_WINDOWPOS_CENTERED, or 
slouken@3407
   419
 *               ::SDL_WINDOWPOS_UNDEFINED.
slouken@3407
   420
 *  \param w     The width of the window.
slouken@3407
   421
 *  \param h     The height of the window.
slouken@3407
   422
 *  \param flags The flags for the window, a mask of any of the following: 
slouken@3407
   423
 *               ::SDL_WINDOW_FULLSCREEN, ::SDL_WINDOW_OPENGL, 
slouken@3407
   424
 *               ::SDL_WINDOW_SHOWN,      ::SDL_WINDOW_BORDERLESS, 
slouken@3407
   425
 *               ::SDL_WINDOW_RESIZABLE,  ::SDL_WINDOW_MAXIMIZED, 
slouken@3407
   426
 *               ::SDL_WINDOW_MINIMIZED,  ::SDL_WINDOW_INPUT_GRABBED.
slouken@3407
   427
 *  
slouken@3407
   428
 *  \return The id of the window created, or zero if window creation failed.
slouken@3407
   429
 *  
slouken@3407
   430
 *  \sa SDL_DestroyWindow()
slouken@0
   431
 */
slouken@3685
   432
extern DECLSPEC SDL_Window * SDLCALL SDL_CreateWindow(const char *title,
slouken@1895
   433
                                                      int x, int y, int w,
slouken@1895
   434
                                                      int h, Uint32 flags);
slouken@0
   435
slouken@1895
   436
/**
slouken@3493
   437
 *  \brief Create an SDL window from an existing native window.
slouken@3407
   438
 *  
slouken@3407
   439
 *  \param data A pointer to driver-dependent window creation data
slouken@3407
   440
 *  
slouken@3407
   441
 *  \return The id of the window created, or zero if window creation failed.
slouken@3407
   442
 *  
slouken@3407
   443
 *  \sa SDL_DestroyWindow()
slouken@0
   444
 */
slouken@3685
   445
extern DECLSPEC SDL_Window * SDLCALL SDL_CreateWindowFrom(const void *data);
slouken@3685
   446
slouken@3685
   447
/**
slouken@4883
   448
 *  \brief Get the numeric ID of a window, for logging purposes.
slouken@3685
   449
 */
slouken@3685
   450
extern DECLSPEC Uint32 SDLCALL SDL_GetWindowID(SDL_Window * window);
slouken@3685
   451
slouken@3685
   452
/**
slouken@3685
   453
 *  \brief Get a window from a stored ID, or NULL if it doesn't exist.
slouken@3685
   454
 */
slouken@3685
   455
extern DECLSPEC SDL_Window * SDLCALL SDL_GetWindowFromID(Uint32 id);
slouken@1895
   456
slouken@1895
   457
/**
slouken@3407
   458
 *  \brief Get the window flags.
slouken@1895
   459
 */
slouken@3685
   460
extern DECLSPEC Uint32 SDLCALL SDL_GetWindowFlags(SDL_Window * window);
slouken@1895
   461
slouken@1895
   462
/**
slouken@4883
   463
 *  \brief Set the title of a window, in UTF-8 format.
slouken@3407
   464
 *  
slouken@3407
   465
 *  \sa SDL_GetWindowTitle()
slouken@1895
   466
 */
slouken@3685
   467
extern DECLSPEC void SDLCALL SDL_SetWindowTitle(SDL_Window * window,
slouken@1895
   468
                                                const char *title);
slouken@1895
   469
slouken@1895
   470
/**
slouken@4883
   471
 *  \brief Get the title of a window, in UTF-8 format.
slouken@3407
   472
 *  
slouken@3407
   473
 *  \sa SDL_SetWindowTitle()
slouken@1895
   474
 */
slouken@3685
   475
extern DECLSPEC const char *SDLCALL SDL_GetWindowTitle(SDL_Window * window);
slouken@1895
   476
slouken@1895
   477
/**
slouken@4887
   478
 *  \brief Set the icon for a window.
slouken@3407
   479
 *  
slouken@4887
   480
 *  \param icon The icon for the window.
slouken@1895
   481
 */
slouken@3685
   482
extern DECLSPEC void SDLCALL SDL_SetWindowIcon(SDL_Window * window,
slouken@2990
   483
                                               SDL_Surface * icon);
slouken@1895
   484
slouken@1895
   485
/**
slouken@5165
   486
 *  \brief Associate an arbitrary named pointer with a window.
slouken@3407
   487
 *  
slouken@5165
   488
 *  \param window   The window to associate with the pointer.
slouken@5165
   489
 *  \param name     The name of the pointer.
slouken@5165
   490
 *  \param userdata The associated pointer.
slouken@5165
   491
 *
slouken@5165
   492
 *  \return The previous value associated with 'name'
slouken@5165
   493
 *
slouken@5165
   494
 *  \note The name is case-sensitive.
slouken@5165
   495
 *
slouken@3407
   496
 *  \sa SDL_GetWindowData()
slouken@1895
   497
 */
slouken@5165
   498
extern DECLSPEC void* SDLCALL SDL_SetWindowData(SDL_Window * window,
slouken@5165
   499
                                                const char *name,
slouken@5165
   500
                                                void *userdata);
slouken@1895
   501
slouken@1895
   502
/**
slouken@4883
   503
 *  \brief Retrieve the data pointer associated with a window.
slouken@3407
   504
 *  
slouken@5165
   505
 *  \param window   The window to query.
slouken@5165
   506
 *  \param name     The name of the pointer.
slouken@5165
   507
 *
slouken@5165
   508
 *  \return The value associated with 'name'
slouken@5165
   509
 *  
slouken@3407
   510
 *  \sa SDL_SetWindowData()
slouken@1895
   511
 */
slouken@5165
   512
extern DECLSPEC void *SDLCALL SDL_GetWindowData(SDL_Window * window,
slouken@5165
   513
                                                const char *name);
slouken@1895
   514
slouken@1895
   515
/**
slouken@4883
   516
 *  \brief Set the position of a window.
slouken@3407
   517
 *  
slouken@5165
   518
 *  \param window   The window to reposition.
slouken@3407
   519
 *  \param x        The x coordinate of the window, ::SDL_WINDOWPOS_CENTERED, or
slouken@3407
   520
                    ::SDL_WINDOWPOS_UNDEFINED.
slouken@3407
   521
 *  \param y        The y coordinate of the window, ::SDL_WINDOWPOS_CENTERED, or
slouken@3407
   522
                    ::SDL_WINDOWPOS_UNDEFINED.
slouken@3407
   523
 *  
slouken@3407
   524
 *  \note The window coordinate origin is the upper left of the display.
slouken@3407
   525
 *  
slouken@3407
   526
 *  \sa SDL_GetWindowPosition()
slouken@1895
   527
 */
slouken@3685
   528
extern DECLSPEC void SDLCALL SDL_SetWindowPosition(SDL_Window * window,
slouken@1895
   529
                                                   int x, int y);
slouken@1895
   530
slouken@1895
   531
/**
slouken@4883
   532
 *  \brief Get the position of a window.
slouken@3407
   533
 *  
slouken@3407
   534
 *  \sa SDL_SetWindowPosition()
slouken@1895
   535
 */
slouken@3685
   536
extern DECLSPEC void SDLCALL SDL_GetWindowPosition(SDL_Window * window,
slouken@1895
   537
                                                   int *x, int *y);
slouken@1895
   538
slouken@1895
   539
/**
slouken@4883
   540
 *  \brief Set the size of a window's client area.
slouken@3407
   541
 *  
slouken@3407
   542
 *  \note You can't change the size of a fullscreen window, it automatically
slouken@3407
   543
 *        matches the size of the display mode.
slouken@3407
   544
 *  
slouken@3407
   545
 *  \sa SDL_GetWindowSize()
slouken@1895
   546
 */
slouken@3685
   547
extern DECLSPEC void SDLCALL SDL_SetWindowSize(SDL_Window * window, int w,
slouken@1895
   548
                                               int h);
slouken@1895
   549
slouken@1895
   550
/**
slouken@4883
   551
 *  \brief Get the size of a window's client area.
slouken@3407
   552
 *  
slouken@3407
   553
 *  \sa SDL_SetWindowSize()
slouken@1895
   554
 */
slouken@3685
   555
extern DECLSPEC void SDLCALL SDL_GetWindowSize(SDL_Window * window, int *w,
slouken@1895
   556
                                               int *h);
slouken@1895
   557
slouken@1895
   558
/**
slouken@4883
   559
 *  \brief Show a window.
slouken@3407
   560
 *  
slouken@3407
   561
 *  \sa SDL_HideWindow()
slouken@1895
   562
 */
slouken@3685
   563
extern DECLSPEC void SDLCALL SDL_ShowWindow(SDL_Window * window);
slouken@1895
   564
slouken@1895
   565
/**
slouken@4883
   566
 *  \brief Hide a window.
slouken@3407
   567
 *  
slouken@3407
   568
 *  \sa SDL_ShowWindow()
slouken@1895
   569
 */
slouken@3685
   570
extern DECLSPEC void SDLCALL SDL_HideWindow(SDL_Window * window);
slouken@1895
   571
slouken@1895
   572
/**
slouken@4883
   573
 *  \brief Raise a window above other windows and set the input focus.
slouken@1895
   574
 */
slouken@3685
   575
extern DECLSPEC void SDLCALL SDL_RaiseWindow(SDL_Window * window);
slouken@1895
   576
slouken@1895
   577
/**
slouken@4883
   578
 *  \brief Make a window as large as possible.
slouken@3407
   579
 *  
slouken@3407
   580
 *  \sa SDL_RestoreWindow()
slouken@1895
   581
 */
slouken@3685
   582
extern DECLSPEC void SDLCALL SDL_MaximizeWindow(SDL_Window * window);
slouken@1895
   583
slouken@1895
   584
/**
slouken@4883
   585
 *  \brief Minimize a window to an iconic representation.
slouken@3407
   586
 *  
slouken@3407
   587
 *  \sa SDL_RestoreWindow()
slouken@1895
   588
 */
slouken@3685
   589
extern DECLSPEC void SDLCALL SDL_MinimizeWindow(SDL_Window * window);
slouken@1895
   590
slouken@1895
   591
/**
slouken@3407
   592
 *  \brief Restore the size and position of a minimized or maximized window.
slouken@3407
   593
 *  
slouken@3407
   594
 *  \sa SDL_MaximizeWindow()
slouken@3407
   595
 *  \sa SDL_MinimizeWindow()
slouken@1895
   596
 */
slouken@3685
   597
extern DECLSPEC void SDLCALL SDL_RestoreWindow(SDL_Window * window);
slouken@1895
   598
slouken@1895
   599
/**
slouken@4883
   600
 *  \brief Set a window's fullscreen state.
slouken@3407
   601
 *  
slouken@3407
   602
 *  \return 0 on success, or -1 if setting the display mode failed.
slouken@3407
   603
 *  
slouken@3522
   604
 *  \sa SDL_SetWindowDisplayMode()
slouken@3522
   605
 *  \sa SDL_GetWindowDisplayMode()
slouken@1895
   606
 */
slouken@3685
   607
extern DECLSPEC int SDLCALL SDL_SetWindowFullscreen(SDL_Window * window,
slouken@1895
   608
                                                    int fullscreen);
slouken@1895
   609
slouken@1895
   610
/**
slouken@4883
   611
 *  \brief Set a window's input grab mode.
slouken@3407
   612
 *  
slouken@3407
   613
 *  \param mode This is 1 to grab input, and 0 to release input.
slouken@3407
   614
 *  
slouken@3407
   615
 *  \sa SDL_GetWindowGrab()
slouken@1895
   616
 */
slouken@3685
   617
extern DECLSPEC void SDLCALL SDL_SetWindowGrab(SDL_Window * window,
slouken@1895
   618
                                               int mode);
slouken@1895
   619
slouken@1895
   620
/**
slouken@4883
   621
 *  \brief Get a window's input grab mode.
slouken@3407
   622
 *  
slouken@3407
   623
 *  \return This returns 1 if input is grabbed, and 0 otherwise.
slouken@3407
   624
 *  
slouken@3407
   625
 *  \sa SDL_SetWindowGrab()
slouken@1895
   626
 */
slouken@3685
   627
extern DECLSPEC int SDLCALL SDL_GetWindowGrab(SDL_Window * window);
slouken@1895
   628
slouken@1895
   629
/**
slouken@3407
   630
 *  \brief Get driver specific information about a window.
slouken@3407
   631
 *  
slouken@3407
   632
 *  \note Include SDL_syswm.h for the declaration of SDL_SysWMinfo.
slouken@1895
   633
 */
slouken@1895
   634
struct SDL_SysWMinfo;
slouken@3685
   635
extern DECLSPEC SDL_bool SDLCALL SDL_GetWindowWMInfo(SDL_Window * window,
slouken@1895
   636
                                                     struct SDL_SysWMinfo
slouken@1895
   637
                                                     *info);
slouken@1895
   638
slouken@1895
   639
/**
slouken@3407
   640
 *  \brief Destroy a window.
slouken@1895
   641
 */
slouken@3685
   642
extern DECLSPEC void SDLCALL SDL_DestroyWindow(SDL_Window * window);
slouken@1895
   643
slouken@0
   644
slouken@3025
   645
/**
slouken@4875
   646
 *  \brief Returns whether the screensaver is currently enabled (default on).
slouken@3407
   647
 *  
slouken@3407
   648
 *  \sa SDL_EnableScreenSaver()
slouken@3407
   649
 *  \sa SDL_DisableScreenSaver()
slouken@3025
   650
 */
couriersud@3033
   651
extern DECLSPEC SDL_bool SDLCALL SDL_IsScreenSaverEnabled(void);
slouken@3025
   652
slouken@3025
   653
/**
slouken@3407
   654
 *  \brief Allow the screen to be blanked by a screensaver
slouken@3407
   655
 *  
slouken@3407
   656
 *  \sa SDL_IsScreenSaverEnabled()
slouken@3407
   657
 *  \sa SDL_DisableScreenSaver()
slouken@3025
   658
 */
couriersud@3033
   659
extern DECLSPEC void SDLCALL SDL_EnableScreenSaver(void);
slouken@3025
   660
slouken@3025
   661
/**
slouken@3407
   662
 *  \brief Prevent the screen from being blanked by a screensaver
slouken@3407
   663
 *  
slouken@3407
   664
 *  \sa SDL_IsScreenSaverEnabled()
slouken@3407
   665
 *  \sa SDL_EnableScreenSaver()
slouken@3025
   666
 */
couriersud@3033
   667
extern DECLSPEC void SDLCALL SDL_DisableScreenSaver(void);
slouken@3025
   668
slouken@0
   669
slouken@3407
   670
/**
slouken@3407
   671
 *  \name OpenGL support functions
slouken@3407
   672
 */
slouken@3407
   673
/*@{*/
slouken@0
   674
slouken@1895
   675
/**
slouken@3407
   676
 *  \brief Dynamically load an OpenGL library.
slouken@3407
   677
 *  
slouken@3407
   678
 *  \param path The platform dependent OpenGL library name, or NULL to open the 
slouken@3407
   679
 *              default OpenGL library.
slouken@3407
   680
 *  
slouken@3407
   681
 *  \return 0 on success, or -1 if the library couldn't be loaded.
slouken@3407
   682
 *  
slouken@3407
   683
 *  This should be done after initializing the video driver, but before
slouken@3407
   684
 *  creating any OpenGL windows.  If no OpenGL library is loaded, the default
slouken@3407
   685
 *  library will be loaded upon creation of the first OpenGL window.
slouken@3407
   686
 *  
slouken@3407
   687
 *  \note If you do this, you need to retrieve all of the GL functions used in
slouken@3407
   688
 *        your program from the dynamic library using SDL_GL_GetProcAddress().
slouken@3407
   689
 *  
slouken@3407
   690
 *  \sa SDL_GL_GetProcAddress()
slouken@3407
   691
 *  \sa SDL_GL_UnloadLibrary()
slouken@0
   692
 */
slouken@337
   693
extern DECLSPEC int SDLCALL SDL_GL_LoadLibrary(const char *path);
slouken@0
   694
slouken@1895
   695
/**
slouken@3407
   696
 *  \brief Get the address of an OpenGL function.
slouken@0
   697
 */
slouken@1895
   698
extern DECLSPEC void *SDLCALL SDL_GL_GetProcAddress(const char *proc);
slouken@0
   699
slouken@1895
   700
/**
slouken@3407
   701
 *  \brief Unload the OpenGL library previously loaded by SDL_GL_LoadLibrary().
slouken@3407
   702
 *  
slouken@3407
   703
 *  \sa SDL_GL_LoadLibrary()
slouken@3057
   704
 */
slouken@3057
   705
extern DECLSPEC void SDLCALL SDL_GL_UnloadLibrary(void);
slouken@3057
   706
slouken@3057
   707
/**
slouken@3407
   708
 *  \brief Return true if an OpenGL extension is supported for the current 
slouken@3407
   709
 *         context.
slouken@1926
   710
 */
slouken@1926
   711
extern DECLSPEC SDL_bool SDLCALL SDL_GL_ExtensionSupported(const char
slouken@1926
   712
                                                           *extension);
slouken@1926
   713
slouken@1926
   714
/**
slouken@3407
   715
 *  \brief Set an OpenGL window attribute before window creation.
slouken@0
   716
 */
slouken@337
   717
extern DECLSPEC int SDLCALL SDL_GL_SetAttribute(SDL_GLattr attr, int value);
slouken@0
   718
slouken@1895
   719
/**
slouken@3407
   720
 *  \brief Get the actual value for an attribute from the current context.
slouken@0
   721
 */
slouken@1936
   722
extern DECLSPEC int SDLCALL SDL_GL_GetAttribute(SDL_GLattr attr, int *value);
slouken@0
   723
slouken@1895
   724
/**
slouken@3407
   725
 *  \brief Create an OpenGL context for use with an OpenGL window, and make it 
slouken@3407
   726
 *         current.
slouken@3407
   727
 *  
slouken@3407
   728
 *  \sa SDL_GL_DeleteContext()
slouken@1895
   729
 */
slouken@3685
   730
extern DECLSPEC SDL_GLContext SDLCALL SDL_GL_CreateContext(SDL_Window *
slouken@3685
   731
                                                           window);
slouken@1895
   732
slouken@1895
   733
/**
slouken@3407
   734
 *  \brief Set up an OpenGL context for rendering into an OpenGL window.
slouken@3407
   735
 *  
slouken@3407
   736
 *  \note The context must have been created with a compatible window.
slouken@1895
   737
 */
slouken@3685
   738
extern DECLSPEC int SDLCALL SDL_GL_MakeCurrent(SDL_Window * window,
slouken@1895
   739
                                               SDL_GLContext context);
slouken@1895
   740
slouken@1895
   741
/**
slouken@3407
   742
 *  \brief Set the swap interval for the current OpenGL context.
slouken@3407
   743
 *  
slouken@3407
   744
 *  \param interval 0 for immediate updates, 1 for updates synchronized with the
slouken@3407
   745
 *                  vertical retrace.
slouken@3407
   746
 *  
slouken@3407
   747
 *  \return 0 on success, or -1 if setting the swap interval is not supported.
slouken@3407
   748
 *  
slouken@3407
   749
 *  \sa SDL_GL_GetSwapInterval()
slouken@1895
   750
 */
slouken@1895
   751
extern DECLSPEC int SDLCALL SDL_GL_SetSwapInterval(int interval);
slouken@1895
   752
slouken@1895
   753
/**
slouken@3407
   754
 *  \brief Get the swap interval for the current OpenGL context.
slouken@3407
   755
 *  
slouken@3407
   756
 *  \return 0 if there is no vertical retrace synchronization, 1 if the buffer 
slouken@3407
   757
 *          swap is synchronized with the vertical retrace, and -1 if getting 
slouken@3407
   758
 *          the swap interval is not supported.
slouken@3407
   759
 *  
slouken@3407
   760
 *  \sa SDL_GL_SetSwapInterval()
slouken@1895
   761
 */
slouken@1895
   762
extern DECLSPEC int SDLCALL SDL_GL_GetSwapInterval(void);
slouken@1895
   763
slouken@1895
   764
/**
slouken@4883
   765
 * \brief Swap the OpenGL buffers for a window, if double-buffering is 
slouken@3407
   766
 *        supported.
slouken@0
   767
 */
slouken@3685
   768
extern DECLSPEC void SDLCALL SDL_GL_SwapWindow(SDL_Window * window);
slouken@0
   769
slouken@1895
   770
/**
slouken@3407
   771
 *  \brief Delete an OpenGL context.
slouken@3407
   772
 *  
slouken@3407
   773
 *  \sa SDL_GL_CreateContext()
slouken@0
   774
 */
slouken@1895
   775
extern DECLSPEC void SDLCALL SDL_GL_DeleteContext(SDL_GLContext context);
slouken@0
   776
slouken@3407
   777
/*@}*//*OpenGL support functions*/
slouken@3407
   778
slouken@0
   779
slouken@0
   780
/* Ends C function definitions when using C++ */
slouken@0
   781
#ifdef __cplusplus
slouken@1895
   782
/* *INDENT-OFF* */
slouken@0
   783
}
slouken@1895
   784
/* *INDENT-ON* */
slouken@0
   785
#endif
slouken@0
   786
#include "close_code.h"
slouken@0
   787
slouken@0
   788
#endif /* _SDL_video_h */
slouken@1895
   789
slouken@1895
   790
/* vi: set ts=4 sw=4 expandtab: */