include/SDL_video.h
author Sam Lantinga <slouken@libsdl.org>
Tue, 24 Mar 2009 10:43:53 +0000
changeset 3100 7dc982143c06
parent 3091 32efcc94b3da
child 3130 fef1a835af43
child 3139 7f684f249ec9
permissions -rw-r--r--
Date: Sun, 22 Mar 2009 12:52:29 +0000
From: Luke Benstead
Subject: OpenGL 3.0 Context Creation

I've attached a patch which implements OpenGL 3.x context creation on
the latest SVN. I've added two options to SDL_GL_SetAttribute, these
are SDL_GL_CONTEXT_MAJOR_VERSION and SDL_GL_CONTEXT_MINOR_VERSION.
These default to 2 and 1 respectively. If the major version is less
than 3 then the current context creation method is used, otherwise the
appropriate new context creation function is called (depending on the
platform).

Sample code:

if (SDL_Init(SDL_INIT_VIDEO) != 0) {
printf("Unable to initialize SDL: %s\n", SDL_GetError());
return 1;
}

SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 3); //Without these 2 lines, SDL will create a GL 2.x context
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 0);
SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);

SDL_Surface* screen = SDL_SetVideoMode( 640, 480, 16, SDL_OPENGL | SDL_FULLSCREEN );


I've implemented context creation on both Win32 and X and run basic
tests on both. This patch doesn't provide access to all the options
allowed by the new context creation (e.g. shared contexts, forward
compatible contexts) but they can be added pretty easily.
slouken@0
     1
/*
slouken@0
     2
    SDL - Simple DirectMedia Layer
slouken@2859
     3
    Copyright (C) 1997-2009 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@1895
    24
 * \file SDL_video.h
slouken@1895
    25
 *
slouken@2275
    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@1895
    46
 * \struct SDL_DisplayMode
slouken@1895
    47
 *
slouken@1895
    48
 * \brief  The structure that defines a display mode
slouken@1895
    49
 *
slouken@1895
    50
 * \sa SDL_GetNumDisplayModes()
slouken@1895
    51
 * \sa SDL_GetDisplayMode()
slouken@1895
    52
 * \sa SDL_GetDesktopDisplayMode()
slouken@1895
    53
 * \sa SDL_GetCurrentDisplayMode()
slouken@1895
    54
 * \sa SDL_GetClosestDisplayMode()
slouken@1895
    55
 * \sa SDL_SetDisplayMode()
slouken@1895
    56
 */
slouken@1895
    57
typedef struct
slouken@1895
    58
{
slouken@1895
    59
    Uint32 format;              /**< pixel format */
slouken@1895
    60
    int w;                      /**< width */
slouken@1895
    61
    int h;                      /**< height */
slouken@1895
    62
    int refresh_rate;           /**< refresh rate (or zero for unspecified) */
slouken@1895
    63
    void *driverdata;           /**< driver-specific data, initialize to 0 */
slouken@1895
    64
} SDL_DisplayMode;
slouken@0
    65
slouken@1895
    66
/**
slouken@1895
    67
 * \typedef SDL_WindowID
slouken@1895
    68
 *
slouken@1895
    69
 * \brief The type used to identify a window
slouken@1895
    70
 *
slouken@1895
    71
 * \sa SDL_CreateWindow()
slouken@1895
    72
 * \sa SDL_CreateWindowFrom()
slouken@1895
    73
 * \sa SDL_DestroyWindow()
slouken@1895
    74
 * \sa SDL_GetWindowData()
slouken@1895
    75
 * \sa SDL_GetWindowFlags()
slouken@1895
    76
 * \sa SDL_GetWindowGrab()
slouken@1895
    77
 * \sa SDL_GetWindowPosition()
slouken@1895
    78
 * \sa SDL_GetWindowSize()
slouken@1895
    79
 * \sa SDL_GetWindowTitle()
slouken@1895
    80
 * \sa SDL_HideWindow()
slouken@1895
    81
 * \sa SDL_MaximizeWindow()
slouken@1895
    82
 * \sa SDL_MinimizeWindow()
slouken@1895
    83
 * \sa SDL_RaiseWindow()
slouken@1895
    84
 * \sa SDL_RestoreWindow()
slouken@1895
    85
 * \sa SDL_SetWindowData()
slouken@1895
    86
 * \sa SDL_SetWindowFullscreen()
slouken@1895
    87
 * \sa SDL_SetWindowGrab()
slouken@1895
    88
 * \sa SDL_SetWindowIcon()
slouken@1895
    89
 * \sa SDL_SetWindowPosition()
slouken@1895
    90
 * \sa SDL_SetWindowSize()
slouken@1895
    91
 * \sa SDL_SetWindowTitle()
slouken@1895
    92
 * \sa SDL_ShowWindow()
slouken@1895
    93
 */
slouken@1895
    94
typedef Uint32 SDL_WindowID;
slouken@0
    95
slouken@1895
    96
/**
slouken@1895
    97
 * \enum SDL_WindowFlags
slouken@1895
    98
 *
slouken@1895
    99
 * \brief The flags on a window
slouken@1895
   100
 *
slouken@1895
   101
 * \sa SDL_GetWindowFlags()
slouken@1895
   102
 */
slouken@1895
   103
typedef enum
slouken@1895
   104
{
slouken@1895
   105
    SDL_WINDOW_FULLSCREEN = 0x00000001,         /**< fullscreen window, implies borderless */
slouken@1895
   106
    SDL_WINDOW_OPENGL = 0x00000002,             /**< window usable with OpenGL context */
slouken@1895
   107
    SDL_WINDOW_SHOWN = 0x00000004,              /**< window is visible */
slouken@1895
   108
    SDL_WINDOW_BORDERLESS = 0x00000008,         /**< no window decoration */
slouken@1895
   109
    SDL_WINDOW_RESIZABLE = 0x00000010,          /**< window can be resized */
slouken@1895
   110
    SDL_WINDOW_MINIMIZED = 0x00000020,          /**< minimized */
slouken@1895
   111
    SDL_WINDOW_MAXIMIZED = 0x00000040,          /**< maximized */
slouken@1895
   112
    SDL_WINDOW_INPUT_GRABBED = 0x00000100,      /**< window has grabbed input focus */
slouken@1895
   113
    SDL_WINDOW_INPUT_FOCUS = 0x00000200,        /**< window has input focus */
slouken@3057
   114
    SDL_WINDOW_MOUSE_FOCUS = 0x00000400,        /**< window has mouse focus */
slouken@3057
   115
    SDL_WINDOW_FOREIGN = 0x00000800             /**< window not created by SDL */
slouken@1895
   116
} SDL_WindowFlags;
slouken@0
   117
slouken@1895
   118
/**
slouken@1895
   119
 * \def SDL_WINDOWPOS_UNDEFINED
slouken@1895
   120
 * \brief Used to indicate that you don't care what the window position is.
slouken@1895
   121
 */
slouken@1895
   122
#define SDL_WINDOWPOS_UNDEFINED 0x7FFFFFF
slouken@1895
   123
/**
slouken@1895
   124
 * \def SDL_WINDOWPOS_CENTERED
slouken@1895
   125
 * \brief Used to indicate that the window position should be centered.
slouken@1895
   126
 */
slouken@1895
   127
#define SDL_WINDOWPOS_CENTERED  0x7FFFFFE
slouken@1895
   128
slouken@1895
   129
/**
slouken@1895
   130
 * \enum SDL_WindowEventID
slouken@1895
   131
 *
slouken@1895
   132
 * \brief Event subtype for window events
slouken@1895
   133
 */
slouken@1895
   134
typedef enum
slouken@1895
   135
{
slouken@1895
   136
    SDL_WINDOWEVENT_NONE,               /**< Never used */
slouken@1895
   137
    SDL_WINDOWEVENT_SHOWN,              /**< Window has been shown */
slouken@1895
   138
    SDL_WINDOWEVENT_HIDDEN,             /**< Window has been hidden */
slouken@1895
   139
    SDL_WINDOWEVENT_EXPOSED,            /**< Window has been exposed and should be redrawn */
slouken@1895
   140
    SDL_WINDOWEVENT_MOVED,              /**< Window has been moved to data1,data2 */
slouken@1895
   141
    SDL_WINDOWEVENT_RESIZED,            /**< Window size changed to data1xdata2 */
slouken@1895
   142
    SDL_WINDOWEVENT_MINIMIZED,          /**< Window has been minimized */
slouken@1895
   143
    SDL_WINDOWEVENT_MAXIMIZED,          /**< Window has been maximized */
slouken@1895
   144
    SDL_WINDOWEVENT_RESTORED,           /**< Window has been restored to normal size and position */
slouken@1895
   145
    SDL_WINDOWEVENT_ENTER,              /**< The window has gained mouse focus */
slouken@1895
   146
    SDL_WINDOWEVENT_LEAVE,              /**< The window has lost mouse focus */
slouken@1895
   147
    SDL_WINDOWEVENT_FOCUS_GAINED,       /**< The window has gained keyboard focus */
slouken@1895
   148
    SDL_WINDOWEVENT_FOCUS_LOST,         /**< The window has lost keyboard focus */
slouken@2208
   149
    SDL_WINDOWEVENT_CLOSE               /**< The window manager requests that the window be closed */
slouken@1895
   150
} SDL_WindowEventID;
slouken@1895
   151
slouken@1895
   152
/**
slouken@1895
   153
 * \enum SDL_RendererFlags
slouken@1895
   154
 *
slouken@1969
   155
 * \brief Flags used when creating a rendering context
slouken@1895
   156
 */
slouken@1895
   157
typedef enum
slouken@1895
   158
{
slouken@1965
   159
    SDL_RENDERER_SINGLEBUFFER = 0x00000001,     /**< Render directly to the window, if possible */
slouken@1965
   160
    SDL_RENDERER_PRESENTCOPY = 0x00000002,      /**< Present uses a copy from back buffer to the front buffer */
slouken@1965
   161
    SDL_RENDERER_PRESENTFLIP2 = 0x00000004,     /**< Present uses a flip, swapping back buffer and front buffer */
slouken@1965
   162
    SDL_RENDERER_PRESENTFLIP3 = 0x00000008,     /**< Present uses a flip, rotating between two back buffers and a front buffer */
slouken@1965
   163
    SDL_RENDERER_PRESENTDISCARD = 0x00000010,   /**< Present leaves the contents of the backbuffer undefined */
slouken@1965
   164
    SDL_RENDERER_PRESENTVSYNC = 0x00000020,     /**< Present is synchronized with the refresh rate */
slouken@2208
   165
    SDL_RENDERER_ACCELERATED = 0x00000040       /**< The renderer uses hardware acceleration */
slouken@1895
   166
} SDL_RendererFlags;
slouken@1895
   167
slouken@1895
   168
/**
slouken@1895
   169
 * \struct SDL_RendererInfo
slouken@1895
   170
 *
slouken@1969
   171
 * \brief Information on the capabilities of a render driver or context
slouken@1895
   172
 */
slouken@1895
   173
typedef struct SDL_RendererInfo
slouken@1895
   174
{
slouken@1895
   175
    const char *name;           /**< The name of the renderer */
slouken@1895
   176
    Uint32 flags;               /**< Supported SDL_RendererFlags */
slouken@1985
   177
    Uint32 mod_modes;           /**< A mask of supported channel modulation */
slouken@1895
   178
    Uint32 blend_modes;         /**< A mask of supported blend modes */
slouken@1895
   179
    Uint32 scale_modes;         /**< A mask of supported scale modes */
slouken@1895
   180
    Uint32 num_texture_formats; /**< The number of available texture formats */
slouken@1920
   181
    Uint32 texture_formats[20]; /**< The available texture formats */
slouken@1895
   182
    int max_texture_width;      /**< The maximimum texture width */
slouken@1895
   183
    int max_texture_height;     /**< The maximimum texture height */
slouken@1895
   184
} SDL_RendererInfo;
slouken@1895
   185
