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