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