slouken@1895
   186
/**
slouken@1895
   187
 * \enum SDL_TextureAccess
slouken@1895
   188
 *
slouken@1895
   189
 * \brief The access pattern allowed for a texture
slouken@1895
   190
 */
slouken@1895
   191
typedef enum
slouken@1895
   192
{
slouken@2222
   193
    SDL_TEXTUREACCESS_STATIC,    /**< Changes rarely, not lockable */
slouken@2222
   194
    SDL_TEXTUREACCESS_STREAMING  /**< Changes frequently, lockable */
slouken@1895
   195
} SDL_TextureAccess;
slouken@1895
   196
slouken@1895
   197
/**
slouken@1985
   198
 * \enum SDL_TextureModulate
slouken@1985
   199
 *
slouken@1985
   200
 * \brief The texture channel modulation used in SDL_RenderCopy()
slouken@1985
   201
 */
slouken@1985
   202
typedef enum
slouken@1985
   203
{
slouken@1985
   204
    SDL_TEXTUREMODULATE_NONE = 0x00000000,     /**< No modulation */
slouken@1985
   205
    SDL_TEXTUREMODULATE_COLOR = 0x00000001,    /**< srcC = srcC * color */
slouken@2208
   206
    SDL_TEXTUREMODULATE_ALPHA = 0x00000002     /**< srcA = srcA * alpha */
slouken@1985
   207
} SDL_TextureModulate;
slouken@1985
   208
slouken@1985
   209
/**
slouken@2884
   210
 * \enum SDL_BlendMode
slouken@1895
   211
 *
slouken@2884
   212
 * \brief The blend mode used in SDL_RenderCopy() and drawing operations
slouken@1895
   213
 */
slouken@1895
   214
typedef enum
slouken@1895
   215
{
slouken@2884
   216
    SDL_BLENDMODE_NONE = 0x00000000,     /**< No blending */
slouken@2884
   217
    SDL_BLENDMODE_MASK = 0x00000001,     /**< dst = A ? src : dst (alpha is mask) */
slouken@2884
   218
    SDL_BLENDMODE_BLEND = 0x00000002,    /**< dst = (src * A) + (dst * (1-A)) */
slouken@2884
   219
    SDL_BLENDMODE_ADD = 0x00000004,      /**< dst = (src * A) + dst */
slouken@2884
   220
    SDL_BLENDMODE_MOD = 0x00000008       /**< dst = src * dst */
slouken@2884
   221
} SDL_BlendMode;
slouken@1895
   222
slouken@1895
   223
/**
slouken@1895
   224
 * \enum SDL_TextureScaleMode
slouken@1895
   225
 *
slouken@1985
   226
 * \brief The texture scale mode used in SDL_RenderCopy()
slouken@1895
   227
 */
slouken@1895
   228
typedef enum
slouken@1895
   229
{
slouken@1965
   230
    SDL_TEXTURESCALEMODE_NONE = 0x00000000,     /**< No scaling, rectangles must match dimensions */
slouken@1965
   231
    SDL_TEXTURESCALEMODE_FAST = 0x00000001,     /**< Point sampling or equivalent algorithm */
slouken@1965
   232
    SDL_TEXTURESCALEMODE_SLOW = 0x00000002,     /**< Linear filtering or equivalent algorithm */
slouken@2208
   233
    SDL_TEXTURESCALEMODE_BEST = 0x00000004      /**< Bicubic filtering or equivalent algorithm */
slouken@1895
   234
} SDL_TextureScaleMode;
slouken@1895
   235
slouken@1895
   236
/**
slouken@1895
   237
 * \typedef SDL_TextureID
slouken@1895
   238
 *
slouken@1895
   239
 * \brief An efficient driver-specific representation of pixel data
slouken@1895
   240
 */
slouken@1895
   241
typedef Uint32 SDL_TextureID;
slouken@1895
   242
slouken@1895
   243
/**
slouken@1895
   244
 * \typedef SDL_GLContext
slouken@1895
   245
 *
slouken@1895
   246
 * \brief An opaque handle to an OpenGL context.
slouken@1895
   247
 */
slouken@1895
   248
typedef void *SDL_GLContext;
slouken@1895
   249
slouken@1895
   250
/**
slouken@1895
   251
 * \enum SDL_GLattr
slouken@1895
   252
 *
slouken@1895
   253
 * \brief OpenGL configuration attributes
slouken@0
   254
 */
slouken@1895
   255
typedef enum
slouken@1895
   256
{
slouken@0
   257
    SDL_GL_RED_SIZE,
slouken@0
   258
    SDL_GL_GREEN_SIZE,
slouken@0
   259
    SDL_GL_BLUE_SIZE,
slouken@0
   260
    SDL_GL_ALPHA_SIZE,
slouken@0
   261
    SDL_GL_BUFFER_SIZE,
slouken@0
   262
    SDL_GL_DOUBLEBUFFER,
slouken@0
   263
    SDL_GL_DEPTH_SIZE,
slouken@0
   264
    SDL_GL_STENCIL_SIZE,
slouken@0
   265
    SDL_GL_ACCUM_RED_SIZE,
slouken@0
   266
    SDL_GL_ACCUM_GREEN_SIZE,
slouken@0
   267
    SDL_GL_ACCUM_BLUE_SIZE,
slouken@450
   268
    SDL_GL_ACCUM_ALPHA_SIZE,
slouken@655
   269
    SDL_GL_STEREO,
slouken@656
   270
    SDL_GL_MULTISAMPLEBUFFERS,
slouken@1736
   271
    SDL_GL_MULTISAMPLESAMPLES,
hfutrell@2747
   272
    SDL_GL_ACCELERATED_VISUAL,
slouken@3100
   273
    SDL_GL_RETAINED_BACKING,
slouken@3100
   274
	SDL_GL_CONTEXT_MAJOR_VERSION,
slouken@3100
   275
	SDL_GL_CONTEXT_MINOR_VERSION
slouken@0
   276
} SDL_GLattr;
slouken@0
   277
slouken@0
   278
slouken@0
   279
/* Function prototypes */
slouken@0
   280
slouken@1895
   281
/**
slouken@1895
   282
 * \fn int SDL_GetNumVideoDrivers(void)
slouken@0
   283
 *
slouken@1895
   284
 * \brief Get the number of video drivers compiled into SDL
slouken@0
   285
 *
slouken@1895
   286
 * \sa SDL_GetVideoDriver()
slouken@0
   287
 */
slouken@1895
   288
extern DECLSPEC int SDLCALL SDL_GetNumVideoDrivers(void);
slouken@1895
   289
slouken@1895
   290
/**
slouken@1895
   291
 * \fn const char *SDL_GetVideoDriver(int index)
slouken@1895
   292
 *
slouken@1895
   293
 * \brief Get the name of a built in video driver.
slouken@1895
   294
 *
slouken@1895
   295
 * \note The video drivers are presented in the order in which they are
slouken@1895
   296
 * normally checked during initialization.
slouken@1895
   297
 *
slouken@1895
   298
 * \sa SDL_GetNumVideoDrivers()
slouken@1895
   299
 */
slouken@1895
   300
extern DECLSPEC const char *SDLCALL SDL_GetVideoDriver(int index);
slouken@1895
   301
slouken@1895
   302
/**
slouken@1895
   303
 * \fn int SDL_VideoInit(const char *driver_name, Uint32 flags)
slouken@1895
   304
 *
slouken@1895
   305
 * \brief Initialize the video subsystem, optionally specifying a video driver.
slouken@1895
   306
 *
slouken@1895
   307
 * \param driver_name Initialize a specific driver by name, or NULL for the default video driver.
slouken@1895
   308
 * \param flags FIXME: Still needed?
slouken@1895
   309
 *
slouken@1895
   310
 * \return 0 on success, -1 on error
slouken@1895
   311
 *
slouken@1895
   312
 * This function initializes the video subsystem; setting up a connection
slouken@1895
   313
 * to the window manager, etc, and determines the available display modes
slouken@1895
   314
 * and pixel formats, but does not initialize a window or graphics mode.
slouken@1895
   315
 *
slouken@1895
   316
 * \sa SDL_VideoQuit()
slouken@1895
   317
 */
slouken@1895
   318
extern DECLSPEC int SDLCALL SDL_VideoInit(const char *driver_name,
slouken@1895
   319
                                          Uint32 flags);
slouken@1895
   320
slouken@1895
   321
/**
slouken@1895
   322
 * \fn void SDL_VideoQuit(void)
slouken@1895
   323
 *
slouken@1895
   324
 * \brief Shuts down the video subsystem.
slouken@1895
   325
 *
slouken@1895
   326
 * This function closes all windows, and restores the original video mode.
slouken@1895
   327
 *
slouken@1895
   328
 * \sa SDL_VideoInit()
slouken@1895
   329
 */
slouken@337
   330
extern DECLSPEC void SDLCALL SDL_VideoQuit(void);
slouken@0
   331
slouken@1895
   332
/**
slouken@1895
   333
 * \fn const char *SDL_GetCurrentVideoDriver(void)
slouken@1895
   334
 *
slouken@1895
   335
 * \brief Returns the name of the currently initialized video driver.
slouken@1895
   336
 *
slouken@1895
   337
 * \return The name of the current video driver or NULL if no driver
slouken@1895
   338
 *         has been initialized
slouken@1895
   339
 *
slouken@1895
   340
 * \sa SDL_GetNumVideoDrivers()
slouken@1895
   341
 * \sa SDL_GetVideoDriver()
slouken@0
   342
 */
slouken@1895
   343
extern DECLSPEC const char *SDLCALL SDL_GetCurrentVideoDriver(void);
slouken@0
   344
slouken@1895
   345
/**
slouken@1895
   346
 * \fn int SDL_GetNumVideoDisplays(void)
slouken@1895
   347
 *
slouken@1895
   348
 * \brief Returns the number of available video displays.
slouken@1895
   349
 *
slouken@1895
   350
 * \sa SDL_SelectVideoDisplay()
slouken@0
   351
 */
slouken@1895
   352
extern DECLSPEC int SDLCALL SDL_GetNumVideoDisplays(void);
slouken@0
   353
slouken@1895
   354
/**
slouken@1895
   355
 * \fn int SDL_SelectVideoDisplay(int index)
slouken@1895
   356
 *
slouken@1895
   357
 * \brief Set the index of the currently selected display.
slouken@1895
   358
 *
slouken@1963
   359
 * \return 0 on success, or -1 if the index is out of range.
slouken@1963
   360
 *
slouken@1963
   361
 * \sa SDL_GetNumVideoDisplays()
slouken@1963
   362
 * \sa SDL_GetCurrentVideoDisplay()
slouken@1963
   363
 */
slouken@1963
   364
extern DECLSPEC int SDLCALL SDL_SelectVideoDisplay(int index);
slouken@1963
   365
slouken@1963
   366
/**
slouken@1963
   367
 * \fn int SDL_GetCurrentVideoDisplay(void)
slouken@1963
   368
 *
slouken@1963
   369
 * \brief Get the index of the currently selected display.
slouken@1963
   370
 *
slouken@1895
   371
 * \return The index of the currently selected display.
slouken@1895
   372
 *
slouken@1895
   373
 * \sa SDL_GetNumVideoDisplays()
slouken@1963
   374
 * \sa SDL_SelectVideoDisplay()
slouken@0
   375
 */
slouken@1963
   376
extern DECLSPEC int SDLCALL SDL_GetCurrentVideoDisplay(void);
slouken@0
   377
slouken@1895
   378
/**
slouken@1895
   379
 * \fn int SDL_GetNumDisplayModes(void)
slouken@0
   380
 *
slouken@1895
   381
 * \brief Returns the number of available display modes for the current display.
slouken@1895
   382
 *
slouken@1895
   383
 * \sa SDL_GetDisplayMode()
slouken@0
   384
 */
slouken@1895
   385
extern DECLSPEC int SDLCALL SDL_GetNumDisplayModes(void);
slouken@0
   386
slouken@1895
   387
/**
slouken@1967
   388
 * \fn int SDL_GetDisplayMode(int index, SDL_DisplayMode *mode)
slouken@0
   389
 *
slouken@1968
   390
 * \brief Fill in information about a specific display mode.
slouken@1895
   391
 *
slouken@1895
   392
 * \note The display modes are sorted in this priority:
slouken@1895
   393
 *       \li bits per pixel -> more colors to fewer colors
slouken@1895
   394
 *       \li width -> largest to smallest
slouken@1895
   395
 *       \li height -> largest to smallest
slouken@1895
   396
 *       \li refresh rate -> highest to lowest
slouken@1895
   397
 *
slouken@1895
   398
 * \sa SDL_GetNumDisplayModes()
slouken@0
   399
 */
slouken@1967
   400
extern DECLSPEC int SDLCALL SDL_GetDisplayMode(int index,
slouken@1967
   401
                                               SDL_DisplayMode * mode);
slouken@0
   402
slouken@1895
   403
/**
slouken@1967
   404
 * \fn int SDL_GetDesktopDisplayMode(SDL_DisplayMode *mode)
slouken@0
   405
 *
slouken@1968
   406
 * \brief Fill in information about the desktop display mode for the current display.
slouken@1895
   407
 */
slouken@1967
   408
extern DECLSPEC int SDLCALL SDL_GetDesktopDisplayMode(SDL_DisplayMode * mode);
slouken@1895
   409
slouken@1895
   410
/**
slouken@1967
   411
 * \fn int SDL_GetCurrentDisplayMode(SDL_DisplayMode *mode)
slouken@0
   412
 *
slouken@1968
   413
 * \brief Fill in information about the current display mode.
slouken@1895
   414
 */
slouken@1967
   415
extern DECLSPEC int SDLCALL SDL_GetCurrentDisplayMode(SDL_DisplayMode * mode);
slouken@1895
   416
slouken@1895
   417
/**
slouken@1895
   418
 * \fn SDL_DisplayMode *SDL_GetClosestDisplayMode(const SDL_DisplayMode *mode, SDL_DisplayMode *closest)
slouken@0
   419
 *
slouken@1895
   420
 * \brief Get the closest match to the requested display mode.
slouken@0
   421
 *
slouken@1895
   422
 * \param mode The desired display mode
slouken@1895
   423
 * \param closest A pointer to a display mode to be filled in with the closest match of the available display modes.
slouken@0
   424
 *
slouken@1895
   425
 * \return The passed in value 'closest', or NULL if no matching video mode was available.
slouken@0
   426
 *
slouken@1895
   427
 * The available display modes are scanned, and 'closest' is filled in with the closest mode matching the requested mode and returned.  The mode format and refresh_rate default to the desktop mode if they are 0.  The modes are scanned with size being first priority, format being second priority, and finally checking the refresh_rate.  If all the available modes are too small, then NULL is returned.
slouken@0
   428
 *
slouken@1895
   429
 * \sa SDL_GetNumDisplayModes()
slouken@1895
   430
 * \sa SDL_GetDisplayMode()
slouken@1895
   431
 */
slouken@1895
   432
extern DECLSPEC SDL_DisplayMode *SDLCALL SDL_GetClosestDisplayMode(const
slouken@1895
   433
                                                                   SDL_DisplayMode
slouken@1895
   434
                                                                   * mode,
slouken@1895
   435
                                                                   SDL_DisplayMode
slouken@1895
   436
                                                                   * closest);
slouken@1895
   437
slouken@1895
   438
/**
slouken@1895
   439
 * \fn int SDL_SetFullscreenDisplayMode(const SDL_DisplayMode *mode)
slouken@0
   440
 *
slouken@1895
   441
 * \brief Set the display mode used when a fullscreen window is visible
slouken@1895
   442
 *        on the currently selected display.
slouken@0
   443
 *
slouken@1895
   444
 * \param mode The mode to use, or NULL for the desktop mode.
slouken@0
   445
 *
slouken@1895
   446
 * \return 0 on success, or -1 if setting the display mode failed.
slouken@0
   447
 *
slouken@1895
   448
 * \sa SDL_SetWindowFullscreen()
slouken@0
   449
 */
slouken@1895
   450
extern DECLSPEC int SDLCALL SDL_SetFullscreenDisplayMode(const SDL_DisplayMode
slouken@1895
   451
                                                         * mode);
slouken@0
   452
slouken@1895
   453
/**
slouken@1967
   454
 * \fn int SDL_GetFullscreenDisplayMode(SDL_DisplayMode *mode)
slouken@1895
   455
 *
slouken@1968
   456
 * \brief Fill in information about the display mode used when a fullscreen
slouken@1968
   457
 *        window is visible on the currently selected display.
slouken@0
   458
 */
slouken@1967
   459
extern DECLSPEC int SDLCALL SDL_GetFullscreenDisplayMode(SDL_DisplayMode *
slouken@1967
   460
                                                         mode);
slouken@0
   461
slouken@1895
   462
/**
slouken@1895
   463
 * \fn int SDL_SetDisplayPalette(const SDL_Color *colors, int firstcolor, int ncolors)
slouken@1895
   464
 *
slouken@1895
   465
 * \brief Set the palette entries for indexed display modes.
slouken@1895
   466
 *
slouken@1895
   467
 * \return 0 on success, or -1 if the display mode isn't palettized or the colors couldn't be set.
slouken@0
   468
 */
slouken@1895
   469
extern DECLSPEC int SDLCALL SDL_SetDisplayPalette(const SDL_Color * colors,
slouken@1895
   470
                                                  int firstcolor,
slouken@1895
   471
                                                  int ncolors);
slouken@0
   472
slouken@1895
   473
/**
slouken@1895
   474
 * \fn int SDL_GetDisplayPalette(SDL_Color *colors, int firstcolor, int ncolors)
slouken@1895
   475
 *
slouken@1895
   476
 * \brief Gets the palette entries for indexed display modes.
slouken@1895
   477
 *
slouken@1895
   478
 * \return 0 on success, or -1 if the display mode isn't palettized
slouken@1895
   479
 */
slouken@1895
   480
extern DECLSPEC int SDLCALL SDL_GetDisplayPalette(SDL_Color * colors,
slouken@1895
   481
                                                  int firstcolor,
slouken@1895
   482
                                                  int ncolors);
slouken@1895
   483
slouken@1895
   484
/**
slouken@1895
   485
 * \fn int SDL_SetGamma(float red, float green, float blue)
slouken@1895
   486
 *
slouken@1895
   487
 * \brief Set the gamma correction for each of the color channels on the currently selected display.
slouken@1895
   488
 *
slouken@1895
   489
 * \return 0 on success, or -1 if setting the gamma isn't supported.
slouken@1895
   490
 *
slouken@1895
   491
 * \sa SDL_SetGammaRamp()
slouken@0
   492
 */
slouken@337
   493
extern DECLSPEC int SDLCALL SDL_SetGamma(float red, float green, float blue);
slouken@0
   494
slouken@1895
   495
/**
slouken@1895
   496
 * \fn int SDL_SetGammaRamp(const Uint16 * red, const Uint16 * green, const Uint16 * blue)
slouken@1895
   497
 *
slouken@1895
   498
 * \brief Set the gamma ramp for the currently selected display.
slouken@1895
   499
 *
slouken@1895
   500
 * \param red The translation table for the red channel, or NULL
slouken@1895
   501
 * \param green The translation table for the green channel, or NULL
slouken@1895
   502
 * \param blue The translation table for the blue channel, or NULL
slouken@1895
   503
 *
slouken@1895
   504
 * \return 0 on success, or -1 if gamma ramps are unsupported.
slouken@1895
   505
 *
slouken@0
   506
 * Set the gamma translation table for the red, green, and blue channels
slouken@0
   507
 * of the video hardware.  Each table is an array of 256 16-bit quantities,
slouken@0
   508
 * representing a mapping between the input and output for that channel.
slouken@0
   509
 * The input is the index into the array, and the output is the 16-bit
slouken@0
   510
 * gamma value at that index, scaled to the output color precision.
slouken@0
   511
 * 
slouken@1895
   512
 * \sa SDL_GetGammaRamp()
slouken@0
   513
 */
slouken@1895
   514
extern DECLSPEC int SDLCALL SDL_SetGammaRamp(const Uint16 * red,
slouken@1895
   515
                                             const Uint16 * green,
slouken@1895
   516
                                             const Uint16 * blue);
slouken@0
   517
slouken@1895
   518
/**
slouken@1895
   519
 * \fn int SDL_GetGammaRamp(Uint16 * red, Uint16 * green, Uint16 * blue)
slouken@1895
   520
 *
slouken@1895
   521
 * \brief Get the gamma ramp for the currently selected display.
slouken@1895
   522
 *
slouken@1895
   523
 * \param red A pointer to a 256 element array of 16-bit quantities to hold the translation table for the red channel, or NULL.
slouken@1895
   524
 * \param green A pointer to a 256 element array of 16-bit quantities to hold the translation table for the green channel, or NULL.
slouken@1895
   525
 * \param blue A pointer to a 256 element array of 16-bit quantities to hold the translation table for the blue channel, or NULL.
slouken@0
   526
 * 
slouken@1895
   527
 * \return 0 on success, or -1 if gamma ramps are unsupported.
slouken@1895
   528
 *
slouken@1895
   529
 * \sa SDL_SetGammaRamp()
slouken@0
   530
 */
slouken@1895
   531
extern DECLSPEC int SDLCALL SDL_GetGammaRamp(Uint16 * red, Uint16 * green,
slouken@1895
   532
                                             Uint16 * blue);
slouken@0
   533
slouken@1895
   534
slouken@1895
   535
/**
slouken@1895
   536
 * \fn SDL_WindowID SDL_CreateWindow(const char *title, int x, int y, int w, int h, Uint32 flags)
slouken@0
   537
 *
slouken@1895
   538
 * \brief Create a window with the specified position, dimensions, and flags.
slouken@1895
   539
 *
slouken@1956
   540
 * \param title The title of the window, in UTF-8 encoding
slouken@1956
   541
 * \param x The x position of the window, SDL_WINDOWPOS_CENTERED, or SDL_WINDOWPOS_UNDEFINED
slouken@1956
   542
 * \param y The y position of the window, SDL_WINDOWPOS_CENTERED, or SDL_WINDOWPOS_UNDEFINED
slouken@1895
   543
 * \param w The width of the window
slouken@1895
   544
 * \param h The height of the window
slouken@1895
   545
 * \param flags The flags for the window, a mask of any of the following: SDL_WINDOW_FULLSCREEN, SDL_WINDOW_OPENGL, SDL_WINDOW_SHOWN, SDL_WINDOW_BORDERLESS, SDL_WINDOW_RESIZABLE, SDL_WINDOW_MAXIMIZED, SDL_WINDOW_MINIMIZED, SDL_WINDOW_INPUT_GRABBED
slouken@1895
   546
 *
slouken@1895
   547
 * \return The id of the window created, or zero if window creation failed.
slouken@1895
   548
 *
slouken@1895
   549
 * \sa SDL_DestroyWindow()
slouken@0
   550
 */
slouken@1895
   551
extern DECLSPEC SDL_WindowID SDLCALL SDL_CreateWindow(const char *title,
slouken@1895
   552
                                                      int x, int y, int w,
slouken@1895
   553
                                                      int h, Uint32 flags);
slouken@0
   554
slouken@1895
   555
/**
slouken@1895
   556
 * \fn SDL_WindowID SDL_CreateWindowFrom(void *data)
slouken@0
   557
 *
slouken@1895
   558
 * \brief Create an SDL window struct from an existing native window.
slouken@0
   559
 *
slouken@1895
   560
 * \param data A pointer to driver-dependent window creation data
slouken@1895
   561
 *
slouken@1895
   562
 * \return The id of the window created, or zero if window creation failed.
slouken@1895
   563
 *
slouken@1895
   564
 * \warning This function is NOT SUPPORTED, use at your own risk!
slouken@1895
   565
 *
slouken@1895
   566
 * \sa SDL_DestroyWindow()
slouken@0
   567
 */
slouken@1895
   568
extern DECLSPEC SDL_WindowID SDLCALL SDL_CreateWindowFrom(const void *data);
slouken@1895
   569
slouken@1895
   570
/**
slouken@1895
   571
 * \fn Uint32 SDL_GetWindowFlags(SDL_WindowID windowID)
slouken@1895
   572
 *
slouken@1895
   573
 * \brief Get the window flags.
slouken@1895
   574
 */
slouken@1895
   575
extern DECLSPEC Uint32 SDLCALL SDL_GetWindowFlags(SDL_WindowID windowID);
slouken@1895
   576
slouken@1895
   577
/**
slouken@1895
   578
 * \fn void SDL_SetWindowTitle(SDL_WindowID windowID, const char *title)
slouken@1895
   579
 *
slouken@1895
   580
 * \brief Set the title of the window, in UTF-8 format.
slouken@1895
   581
 *
slouken@1895
   582
 * \sa SDL_GetWindowTitle()
slouken@1895
   583
 */
slouken@1895
   584
extern DECLSPEC void SDLCALL SDL_SetWindowTitle(SDL_WindowID windowID,
slouken@1895
   585
                                                const char *title);
slouken@1895
   586
slouken@1895
   587
/**
slouken@1895
   588
 * \fn const char *SDL_GetWindowTitle(SDL_WindowID windowID)
slouken@1895
   589
 *
slouken@1895
   590
 * \brief Get the title of the window, in UTF-8 format.
slouken@1895
   591
 *
slouken@1895
   592
 * \sa SDL_SetWindowTitle()
slouken@1895
   593
 */
slouken@1895
   594
extern DECLSPEC const char *SDLCALL SDL_GetWindowTitle(SDL_WindowID windowID);
slouken@1895
   595
slouken@1895
   596
/**
slouken@2967
   597
 * \fn void SDL_SetWindowIcon(SDL_WindowID windowID, SDL_Surface *icon)
slouken@1895
   598
 *
slouken@1895
   599
 * \brief Set the icon of the window.
slouken@1895
   600
 *
slouken@1895
   601
 * \param icon The icon for the window
slouken@1895
   602
 */
slouken@2990
   603
extern DECLSPEC void SDLCALL SDL_SetWindowIcon(SDL_WindowID windowID,
slouken@2990
   604
                                               SDL_Surface * icon);
slouken@1895
   605
slouken@1895
   606
/**
slouken@1895
   607
 * \fn void SDL_SetWindowData(SDL_WindowID windowID, void *userdata)
slouken@1895
   608
 *
slouken@1895
   609
 * \brief Associate an arbitrary pointer with the window.
slouken@1895
   610
 *
slouken@1895
   611
 * \sa SDL_GetWindowData()
slouken@1895
   612
 */
slouken@1895
   613
extern DECLSPEC void SDLCALL SDL_SetWindowData(SDL_WindowID windowID,
slouken@1895
   614
                                               void *userdata);
slouken@1895
   615
slouken@1895
   616
/**
slouken@1895
   617
 * \fn void *SDL_GetWindowData(SDL_WindowID windowID)
slouken@1895
   618
 *
slouken@1895
   619
 * \brief Retrieve the data pointer associated with the window.
slouken@1895
   620
 *
slouken@1895
   621
 * \sa SDL_SetWindowData()
slouken@1895
   622
 */
slouken@1895
   623
extern DECLSPEC void *SDLCALL SDL_GetWindowData(SDL_WindowID windowID);
slouken@1895
   624
slouken@1895
   625
/**
slouken@1895
   626
 * \fn void SDL_SetWindowPosition(SDL_WindowID windowID, int x, int y)
slouken@1895
   627
 *
slouken@1895
   628
 * \brief Set the position of the window.
slouken@1895
   629
 *
slouken@1895
   630
 * \param windowID The window to reposition
slouken@1895
   631
 * \param x The x coordinate of the window, SDL_WINDOWPOS_CENTERED, or SDL_WINDOWPOS_UNDEFINED
slouken@1895
   632
 * \param y The y coordinate of the window, SDL_WINDOWPOS_CENTERED, or SDL_WINDOWPOS_UNDEFINED
slouken@1895
   633
 *
slouken@1895
   634
 * \note The window coordinate origin is the upper left of the display.
slouken@1895
   635
 *
slouken@1895
   636
 * \sa SDL_GetWindowPosition()
slouken@1895
   637
 */
slouken@1895
   638
extern DECLSPEC void SDLCALL SDL_SetWindowPosition(SDL_WindowID windowID,
slouken@1895
   639
                                                   int x, int y);
slouken@1895
   640
slouken@1895
   641
/**
slouken@1895
   642
 * \fn void SDL_GetWindowPosition(SDL_WindowID windowID, int *x, int *y)
slouken@1895
   643
 *
slouken@1895
   644
 * \brief Get the position of the window.
slouken@1895
   645
 *
slouken@1895
   646
 * \sa SDL_SetWindowPosition()
slouken@1895
   647
 */
slouken@1895
   648
extern DECLSPEC void SDLCALL SDL_GetWindowPosition(SDL_WindowID windowID,
slouken@1895
   649
                                                   int *x, int *y);
slouken@1895
   650
slouken@1895
   651
/**
slouken@1895
   652
 * \fn void SDL_SetWindowSize(SDL_WindowID windowID, int w, int w)
slouken@1895
   653
 *
slouken@1895
   654
 * \brief Set the size of the window's client area.
slouken@1895
   655
 *
slouken@1895
   656
 * \note You can't change the size of a fullscreen window, it automatically
slouken@1895
   657
 * matches the size of the display mode.
slouken@1895
   658
 *
slouken@1895
   659
 * \sa SDL_GetWindowSize()
slouken@1895
   660
 */
slouken@1895
   661
extern DECLSPEC void SDLCALL SDL_SetWindowSize(SDL_WindowID windowID, int w,
slouken@1895
   662
                                               int h);
slouken@1895
   663
slouken@1895
   664
/**
slouken@2907
   665
 * \fn void SDL_GetWindowSize(SDL_WindowID windowID, int *w, int *h)
slouken@1895
   666
 *
slouken@1895
   667
 * \brief Get the size of the window's client area.
slouken@1895
   668
 *
slouken@1895
   669
 * \sa SDL_SetWindowSize()
slouken@1895
   670
 */
slouken@1895
   671
extern DECLSPEC void SDLCALL SDL_GetWindowSize(SDL_WindowID windowID, int *w,
slouken@1895
   672
                                               int *h);
slouken@1895
   673
slouken@1895
   674
/**
slouken@1895
   675
 * \fn void SDL_ShowWindow(SDL_WindowID windowID)
slouken@1895
   676
 *
slouken@1895
   677
 * \brief Show the window
slouken@1895
   678
 *
slouken@1895
   679
 * \sa SDL_HideWindow()
slouken@1895
   680
 */
slouken@1895
   681
extern DECLSPEC void SDLCALL SDL_ShowWindow(SDL_WindowID windowID);
slouken@1895
   682
slouken@1895
   683
/**
slouken@1895
   684
 * \fn void SDL_HideWindow(SDL_WindowID windowID)
slouken@1895
   685
 *
slouken@1895
   686
 * \brief Hide the window
slouken@1895
   687
 *
slouken@1895
   688
 * \sa SDL_ShowWindow()
slouken@1895
   689
 */
slouken@1895
   690
extern DECLSPEC void SDLCALL SDL_HideWindow(SDL_WindowID windowID);
slouken@1895
   691
slouken@1895
   692
/**
slouken@1895
   693
 * \fn void SDL_RaiseWindow(SDL_WindowID windowID)
slouken@1895
   694
 *
slouken@1895
   695
 * \brief Raise the window above other windows and set the input focus.
slouken@1895
   696
 */
slouken@1895
   697
extern DECLSPEC void SDLCALL SDL_RaiseWindow(SDL_WindowID windowID);
slouken@1895
   698
slouken@1895
   699
/**
slouken@1895
   700
 * \fn void SDL_MaximizeWindow(SDL_WindowID windowID)
slouken@1895
   701
 *
slouken@1895
   702
 * \brief Make the window as large as possible.
slouken@1895
   703
 *
slouken@1895
   704
 * \sa SDL_RestoreWindow()
slouken@1895
   705
 */
slouken@1895
   706
extern DECLSPEC void SDLCALL SDL_MaximizeWindow(SDL_WindowID windowID);
slouken@1895
   707
slouken@1895
   708
/**
slouken@1895
   709
 * \fn void SDL_MinimizeWindow(SDL_WindowID windowID)
slouken@1895
   710
 *
slouken@1895
   711
 * \brief Minimize the window to an iconic representation.
slouken@1895
   712
 *
slouken@1895
   713
 * \sa SDL_RestoreWindow()
slouken@1895
   714
 */
slouken@1895
   715
extern DECLSPEC void SDLCALL SDL_MinimizeWindow(SDL_WindowID windowID);
slouken@1895
   716
slouken@1895
   717
/**
slouken@1895
   718
 * \fn void SDL_RestoreWindow(SDL_WindowID windowID)
slouken@1895
   719
 *
slouken@1895
   720
 * \brief Restore the size and position of a minimized or maximized window.
slouken@1895
   721
 *
slouken@1895
   722
 * \sa SDL_MaximizeWindow()
slouken@1895
   723
 * \sa SDL_MinimizeWindow()
slouken@1895
   724
 */
slouken@1895
   725
extern DECLSPEC void SDLCALL SDL_RestoreWindow(SDL_WindowID windowID);
slouken@1895
   726
slouken@1895
   727
/**
slouken@1895
   728
 * \fn int SDL_SetWindowFullscreen(SDL_WindowID windowID, int fullscreen)
slouken@1895
   729
 *
slouken@1895
   730
 * \brief Set the window's fullscreen state.
slouken@1895
   731
 *
slouken@1895
   732
 * \return 0 on success, or -1 if setting the display mode failed.
slouken@1895
   733
 *
slouken@1895
   734
 * \sa SDL_SetFullscreenDisplayMode()
slouken@1895
   735
 */
slouken@1895
   736
extern DECLSPEC int SDLCALL SDL_SetWindowFullscreen(SDL_WindowID windowID,
slouken@1895
   737
                                                    int fullscreen);
slouken@1895
   738
slouken@1895
   739
/**
slouken@1895
   740
 * \fn void SDL_SetWindowGrab(SDL_WindowID windowID, int mode)
slouken@1895
   741
 *
slouken@1895
   742
 * \brief Set the window's input grab mode.
slouken@1895
   743
 *
slouken@1895
   744
 * \param mode This is 1 to grab input, and 0 to release input.
slouken@1895
   745
 *
slouken@1895
   746
 * \sa SDL_GetWindowGrab()
slouken@1895
   747
 */
slouken@1895
   748
extern DECLSPEC void SDLCALL SDL_SetWindowGrab(SDL_WindowID windowID,
slouken@1895
   749
                                               int mode);
slouken@1895
   750
slouken@1895
   751
/**
slouken@1895
   752
 * \fn int SDL_GetWindowGrab(SDL_WindowID windowID)
slouken@1895
   753
 *
slouken@1895
   754
 * \brief Get the window's input grab mode.
slouken@1895
   755
 *
slouken@1895
   756
 * \return This returns 1 if input is grabbed, and 0 otherwise.
slouken@1895
   757
 *
slouken@1895
   758
 * \sa SDL_SetWindowGrab()
slouken@1895
   759
 */
slouken@1895
   760
extern DECLSPEC int SDLCALL SDL_GetWindowGrab(SDL_WindowID windowID);
slouken@1895
   761
slouken@1895
   762
/**
slouken@1895
   763
 * \fn SDL_bool SDL_GetWindowWMInfo(SDL_WindowID windowID, struct SDL_SysWMinfo * info)
slouken@1895
   764
 *
slouken@1895
   765
 * \brief Get driver specific information about a window.
slouken@1895
   766
 *
slouken@1895
   767
 * \note Include SDL_syswm.h for the declaration of SDL_SysWMinfo.
slouken@1895
   768
 */
slouken@1895
   769
struct SDL_SysWMinfo;
slouken@1895
   770
extern DECLSPEC SDL_bool SDLCALL SDL_GetWindowWMInfo(SDL_WindowID windowID,
slouken@1895
   771
                                                     struct SDL_SysWMinfo
slouken@1895
   772
                                                     *info);
slouken@1895
   773
slouken@1895
   774
/**
slouken@1895
   775
 * \fn void SDL_DestroyWindow(SDL_WindowID windowID)
slouken@1895
   776
 *
slouken@1895
   777
 * \brief Destroy a window.
slouken@1895
   778
 */
slouken@1895
   779
extern DECLSPEC void SDLCALL SDL_DestroyWindow(SDL_WindowID windowID);
slouken@1895
   780
slouken@1895
   781
/**
slouken@1969
   782
 * \fn int SDL_GetNumRenderDrivers(void)
slouken@1895
   783
 *
slouken@1969
   784
 * \brief Get the number of 2D rendering drivers available for the current display.
slouken@1895
   785
 *
slouken@1969
   786
 * A render driver is a set of code that handles rendering and texture
slouken@1895
   787
 * management on a particular display.  Normally there is only one, but
slouken@1895
   788
 * some drivers may have several available with different capabilities.
slouken@1895
   789
 *
slouken@1969
   790
 * \sa SDL_GetRenderDriverInfo()
slouken@1895
   791
 * \sa SDL_CreateRenderer()
slouken@1895
   792
 */
slouken@1969
   793
extern DECLSPEC int SDLCALL SDL_GetNumRenderDrivers(void);
slouken@1895
   794
slouken@1895
   795
/**
slouken@1969
   796
 * \fn int SDL_GetRenderDriverInfo(int index, SDL_RendererInfo *info)
slouken@1895
   797
 *
slouken@1969
   798
 * \brief Get information about a specific 2D rendering driver for the current display.
slouken@1895
   799
 *
slouken@1969
   800
 * \param index The index of the driver to query information about.
slouken@1969
   801
 * \param info A pointer to an SDL_RendererInfo struct to be filled with information on the rendering driver.
slouken@1907
   802
 *
slouken@1907
   803
 * \return 0 on success, -1 if the index was out of range
slouken@1907
   804
 *
slouken@1895
   805
 * \sa SDL_CreateRenderer()
slouken@1895
   806
 */
slouken@1969
   807
extern DECLSPEC int SDLCALL SDL_GetRenderDriverInfo(int index,
slouken@1969
   808
                                                    SDL_RendererInfo * info);
slouken@1895
   809
slouken@1895
   810
/**
slouken@1895
   811
 * \fn int SDL_CreateRenderer(SDL_WindowID window, int index, Uint32 flags)
slouken@1895
   812
 *
slouken@1895
   813
 * \brief Create and make active a 2D rendering context for a window.
slouken@1895
   814
 *
slouken@1895
   815
 * \param windowID The window used for rendering
slouken@1969
   816
 * \param index The index of the rendering driver to initialize, or -1 to initialize the first one supporting the requested flags.
slouken@1895
   817
 * \param flags SDL_RendererFlags
slouken@1895
   818
 *
slouken@3091
   819
 * \return 0 on success, -1 if there was an error creating the renderer.
slouken@1895
   820
 *
slouken@1895
   821
 * \sa SDL_SelectRenderer()
slouken@1969
   822
 * \sa SDL_GetRendererInfo()
slouken@1895
   823
 * \sa SDL_DestroyRenderer()
slouken@1895
   824
 */
slouken@1895
   825
extern DECLSPEC int SDLCALL SDL_CreateRenderer(SDL_WindowID windowID,
slouken@1895
   826
                                               int index, Uint32 flags);
slouken@1895
   827
slouken@1895
   828
/**
slouken@1895
   829
 * \fn int SDL_SelectRenderer(SDL_WindowID windowID)
slouken@1895
   830
 *
slouken@1895
   831
 * \brief Select the rendering context for a particular window.
slouken@1895
   832
 *
slouken@1895
   833
 * \return 0 on success, -1 if the selected window doesn't have a
slouken@1895
   834
 *         rendering context.
slouken@1895
   835
 */
slouken@1895
   836
extern DECLSPEC int SDLCALL SDL_SelectRenderer(SDL_WindowID windowID);
slouken@1895
   837
slouken@1895
   838
/**
slouken@1969
   839
 * \fn int SDL_GetRendererInfo(SDL_RendererInfo *info)
slouken@1969
   840
 *
slouken@1969
   841
 * \brief Get information about the current rendering context.
slouken@1969
   842
 */
slouken@1969
   843
extern DECLSPEC int SDLCALL SDL_GetRendererInfo(SDL_RendererInfo * info);
slouken@1969
   844
slouken@1969
   845
/**
slouken@1895
   846
 * \fn SDL_TextureID SDL_CreateTexture(Uint32 format, int access, int w, int h)
slouken@1895
   847
 *
slouken@1895
   848
 * \brief Create a texture for the current rendering context.
slouken@1895
   849
 *
slouken@1895
   850
 * \param format The format of the texture
slouken@1895
   851
 * \param access One of the enumerated values in SDL_TextureAccess
slouken@1895
   852
 * \param w The width of the texture in pixels
slouken@1895
   853
 * \param h The height of the texture in pixels
slouken@1895
   854
 *
slouken@1969
   855
 * \return The created texture is returned, or 0 if no rendering context was active,  the format was unsupported, or the width or height were out of range.
slouken@1895
   856
 *
slouken@1895
   857
 * \sa SDL_QueryTexture()
slouken@1895
   858
 * \sa SDL_DestroyTexture()
slouken@1895
   859
 */
slouken@1895
   860
extern DECLSPEC SDL_TextureID SDLCALL SDL_CreateTexture(Uint32 format,
slouken@1895
   861
                                                        int access, int w,
slouken@1895
   862
                                                        int h);
slouken@1895
   863
slouken@1895
   864
/**
slouken@2222
   865
 * \fn SDL_TextureID SDL_CreateTextureFromSurface(Uint32 format, SDL_Surface *surface)
slouken@1895
   866
 *
slouken@1895
   867
 * \brief Create a texture from an existing surface.
slouken@1895
   868
 *
slouken@1895
   869
 * \param format The format of the texture, or 0 to pick an appropriate format
slouken@1895
   870
 * \param surface The surface containing pixel data used to fill the texture
slouken@1895
   871
 *
slouken@1969
   872
 * \return The created texture is returned, or 0 if no rendering context was active,  the format was unsupported, or the surface width or height were out of range.
slouken@1895
   873
 *
slouken@1895
   874
 * \note The surface is not modified or freed by this function.
slouken@1895
   875
 *
slouken@1895
   876
 * \sa SDL_QueryTexture()
slouken@1895
   877
 * \sa SDL_DestroyTexture()
slouken@1895
   878
 */
slouken@1895
   879
extern DECLSPEC SDL_TextureID SDLCALL SDL_CreateTextureFromSurface(Uint32
slouken@1895
   880
                                                                   format,
slouken@1895
   881
                                                                   SDL_Surface
slouken@1895
   882
                                                                   * surface);
slouken@1895
   883
slouken@1895
   884
/**
slouken@1895
   885
 * \fn int SDL_QueryTexture(SDL_TextureID textureID, Uint32 *format, int *access, int *w, int *h)
slouken@1895
   886
 *
slouken@1895
   887
 * \brief Query the attributes of a texture
slouken@1895
   888
 *
slouken@1895
   889
 * \param texture A texture to be queried
slouken@1895
   890
 * \param format A pointer filled in with the raw format of the texture.  The actual format may differ, but pixel transfers will use this format.
slouken@1895
   891
 * \param access A pointer filled in with the actual access to the texture.
slouken@1895
   892
 * \param w A pointer filled in with the width of the texture in pixels
slouken@1895
   893
 * \param h A pointer filled in with the height of the texture in pixels
slouken@1895
   894
 *
slouken@1895
   895
 * \return 0 on success, or -1 if the texture is not valid
slouken@1895
   896
 */
slouken@1895
   897
extern DECLSPEC int SDLCALL SDL_QueryTexture(SDL_TextureID textureID,
slouken@1895
   898
                                             Uint32 * format, int *access,
slouken@1895
   899
                                             int *w, int *h);
slouken@1895
   900
slouken@1895
   901
/**
slouken@1895
   902
 * \fn int SDL_QueryTexturePixels(SDL_TextureID textureID, void **pixels, int pitch)
slouken@1895
   903
 *
slouken@1895
   904
 * \brief Query the pixels of a texture, if the texture does not need to be locked for pixel access.
slouken@1895
   905
 *
slouken@2222
   906
 * \param texture A texture to be queried, which was created with SDL_TEXTUREACCESS_STREAMING
slouken@1895
   907
 * \param pixels A pointer filled with a pointer to the pixels for the texture 
slouken@1895
   908
 * \param pitch A pointer filled in with the pitch of the pixel data
slouken@1895
   909
 *
slouken@1895
   910
 * \return 0 on success, or -1 if the texture is not valid, or must be locked for pixel access.
slouken@1895
   911
 */
slouken@1895
   912
extern DECLSPEC int SDLCALL SDL_QueryTexturePixels(SDL_TextureID textureID,
slouken@1895
   913
                                                   void **pixels, int *pitch);
slouken@1895
   914
slouken@1895
   915
/**
slouken@1895
   916
 * \fn int SDL_SetTexturePalette(SDL_TextureID textureID, const SDL_Color * colors, int firstcolor, int ncolors)
slouken@1895
   917
 *
slouken@1895
   918
 * \brief Update an indexed texture with a color palette
slouken@1895
   919
 *
slouken@1895
   920
 * \param texture The texture to update
slouken@1895
   921
 * \param colors The array of RGB color data
slouken@1895
   922
 * \param firstcolor The first index to update
slouken@1895
   923
 * \param ncolors The number of palette entries to fill with the color data
slouken@1895
   924
 *
slouken@1895
   925
 * \return 0 on success, or -1 if the texture is not valid or not an indexed texture
slouken@1895
   926
 */
slouken@1895
   927
extern DECLSPEC int SDLCALL SDL_SetTexturePalette(SDL_TextureID textureID,
slouken@1895
   928
                                                  const SDL_Color * colors,
slouken@1895
   929
                                                  int firstcolor,
slouken@1895
   930
                                                  int ncolors);
slouken@1895
   931
slouken@1895
   932
/**
slouken@1895
   933
 * \fn int SDL_GetTexturePalette(SDL_TextureID textureID, SDL_Color * colors, int firstcolor, int ncolors)
slouken@1895
   934
 *
slouken@1895
   935
 * \brief Update an indexed texture with a color palette
slouken@1895
   936
 *
slouken@1895
   937
 * \param texture The texture to update
slouken@1895
   938
 * \param colors The array to fill with RGB color data
slouken@1895
   939
 * \param firstcolor The first index to retrieve
slouken@1895
   940
 * \param ncolors The number of palette entries to retrieve
slouken@1895
   941
 *
slouken@1895
   942
 * \return 0 on success, or -1 if the texture is not valid or not an indexed texture
slouken@1895
   943
 */
slouken@1895
   944
extern DECLSPEC int SDLCALL SDL_GetTexturePalette(SDL_TextureID textureID,
slouken@1895
   945
                                                  SDL_Color * colors,
slouken@1895
   946
                                                  int firstcolor,
slouken@1895
   947
                                                  int ncolors);
slouken@1895
   948
slouken@1895
   949
/**
slouken@1985
   950
 * \fn int SDL_SetTextureColorMod(SDL_TextureID textureID, Uint8 r, Uint8 g, Uint8 b)
slouken@1985
   951
 *
slouken@1985
   952
 * \brief Set an additional color value used in render copy operations
slouken@1985
   953
 *
slouken@1985
   954
 * \param texture The texture to update
slouken@1985
   955
 * \param r The red source color value multiplied into copy operations
slouken@1985
   956
 * \param g The green source color value multiplied into copy operations
slouken@1985
   957
 * \param b The blue source color value multiplied into copy operations
slouken@1985
   958
 *
slouken@1985
   959
 * \return 0 on success, or -1 if the texture is not valid or color modulation is not supported
slouken@1985
   960
 *
slouken@1985
   961
 * \sa SDL_GetTextureColorMod()
slouken@1985
   962
 */
slouken@1985
   963
extern DECLSPEC int SDLCALL SDL_SetTextureColorMod(SDL_TextureID textureID,
slouken@1985
   964
                                                   Uint8 r, Uint8 g, Uint8 b);
slouken@1985
   965
slouken@1985
   966
slouken@1985
   967
/**
slouken@1985
   968
 * \fn int SDL_GetTextureColorMod(SDL_TextureID textureID, Uint8 *r, Uint8 *g, Uint8 *b)
slouken@1985
   969
 *
slouken@1985
   970
 * \brief Get the additional color value used in render copy operations
slouken@1985
   971
 *
slouken@1985
   972
 * \param texture The texture to query
slouken@1985
   973
 * \param r A pointer filled in with the source red color value
slouken@1985
   974
 * \param g A pointer filled in with the source green color value
slouken@1985
   975
 * \param b A pointer filled in with the source blue color value
slouken@1985
   976
 *
slouken@1985
   977
 * \return 0 on success, or -1 if the texture is not valid
slouken@1985
   978
 *
slouken@1985
   979
 * \sa SDL_SetTextureColorMod()
slouken@1985
   980
 */
slouken@1985
   981
extern DECLSPEC int SDLCALL SDL_GetTextureColorMod(SDL_TextureID textureID,
slouken@1985
   982
                                                   Uint8 * r, Uint8 * g,
slouken@1985
   983
                                                   Uint8 * b);
slouken@1985
   984
slouken@1985
   985
/**
slouken@1985
   986
 * \fn int SDL_SetTextureAlphaMod(SDL_TextureID textureID, Uint8 alpha)
slouken@1985
   987
 *
slouken@1985
   988
 * \brief Set an additional alpha value used in render copy operations
slouken@1985
   989
 *
slouken@1985
   990
 * \param texture The texture to update
slouken@1985
   991
 * \param alpha The source alpha value multiplied into copy operations.
slouken@1985
   992
 *
slouken@1985
   993
 * \return 0 on success, or -1 if the texture is not valid or alpha modulation is not supported
slouken@1985
   994
 *
slouken@1985
   995
 * \sa SDL_GetTextureAlphaMod()
slouken@1985
   996
 */
slouken@1985
   997
extern DECLSPEC int SDLCALL SDL_SetTextureAlphaMod(SDL_TextureID textureID,
slouken@1985
   998
                                                   Uint8 alpha);
slouken@1985
   999
slouken@1985
  1000
/**
slouken@1985
  1001
 * \fn int SDL_GetTextureAlphaMod(SDL_TextureID textureID, Uint8 *alpha)
slouken@1985
  1002
 *
slouken@1985
  1003
 * \brief Get the additional alpha value used in render copy operations
slouken@1985
  1004
 *
slouken@1985
  1005
 * \param texture The texture to query
slouken@1985
  1006
 * \param alpha A pointer filled in with the source alpha value
slouken@1985
  1007
 *
slouken@1985
  1008
 * \return 0 on success, or -1 if the texture is not valid
slouken@1985
  1009
 *
slouken@1985
  1010
 * \sa SDL_SetTextureAlphaMod()
slouken@1985
  1011
 */
slouken@1985
  1012
extern DECLSPEC int SDLCALL SDL_GetTextureAlphaMod(SDL_TextureID textureID,
slouken@1985
  1013
                                                   Uint8 * alpha);
slouken@1985
  1014
slouken@1985
  1015
/**
slouken@1985
  1016
 * \fn int SDL_SetTextureBlendMode(SDL_TextureID textureID, int blendMode)
slouken@1985
  1017
 *
slouken@1985
  1018
 * \brief Set the blend mode used for texture copy operations
slouken@1985
  1019
 *
slouken@1985
  1020
 * \param texture The texture to update
slouken@1985
  1021
 * \param blendMode SDL_TextureBlendMode to use for texture blending
slouken@1985
  1022
 *
slouken@1985
  1023
 * \return 0 on success, or -1 if the texture is not valid or the blend mode is not supported
slouken@1985
  1024
 *
slouken@1985
  1025
 * \note If the blend mode is not supported, the closest supported mode is chosen.
slouken@1985
  1026
 *
slouken@1985
  1027
 * \sa SDL_GetTextureBlendMode()
slouken@1985
  1028
 */
slouken@1985
  1029
extern DECLSPEC int SDLCALL SDL_SetTextureBlendMode(SDL_TextureID textureID,
slouken@1985
  1030
                                                    int blendMode);
slouken@1985
  1031
slouken@1985
  1032
/**
slouken@1985
  1033
 * \fn int SDL_GetTextureBlendMode(SDL_TextureID textureID, int *blendMode)
slouken@1985
  1034
 *
slouken@1985
  1035
 * \brief Get the blend mode used for texture copy operations
slouken@1985
  1036
 *
slouken@1985
  1037
 * \param texture The texture to query
slouken@1985
  1038
 * \param blendMode A pointer filled in with the current blend mode
slouken@1985
  1039
 *
slouken@1985
  1040
 * \return 0 on success, or -1 if the texture is not valid
slouken@1985
  1041
 *
slouken@1985
  1042
 * \sa SDL_SetTextureBlendMode()
slouken@1985
  1043
 */
slouken@1985
  1044
extern DECLSPEC int SDLCALL SDL_GetTextureBlendMode(SDL_TextureID textureID,
slouken@1985
  1045
                                                    int *blendMode);
slouken@1985
  1046
slouken@1985
  1047
/**
slouken@1985
  1048
 * \fn int SDL_SetTextureScaleMode(SDL_TextureID textureID, int scaleMode)
slouken@1985
  1049
 *
slouken@1985
  1050
 * \brief Set the scale mode used for texture copy operations
slouken@1985
  1051
 *
slouken@1985
  1052
 * \param texture The texture to update
slouken@1985
  1053
 * \param scaleMode SDL_TextureScaleMode to use for texture scaling
slouken@1985
  1054
 *
slouken@1985
  1055
 * \return 0 on success, or -1 if the texture is not valid or the scale mode is not supported
slouken@1985
  1056
 *
slouken@1985
  1057
 * \note If the scale mode is not supported, the closest supported mode is chosen.
slouken@1985
  1058
 *
slouken@1985
  1059
 * \sa SDL_GetTextureScaleMode()
slouken@1985
  1060
 */
slouken@1985
  1061
extern DECLSPEC int SDLCALL SDL_SetTextureScaleMode(SDL_TextureID textureID,
slouken@1985
  1062
                                                    int scaleMode);
slouken@1985
  1063
slouken@1985
  1064
/**
slouken@1985
  1065
 * \fn int SDL_GetTextureScaleMode(SDL_TextureID textureID, int *scaleMode)
slouken@1985
  1066
 *
slouken@1985
  1067
 * \brief Get the scale mode used for texture copy operations
slouken@1985
  1068
 *
slouken@1985
  1069
 * \param texture The texture to query
slouken@1985
  1070
 * \param scaleMode A pointer filled in with the current scale mode
slouken@1985
  1071
 *
slouken@1985
  1072
 * \return 0 on success, or -1 if the texture is not valid
slouken@1985
  1073
 *
slouken@1985
  1074
 * \sa SDL_SetTextureScaleMode()
slouken@1985
  1075
 */
slouken@1985
  1076
extern DECLSPEC int SDLCALL SDL_GetTextureScaleMode(SDL_TextureID textureID,
slouken@1985
  1077
                                                    int *scaleMode);
slouken@1985
  1078
slouken@1985
  1079
/**
slouken@1895
  1080
 * \fn int SDL_UpdateTexture(SDL_TextureID textureID, const SDL_Rect *rect, const void *pixels, int pitch)
slouken@1895
  1081
 *
slouken@1895
  1082
 * \brief Update the given texture rectangle with new pixel data.
slouken@1895
  1083
 *
slouken@1895
  1084
 * \param texture The texture to update
slouken@1895
  1085
 * \param rect A pointer to the rectangle of pixels to update, or NULL to update the entire texture.
slouken@1895
  1086
 * \param pixels The raw pixel data
slouken@1895
  1087
 * \param pitch The number of bytes between rows of pixel data
slouken@1895
  1088
 *
slouken@1895
  1089
 * \return 0 on success, or -1 if the texture is not valid
slouken@1895
  1090
 *
slouken@2222
  1091
 * \note This is a fairly slow function.
slouken@1895
  1092
 */
slouken@1895
  1093
extern DECLSPEC int SDLCALL SDL_UpdateTexture(SDL_TextureID textureID,
slouken@1895
  1094
                                              const SDL_Rect * rect,
slouken@1895
  1095
                                              const void *pixels, int pitch);
slouken@1895
  1096
slouken@1895
  1097
/**
slouken@1895
  1098
 * \fn void SDL_LockTexture(SDL_TextureID textureID, const SDL_Rect *rect, int markDirty, void **pixels, int *pitch)
slouken@1895
  1099
 *
slouken@1895
  1100
 * \brief Lock a portion of the texture for pixel access.
slouken@1895
  1101
 *
slouken@2222
  1102
 * \param textureID The texture to lock for access, which was created with SDL_TEXTUREACCESS_STREAMING.
slouken@1895
  1103
 * \param rect A pointer to the rectangle to lock for access. If the rect is NULL, the entire texture will be locked.
slouken@1895
  1104
 * \param markDirty If this is nonzero, the locked area will be marked dirty when the texture is unlocked.
slouken@1895
  1105
 * \param pixels This is filled in with a pointer to the locked pixels, appropriately offset by the locked area.
slouken@1895
  1106
 * \param pitch This is filled in with the pitch of the locked pixels.
slouken@1895
  1107
 *
slouken@2222
  1108
 * \return 0 on success, or -1 if the texture is not valid or was created with SDL_TEXTUREACCESS_STATIC
slouken@1895
  1109
 *
slouken@1895
  1110
 * \sa SDL_DirtyTexture()
slouken@1895
  1111
 * \sa SDL_UnlockTexture()
slouken@1895
  1112
 */
slouken@1895
  1113
extern DECLSPEC int SDLCALL SDL_LockTexture(SDL_TextureID textureID,
slouken@1895
  1114
                                            const SDL_Rect * rect,
slouken@1895
  1115
                                            int markDirty, void **pixels,
slouken@1895
  1116
                                            int *pitch);
slouken@1895
  1117
slouken@1895
  1118
/**
slouken@1895
  1119
 * \fn void SDL_UnlockTexture(SDL_TextureID textureID)
slouken@1895
  1120
 *
slouken@1895
  1121
 * \brief Unlock a texture, uploading the changes to video memory, if needed.
slouken@1895
  1122
 *
slouken@1895
  1123
 * \sa SDL_LockTexture()
slouken@1895
  1124
 * \sa SDL_DirtyTexture()
slouken@1895
  1125
 */
slouken@1895
  1126
extern DECLSPEC void SDLCALL SDL_UnlockTexture(SDL_TextureID textureID);
slouken@1895
  1127
slouken@1895
  1128
/**
slouken@1895
  1129
 * \fn void SDL_DirtyTexture(SDL_TextureID textureID, int numrects, const SDL_Rect * rects)
slouken@1895
  1130
 *
slouken@1895
  1131
 * \brief Mark the specified rectangles of the texture as dirty.
slouken@1895
  1132
 *
slouken@2222
  1133
 * \param textureID The texture to mark dirty, which was created with SDL_TEXTUREACCESS_STREAMING.
slouken@2222
  1134
 * \param numrects The number of rectangles pointed to by rects.
slouken@2222
  1135
 * \param rects The pointer to an array of dirty rectangles.
slouken@1895
  1136
 *
slouken@1895
  1137
 * \sa SDL_LockTexture()
slouken@1895
  1138
 * \sa SDL_UnlockTexture()
slouken@1895
  1139
 */
slouken@1895
  1140
extern DECLSPEC void SDLCALL SDL_DirtyTexture(SDL_TextureID textureID,
slouken@1895
  1141
                                              int numrects,
slouken@1895
  1142
                                              const SDL_Rect * rects);
slouken@1895
  1143
slouken@1895
  1144
/**
slouken@2884
  1145
 * \fn void SDL_SetRenderDrawColor(Uint8 r, Uint8 g, Uint8 b, Uint8 a)
slouken@1895
  1146
 *
slouken@2884
  1147
 * \brief Set the color used for drawing operations (Fill and Line).
slouken@2884
  1148
 *
slouken@2884
  1149
 * \param r The red value used to draw on the rendering target
slouken@2884
  1150
 * \param g The green value used to draw on the rendering target
slouken@2884
  1151
 * \param b The blue value used to draw on the rendering target
slouken@2884
  1152
 * \param a The alpha value used to draw on the rendering target, usually SDL_ALPHA_OPAQUE (255)
slouken@2884
  1153
 * \return 0 on success, or -1 if there is no rendering context current
slouken@2884
  1154
 */
slouken@2884
  1155
extern DECLSPEC int SDL_SetRenderDrawColor(Uint8 r, Uint8 g, Uint8 b,
slouken@2884
  1156
                                           Uint8 a);
slouken@2884
  1157
slouken@2884
  1158
/**
slouken@2884
  1159
 * \fn void SDL_GetRenderDrawColor(Uint8 r, Uint8 g, Uint8 b, Uint8 a)
slouken@2884
  1160
 *
slouken@2884
  1161
 * \brief Get the color used for drawing operations (Fill and Line).
slouken@2884
  1162
 *
slouken@2884
  1163
 * \param r A pointer to the red value used to draw on the rendering target
slouken@2884
  1164
 * \param g A pointer to the green value used to draw on the rendering target
slouken@2884
  1165
 * \param b A pointer to the blue value used to draw on the rendering target
slouken@2884
  1166
 * \param a A pointer to the alpha value used to draw on the rendering target, usually SDL_ALPHA_OPAQUE (255)
slouken@2884
  1167
 * \return 0 on success, or -1 if there is no rendering context current
slouken@2884
  1168
 */
slouken@2884
  1169
extern DECLSPEC int SDL_GetRenderDrawColor(Uint8 * r, Uint8 * g, Uint8 * b,
slouken@2884
  1170
                                           Uint8 * a);
slouken@2884
  1171
slouken@2884
  1172
/**
slouken@2884
  1173
 * \fn int SDL_SetRenderDrawBlendMode(int blendMode)
slouken@2884
  1174
 *
slouken@2886
  1175
 * \brief Set the blend mode used for drawing operations (Fill and Line).
slouken@2884
  1176
 *
slouken@2884
  1177
 * \param blendMode SDL_BlendMode to use for blending
slouken@2884
  1178
 *
slouken@2884
  1179
 * \return 0 on success, or -1 if there is no rendering context current
slouken@2884
  1180
 *
slouken@2884
  1181
 * \note If the blend mode is not supported, the closest supported mode is chosen.
slouken@2884
  1182
 *
slouken@2884
  1183
 * \sa SDL_SetRenderDrawBlendMode()
slouken@2884
  1184
 */
slouken@2884
  1185
extern DECLSPEC int SDLCALL SDL_SetRenderDrawBlendMode(int blendMode);
slouken@2884
  1186
slouken@2884
  1187
/**
slouken@2884
  1188
 * \fn int SDL_GetRenderDrawBlendMode(int *blendMode)
slouken@2884
  1189
 *
slouken@2884
  1190
 * \brief Get the blend mode used for drawing operations
slouken@2884
  1191
 *
slouken@2884
  1192
 * \param blendMode A pointer filled in with the current blend mode
slouken@2884
  1193
 *
slouken@2884
  1194
 * \return 0 on success, or -1 if there is no rendering context current
slouken@2884
  1195
 *
slouken@2884
  1196
 * \sa SDL_SetRenderDrawBlendMode()
slouken@2884
  1197
 */
slouken@2884
  1198
extern DECLSPEC int SDLCALL SDL_GetRenderDrawBlendMode(int *blendMode);
slouken@2884
  1199
slouken@2884
  1200
/**
slouken@2901
  1201
 * \fn int SDL_RenderPoint(int x, int y)
slouken@2901
  1202
 *
slouken@2901
  1203
 * \brief Draw a point on the current rendering target.
slouken@2901
  1204
 *
slouken@2901
  1205
 * \param x The x coordinate of the point
slouken@2901
  1206
 * \param y The y coordinate of the point
slouken@2901
  1207
 *
slouken@2901
  1208
 * \return 0 on success, or -1 if there is no rendering context current
slouken@2901
  1209
 */
slouken@2901
  1210
extern DECLSPEC int SDLCALL SDL_RenderPoint(int x, int y);
slouken@2901
  1211
slouken@2901
  1212
/**
slouken@2886
  1213
 * \fn int SDL_RenderLine(int x1, int y1, int x2, int y2)
slouken@2884
  1214
 *
slouken@2884
  1215
 * \brief Draw a line on the current rendering target.
slouken@2884
  1216
 *
slouken@2884
  1217
 * \param x1 The x coordinate of the start point
slouken@2884
  1218
 * \param y1 The y coordinate of the start point
slouken@2884
  1219
 * \param x2 The x coordinate of the end point
slouken@2884
  1220
 * \param y2 The y coordinate of the end point
slouken@2884
  1221
 *
slouken@2884
  1222
 * \return 0 on success, or -1 if there is no rendering context current
slouken@2884
  1223
 */
slouken@2884
  1224
extern DECLSPEC int SDLCALL SDL_RenderLine(int x1, int y1, int x2, int y2);
slouken@2884
  1225
slouken@2884
  1226
/**
slouken@2884
  1227
 * \fn void SDL_RenderFill(const SDL_Rect *rect)
slouken@2884
  1228
 *
slouken@2884
  1229
 * \brief Fill the current rendering target with the drawing color.
slouken@1895
  1230
 *
slouken@1985
  1231
 * \param r The red value used to fill the rendering target
slouken@1985
  1232
 * \param g The green value used to fill the rendering target
slouken@1985
  1233
 * \param b The blue value used to fill the rendering target
slouken@1985
  1234
 * \param a The alpha value used to fill the rendering target, usually SDL_ALPHA_OPAQUE (255)
slouken@1895
  1235
 * \param rect A pointer to the destination rectangle, or NULL for the entire rendering target.
slouken@1895
  1236
 *
slouken@1969
  1237
 * \return 0 on success, or -1 if there is no rendering context current
slouken@1895
  1238
 */
slouken@2884
  1239
extern DECLSPEC int SDLCALL SDL_RenderFill(const SDL_Rect * rect);
slouken@1895
  1240
slouken@1895
  1241
/**
slouken@1985
  1242
 * \fn int SDL_RenderCopy(SDL_TextureID textureID, const SDL_Rect *srcrect, const SDL_Rect *dstrect)
slouken@1895
  1243
 *
slouken@1895
  1244
 * \brief Copy a portion of the texture to the current rendering target.
slouken@1895
  1245
 *
slouken@1895
  1246
 * \param texture The source texture.
slouken@1895
  1247
 * \param srcrect A pointer to the source rectangle, or NULL for the entire texture.
slouken@1895
  1248
 * \param dstrect A pointer to the destination rectangle, or NULL for the entire rendering target.
slouken@1895
  1249
 *
slouken@1969
  1250
 * \return 0 on success, or -1 if there is no rendering context current, or the driver doesn't support the requested operation.
slouken@1895
  1251
 */
slouken@1895
  1252
extern DECLSPEC int SDLCALL SDL_RenderCopy(SDL_TextureID textureID,
slouken@1895
  1253
                                           const SDL_Rect * srcrect,
slouken@1985
  1254
                                           const SDL_Rect * dstrect);
slouken@1895
  1255
slouken@1895
  1256
/**
slouken@1895
  1257
 * \fn int SDL_RenderReadPixels(const SDL_Rect *rect, void *pixels, int pitch)
slouken@1895
  1258
 *
slouken@1895
  1259
 * \brief Read pixels from the current rendering target.
slouken@1895
  1260
 *
slouken@1895
  1261
 * \param rect A pointer to the rectangle to read, or NULL for the entire render target
slouken@1895
  1262
 * \param pixels A pointer to be filled in with the pixel data
slouken@1895
  1263
 * \param pitch The pitch of the pixels parameter
slouken@1895
  1264
 *
slouken@1895
  1265
 * \return 0 on success, or -1 if pixel reading is not supported.
slouken@1895
  1266
 *
slouken@1895
  1267
 * \warning This is a very slow operation, and should not be used frequently.
slouken@1895
  1268
 */
slouken@1895
  1269
extern DECLSPEC int SDLCALL SDL_RenderReadPixels(const SDL_Rect * rect,
slouken@1895
  1270
                                                 void *pixels, int pitch);
slouken@1895
  1271
slouken@1895
  1272
/**
slouken@1895
  1273
 * \fn int SDL_RenderWritePixels(const SDL_Rect *rect, const void *pixels, int pitch)
slouken@1895
  1274
 *
slouken@1895
  1275
 * \brief Write pixels to the current rendering target.
slouken@1895
  1276
 *
slouken@1895
  1277
 * \param rect A pointer to the rectangle to write, or NULL for the entire render target
slouken@1895
  1278
 * \param pixels A pointer to the pixel data to write
slouken@1895
  1279
 * \param pitch The pitch of the pixels parameter
slouken@1895
  1280
 *
slouken@1895
  1281
 * \return 0 on success, or -1 if pixel writing is not supported.
slouken@1895
  1282
 *
slouken@1895
  1283
 * \warning This is a very slow operation, and should not be used frequently.
slouken@1895
  1284
 */
slouken@1895
  1285
extern DECLSPEC int SDLCALL SDL_RenderWritePixels(const SDL_Rect * rect,
slouken@1895
  1286
                                                  const void *pixels,
slouken@1895
  1287
                                                  int pitch);
slouken@1895
  1288
slouken@1895
  1289
/**
slouken@1895
  1290
 * \fn void SDL_RenderPresent(void)
slouken@1895
  1291
 *
slouken@1895
  1292
 * \brief Update the screen with rendering performed.
slouken@1895
  1293
 */
slouken@1895
  1294
extern DECLSPEC void SDLCALL SDL_RenderPresent(void);
slouken@1895
  1295
slouken@1895
  1296
/**
slouken@1895
  1297
 * \fn void SDL_DestroyTexture(SDL_TextureID textureID);
slouken@1895
  1298
 *
slouken@1895
  1299
 * \brief Destroy the specified texture.
slouken@1895
  1300
 *
slouken@1895
  1301
 * \sa SDL_CreateTexture()
slouken@1895
  1302
 * \sa SDL_CreateTextureFromSurface()
slouken@1895
  1303
 */
slouken@1895
  1304
extern DECLSPEC void SDLCALL SDL_DestroyTexture(SDL_TextureID textureID);
slouken@1895
  1305
slouken@1895
  1306
/**
slouken@1895
  1307
 * \fn void SDL_DestroyRenderer(SDL_WindowID windowID);
slouken@1895
  1308
 *
slouken@1895
  1309
 * \brief Destroy the rendering context for a window and free associated
slouken@1895
  1310
 *        textures.
slouken@1895
  1311
 *
slouken@1895
  1312
 * \sa SDL_CreateRenderer()
slouken@1895
  1313
 */
slouken@1895
  1314
extern DECLSPEC void SDLCALL SDL_DestroyRenderer(SDL_WindowID windowID);
slouken@0
  1315
slouken@3025
  1316
/**
slouken@3025
  1317
 * \fn SDL_bool SDL_IsScreenSaverEnabled();
slouken@3025
  1318
 *
slouken@3025
  1319
 * \brief Returns whether the screensaver is currently enabled (default off).
slouken@3025
  1320
 *
slouken@3025
  1321
 * \sa SDL_EnableScreenSaver()
slouken@3025
  1322
 * \sa SDL_DisableScreenSaver()
slouken@3025
  1323
 */
couriersud@3033
  1324
extern DECLSPEC SDL_bool SDLCALL SDL_IsScreenSaverEnabled(void);
slouken@3025
  1325
slouken@3025
  1326
/**
slouken@3025
  1327
 * \fn void SDL_EnableScreenSaver();
slouken@3025
  1328
 *
slouken@3025
  1329
 * \brief Allow the screen to be blanked by a screensaver
slouken@3025
  1330
 *
slouken@3025
  1331
 * \sa SDL_IsScreenSaverEnabled()
slouken@3025
  1332
 * \sa SDL_DisableScreenSaver()
slouken@3025
  1333
 */
couriersud@3033
  1334
extern DECLSPEC void SDLCALL SDL_EnableScreenSaver(void);
slouken@3025
  1335
slouken@3025
  1336
/**
slouken@3025
  1337
 * \fn void SDL_DisableScreenSaver();
slouken@3025
  1338
 *
slouken@3025
  1339
 * \brief Prevent the screen from being blanked by a screensaver
slouken@3025
  1340
 *
slouken@3025
  1341
 * \sa SDL_IsScreenSaverEnabled()
slouken@3025
  1342
 * \sa SDL_EnableScreenSaver()
slouken@3025
  1343
 */
couriersud@3033
  1344
extern DECLSPEC void SDLCALL SDL_DisableScreenSaver(void);
slouken@3025
  1345
slouken@0
  1346
slouken@0
  1347
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
slouken@0
  1348
/* OpenGL support functions.                                                 */
slouken@0
  1349
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
slouken@0
  1350
slouken@1895
  1351
/**
slouken@1895
  1352
 * \fn int SDL_GL_LoadLibrary(const char *path)
slouken@0
  1353
 *
slouken@1895
  1354
 * \brief Dynamically load an OpenGL library.
slouken@1895
  1355
 *
slouken@1895
  1356
 * \param path The platform dependent OpenGL library name, or NULL to open the default OpenGL library
slouken@1895
  1357
 *
slouken@1895
  1358
 * \return 0 on success, or -1 if the library couldn't be loaded
slouken@1895
  1359
 *
slouken@1936
  1360
 * This should be done after initializing the video driver, but before
slouken@1936
  1361
 * creating any OpenGL windows.  If no OpenGL library is loaded, the default
slouken@1936
  1362
 * library will be loaded upon creation of the first OpenGL window.
slouken@1936
  1363
 *
slouken@1895
  1364
 * \note If you do this, you need to retrieve all of the GL functions used in
slouken@1895
  1365
 *       your program from the dynamic library using SDL_GL_GetProcAddress().
slouken@1895
  1366
 *
slouken@1895
  1367
 * \sa SDL_GL_GetProcAddress()
slouken@3057
  1368
 * \sa SDL_GL_UnloadLibrary()
slouken@0
  1369
 */
slouken@337
  1370
extern DECLSPEC int SDLCALL SDL_GL_LoadLibrary(const char *path);
slouken@0
  1371
slouken@1895
  1372
/**
slouken@1895
  1373
 * \fn void *SDL_GL_GetProcAddress(const char *proc)
slouken@1895
  1374
 *
slouken@1895
  1375
 * \brief Get the address of an OpenGL function.
slouken@0
  1376
 */
slouken@1895
  1377
extern DECLSPEC void *SDLCALL SDL_GL_GetProcAddress(const char *proc);
slouken@0
  1378
slouken@1895
  1379
/**
slouken@3057
  1380
 * \fn void SDL_GL_UnloadLibrary(void)
slouken@3057
  1381
 *
slouken@3057
  1382
 * \brief Unload the OpenGL library previously loaded by SDL_GL_LoadLibrary()
slouken@3057
  1383
 *
slouken@3057
  1384
 * \sa SDL_GL_LoadLibrary()
slouken@3057
  1385
 */
slouken@3057
  1386
extern DECLSPEC void SDLCALL SDL_GL_UnloadLibrary(void);
slouken@3057
  1387
slouken@3057
  1388
/**
slouken@1926
  1389
 * \fn SDL_bool SDL_GL_ExtensionSupported(const char *extension)
slouken@1926
  1390
 *
slouken@1926
  1391
 * \brief Return true if an OpenGL extension is supported for the current context.
slouken@1926
  1392
 */
slouken@1926
  1393
extern DECLSPEC SDL_bool SDLCALL SDL_GL_ExtensionSupported(const char
slouken@1926
  1394
                                                           *extension);
slouken@1926
  1395
slouken@1926
  1396
/**
slouken@1895
  1397
 * \fn int SDL_GL_SetAttribute(SDL_GLattr attr, int value)
slouken@1895
  1398
 *
slouken@1895
  1399
 * \brief Set an OpenGL window attribute before window creation.
slouken@0
  1400
 */
slouken@337
  1401
extern DECLSPEC int SDLCALL SDL_GL_SetAttribute(SDL_GLattr attr, int value);
slouken@0
  1402
slouken@1895
  1403
/**
slouken@1895
  1404
 * \fn int SDL_GL_GetWindowAttribute(SDL_WindowID windowID, SDL_GLattr attr, int *value)
slouken@0
  1405
 *
slouken@1936
  1406
 * \brief Get the actual value for an attribute from the current context.
slouken@0
  1407
 */
slouken@1936
  1408
extern DECLSPEC int SDLCALL SDL_GL_GetAttribute(SDL_GLattr attr, int *value);
slouken@0
  1409
slouken@1895
  1410
/**
slouken@1895
  1411
 * \fn SDL_GLContext SDL_GL_CreateContext(SDL_WindowID windowID)
slouken@1895
  1412
 *
slouken@1895
  1413
 * \brief Create an OpenGL context for use with an OpenGL window, and make it current.
slouken@1895
  1414
 *
slouken@1895
  1415
 * \sa SDL_GL_DeleteContext()
slouken@1895
  1416
 */
slouken@1895
  1417
extern DECLSPEC SDL_GLContext SDLCALL SDL_GL_CreateContext(SDL_WindowID
slouken@1895
  1418
                                                           windowID);
slouken@1895
  1419
slouken@1895
  1420
/**
slouken@1895
  1421
 * \fn int SDL_GL_MakeCurrent(SDL_WindowID windowID, SDL_GLContext context)
slouken@1895
  1422
 *
slouken@1895
  1423
 * \brief Set up an OpenGL context for rendering into an OpenGL window.
slouken@1895
  1424
 *
slouken@1895
  1425
 * \note The context must have been created with a compatible window.
slouken@1895
  1426
 */
slouken@1895
  1427
extern DECLSPEC int SDLCALL SDL_GL_MakeCurrent(SDL_WindowID windowID,
slouken@1895
  1428
                                               SDL_GLContext context);
slouken@1895
  1429
slouken@1895
  1430
/**
slouken@1895
  1431
 * \fn int SDL_GL_SetSwapInterval(int interval)
slouken@1895
  1432
 *
slouken@1895
  1433
 * \brief Set the swap interval for the current OpenGL context.
slouken@1895
  1434
 *
slouken@1912
  1435
 * \param interval 0 for immediate updates, 1 for updates synchronized with the vertical retrace
slouken@1912
  1436
 *
slouken@1912
  1437
 * \return 0 on success, or -1 if setting the swap interval is not supported.
slouken@1912
  1438
 *
slouken@1895
  1439
 * \sa SDL_GL_GetSwapInterval()
slouken@1895
  1440
 */
slouken@1895
  1441
extern DECLSPEC int SDLCALL SDL_GL_SetSwapInterval(int interval);
slouken@1895
  1442
slouken@1895
  1443
/**
slouken@1895
  1444
 * \fn int SDL_GL_GetSwapInterval(void)
slouken@1895
  1445
 *
slouken@1895
  1446
 * \brief Get the swap interval for the current OpenGL context.
slouken@1895
  1447
 *
slouken@1912
  1448
 * \return 0 if there is no vertical retrace synchronization, 1 if the buffer swap is synchronized with the vertical retrace, and -1 if getting the swap interval is not supported.
slouken@1912
  1449
 *
slouken@1895
  1450
 * \sa SDL_GL_SetSwapInterval()
slouken@1895
  1451
 */
slouken@1895
  1452
extern DECLSPEC int SDLCALL SDL_GL_GetSwapInterval(void);
slouken@1895
  1453
slouken@1895
  1454
/**
slouken@1912
  1455
 * \fn void SDL_GL_SwapWindow(SDL_WindowID windowID)
slouken@1895
  1456
 *
slouken@1912
  1457
 * \brief Swap the OpenGL buffers for the window, if double-buffering is supported.
slouken@0
  1458
 */
slouken@1912
  1459
extern DECLSPEC void SDLCALL SDL_GL_SwapWindow(SDL_WindowID windowID);
slouken@0
  1460
slouken@1895
  1461
/**
slouken@1895
  1462
 * \fn void SDL_GL_DeleteContext(SDL_GLContext context)
slouken@1895
  1463
 *
slouken@1895
  1464
 * \brief Delete an OpenGL context.
slouken@1895
  1465
 *
slouken@1895
  1466
 * \sa SDL_GL_CreateContext()
slouken@0
  1467
 */
slouken@1895
  1468
extern DECLSPEC void SDLCALL SDL_GL_DeleteContext(SDL_GLContext context);
slouken@0
  1469
slouken@0
  1470
slouken@0
  1471
/* Ends C function definitions when using C++ */
slouken@0
  1472
#ifdef __cplusplus
slouken@1895
  1473
/* *INDENT-OFF* */
slouken@0
  1474
}
slouken@1895
  1475
/* *INDENT-ON* */
slouken@0
  1476
#endif
slouken@0
  1477
#include "close_code.h"
slouken@0
  1478
slouken@0
  1479
#endif /* _SDL_video_h */
slouken@1895
  1480
slouken@1895
  1481
/* vi: set ts=4 sw=4 expandtab: */