Mercurial > sdl-ios-xcode
comparison include/SDL_video.h @ 1895:c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Mon, 10 Jul 2006 21:04:37 +0000 |
parents | eacc5bc01d1c |
children | c2a27da60b18 |
comparison
equal
deleted
inserted
replaced
1894:c69cee13dd76 | 1895:c121d94672cb |
---|---|
18 | 18 |
19 Sam Lantinga | 19 Sam Lantinga |
20 slouken@libsdl.org | 20 slouken@libsdl.org |
21 */ | 21 */ |
22 | 22 |
23 /* Header file for access to the SDL raw framebuffer window */ | 23 /** |
24 * \file SDL_video.h | |
25 * | |
26 * Header file for access to the SDL raw framebuffer window | |
27 */ | |
24 | 28 |
25 #ifndef _SDL_video_h | 29 #ifndef _SDL_video_h |
26 #define _SDL_video_h | 30 #define _SDL_video_h |
27 | 31 |
28 #include "SDL_stdinc.h" | 32 #include "SDL_stdinc.h" |
29 #include "SDL_error.h" | 33 #include "SDL_error.h" |
34 #include "SDL_pixels.h" | |
30 #include "SDL_rwops.h" | 35 #include "SDL_rwops.h" |
31 | 36 |
32 #include "begin_code.h" | 37 #include "begin_code.h" |
33 /* Set up for C function definitions, even when using C++ */ | 38 /* Set up for C function definitions, even when using C++ */ |
34 #ifdef __cplusplus | 39 #ifdef __cplusplus |
40 /* *INDENT-OFF* */ | |
35 extern "C" { | 41 extern "C" { |
42 /* *INDENT-ON* */ | |
36 #endif | 43 #endif |
37 | 44 |
38 /* Transparency definitions: These define alpha as the opacity of a surface */ | 45 /* Transparency definitions: These define alpha as the opacity of a surface */ |
39 #define SDL_ALPHA_OPAQUE 255 | 46 #define SDL_ALPHA_OPAQUE 255 |
40 #define SDL_ALPHA_TRANSPARENT 0 | 47 #define SDL_ALPHA_TRANSPARENT 0 |
41 | 48 |
42 /* Useful data types */ | 49 /** |
43 typedef struct SDL_Rect { | 50 * \struct SDL_Rect |
44 Sint16 x, y; | 51 * |
45 Uint16 w, h; | 52 * \brief A rectangle, with the origin at the upper left. |
53 */ | |
54 typedef struct SDL_Rect | |
55 { | |
56 int x, y; | |
57 int w, h; | |
46 } SDL_Rect; | 58 } SDL_Rect; |
47 | 59 |
48 typedef struct SDL_Color { | 60 /** |
49 Uint8 r; | 61 * \struct SDL_DisplayMode |
50 Uint8 g; | 62 * |
51 Uint8 b; | 63 * \brief The structure that defines a display mode |
52 Uint8 unused; | 64 * |
53 } SDL_Color; | 65 * \sa SDL_GetNumDisplayModes() |
54 #define SDL_Colour SDL_Color | 66 * \sa SDL_GetDisplayMode() |
55 | 67 * \sa SDL_GetDesktopDisplayMode() |
56 typedef struct SDL_Palette { | 68 * \sa SDL_GetCurrentDisplayMode() |
57 int ncolors; | 69 * \sa SDL_GetClosestDisplayMode() |
58 SDL_Color *colors; | 70 * \sa SDL_SetDisplayMode() |
59 } SDL_Palette; | 71 */ |
60 | 72 typedef struct |
61 /* Everything in the pixel format structure is read-only */ | 73 { |
62 typedef struct SDL_PixelFormat { | 74 Uint32 format; /**< pixel format */ |
63 SDL_Palette *palette; | 75 int w; /**< width */ |
64 Uint8 BitsPerPixel; | 76 int h; /**< height */ |
65 Uint8 BytesPerPixel; | 77 int refresh_rate; /**< refresh rate (or zero for unspecified) */ |
66 Uint8 Rloss; | 78 void *driverdata; /**< driver-specific data, initialize to 0 */ |
67 Uint8 Gloss; | 79 } SDL_DisplayMode; |
68 Uint8 Bloss; | 80 |
69 Uint8 Aloss; | 81 /** |
70 Uint8 Rshift; | 82 * \typedef SDL_WindowID |
71 Uint8 Gshift; | 83 * |
72 Uint8 Bshift; | 84 * \brief The type used to identify a window |
73 Uint8 Ashift; | 85 * |
74 Uint32 Rmask; | 86 * \sa SDL_CreateWindow() |
75 Uint32 Gmask; | 87 * \sa SDL_CreateWindowFrom() |
76 Uint32 Bmask; | 88 * \sa SDL_DestroyWindow() |
77 Uint32 Amask; | 89 * \sa SDL_GetWindowData() |
78 | 90 * \sa SDL_GetWindowFlags() |
79 /* RGB color key information */ | 91 * \sa SDL_GetWindowGrab() |
80 Uint32 colorkey; | 92 * \sa SDL_GetWindowPosition() |
81 /* Alpha value information (per-surface alpha) */ | 93 * \sa SDL_GetWindowSize() |
82 Uint8 alpha; | 94 * \sa SDL_GetWindowTitle() |
83 } SDL_PixelFormat; | 95 * \sa SDL_HideWindow() |
96 * \sa SDL_MaximizeWindow() | |
97 * \sa SDL_MinimizeWindow() | |
98 * \sa SDL_RaiseWindow() | |
99 * \sa SDL_RestoreWindow() | |
100 * \sa SDL_SetWindowData() | |
101 * \sa SDL_SetWindowFullscreen() | |
102 * \sa SDL_SetWindowGrab() | |
103 * \sa SDL_SetWindowIcon() | |
104 * \sa SDL_SetWindowPosition() | |
105 * \sa SDL_SetWindowSize() | |
106 * \sa SDL_SetWindowTitle() | |
107 * \sa SDL_ShowWindow() | |
108 */ | |
109 typedef Uint32 SDL_WindowID; | |
110 | |
111 /** | |
112 * \enum SDL_WindowFlags | |
113 * | |
114 * \brief The flags on a window | |
115 * | |
116 * \sa SDL_GetWindowFlags() | |
117 */ | |
118 typedef enum | |
119 { | |
120 SDL_WINDOW_FULLSCREEN = 0x00000001, /**< fullscreen window, implies borderless */ | |
121 SDL_WINDOW_OPENGL = 0x00000002, /**< window usable with OpenGL context */ | |
122 SDL_WINDOW_SHOWN = 0x00000004, /**< window is visible */ | |
123 SDL_WINDOW_BORDERLESS = 0x00000008, /**< no window decoration */ | |
124 SDL_WINDOW_RESIZABLE = 0x00000010, /**< window can be resized */ | |
125 SDL_WINDOW_MINIMIZED = 0x00000020, /**< minimized */ | |
126 SDL_WINDOW_MAXIMIZED = 0x00000040, /**< maximized */ | |
127 SDL_WINDOW_INPUT_GRABBED = 0x00000100, /**< window has grabbed input focus */ | |
128 SDL_WINDOW_INPUT_FOCUS = 0x00000200, /**< window has input focus */ | |
129 SDL_WINDOW_MOUSE_FOCUS = 0x00000400, /**< window has mouse focus */ | |
130 } SDL_WindowFlags; | |
131 | |
132 /** | |
133 * \def SDL_WINDOWPOS_UNDEFINED | |
134 * \brief Used to indicate that you don't care what the window position is. | |
135 */ | |
136 #define SDL_WINDOWPOS_UNDEFINED 0x7FFFFFF | |
137 /** | |
138 * \def SDL_WINDOWPOS_CENTERED | |
139 * \brief Used to indicate that the window position should be centered. | |
140 */ | |
141 #define SDL_WINDOWPOS_CENTERED 0x7FFFFFE | |
142 | |
143 /** | |
144 * \enum SDL_WindowEventID | |
145 * | |
146 * \brief Event subtype for window events | |
147 */ | |
148 typedef enum | |
149 { | |
150 SDL_WINDOWEVENT_NONE, /**< Never used */ | |
151 SDL_WINDOWEVENT_SHOWN, /**< Window has been shown */ | |
152 SDL_WINDOWEVENT_HIDDEN, /**< Window has been hidden */ | |
153 SDL_WINDOWEVENT_EXPOSED, /**< Window has been exposed and should be redrawn */ | |
154 SDL_WINDOWEVENT_MOVED, /**< Window has been moved to data1,data2 */ | |
155 SDL_WINDOWEVENT_RESIZED, /**< Window size changed to data1xdata2 */ | |
156 SDL_WINDOWEVENT_MINIMIZED, /**< Window has been minimized */ | |
157 SDL_WINDOWEVENT_MAXIMIZED, /**< Window has been maximized */ | |
158 SDL_WINDOWEVENT_RESTORED, /**< Window has been restored to normal size and position */ | |
159 SDL_WINDOWEVENT_ENTER, /**< The window has gained mouse focus */ | |
160 SDL_WINDOWEVENT_LEAVE, /**< The window has lost mouse focus */ | |
161 SDL_WINDOWEVENT_FOCUS_GAINED, /**< The window has gained keyboard focus */ | |
162 SDL_WINDOWEVENT_FOCUS_LOST, /**< The window has lost keyboard focus */ | |
163 SDL_WINDOWEVENT_CLOSE, /**< The window manager requests that the window be closed */ | |
164 } SDL_WindowEventID; | |
165 | |
166 /** | |
167 * \enum SDL_RendererFlags | |
168 * | |
169 * \brief Flags used when initializing a render manager. | |
170 */ | |
171 typedef enum | |
172 { | |
173 SDL_Renderer_PresentDiscard = 0x00000001, /**< Present leaves the contents of the backbuffer undefined */ | |
174 SDL_Renderer_PresentCopy = 0x00000002, /**< Present uses a copy from back buffer to the front buffer */ | |
175 SDL_Renderer_PresentFlip2 = 0x00000004, /**< Present uses a flip, swapping back buffer and front buffer */ | |
176 SDL_Renderer_PresentFlip3 = 0x00000008, /**< Present uses a flip, rotating between two back buffers and a front buffer */ | |
177 SDL_Renderer_PresentVSync = 0x00000010, /**< Present is synchronized with the refresh rate */ | |
178 SDL_Renderer_RenderTarget = 0x00000020, /**< The renderer can create texture render targets */ | |
179 SDL_Renderer_Accelerated = 0x00000040, /**< The renderer uses hardware acceleration */ | |
180 SDL_Renderer_ = 0x00000080, /**< The renderer uses hardware acceleration */ | |
181 SDL_Renderer_Minimal = 0x00000100, /**< The renderer only supports the read/write pixel and present functions */ | |
182 } SDL_RendererFlags; | |
183 | |
184 /** | |
185 * \struct SDL_RendererInfo | |
186 * | |
187 * \brief Information on the capabilities of a render manager. | |
188 */ | |
189 typedef struct SDL_RendererInfo | |
190 { | |
191 const char *name; /**< The name of the renderer */ | |
192 Uint32 flags; /**< Supported SDL_RendererFlags */ | |
193 Uint32 blend_modes; /**< A mask of supported blend modes */ | |
194 Uint32 scale_modes; /**< A mask of supported scale modes */ | |
195 Uint32 num_texture_formats; /**< The number of available texture formats */ | |
196 Uint32 texture_formats[32]; /**< The available texture formats */ | |
197 int max_texture_width; /**< The maximimum texture width */ | |
198 int max_texture_height; /**< The maximimum texture height */ | |
199 } SDL_RendererInfo; | |
200 | |
201 /** | |
202 * \enum SDL_TextureAccess | |
203 * | |
204 * \brief The access pattern allowed for a texture | |
205 */ | |
206 typedef enum | |
207 { | |
208 SDL_TextureAccess_Render, /**< Unlockable video memory, rendering allowed */ | |
209 SDL_TextureAccess_Remote, /**< Unlockable video memory */ | |
210 SDL_TextureAccess_Local, /**< Lockable system memory */ | |
211 } SDL_TextureAccess; | |
212 | |
213 /** | |
214 * \enum SDL_TextureBlendMode | |
215 * | |
216 * \brief The blend mode used in SDL_RenderCopy() | |
217 */ | |
218 typedef enum | |
219 { | |
220 SDL_TextureBlendMode_None = 0x00000000, /**< No blending */ | |
221 SDL_TextureBlendMode_Mask = 0x00000001, /**< dst = A ? src : dst (alpha is mask) */ | |
222 SDL_TextureBlendMode_Blend = 0x00000002, /**< dst = (src * A) + (dst * (1-A)) */ | |
223 SDL_TextureBlendMode_Add = 0x00000004, /**< dst = (src * A) + dst */ | |
224 SDL_TextureBlendMode_Mod = 0x00000008, /**< dst = src * dst */ | |
225 } SDL_TextureBlendMode; | |
226 | |
227 /** | |
228 * \enum SDL_TextureScaleMode | |
229 * | |
230 * \brief The scale mode used in SDL_RenderCopy() | |
231 */ | |
232 typedef enum | |
233 { | |
234 SDL_TextureScaleMode_None = 0x00000000, /**< No scaling, rectangles must match dimensions */ | |
235 SDL_TextureScaleMode_Fast = 0x00000001, /**< Point sampling or equivalent algorithm */ | |
236 SDL_TextureScaleMode_Slow = 0x00000002, /**< Linear filtering or equivalent algorithm */ | |
237 SDL_TextureScaleMode_Best = 0x00000004, /**< Bicubic filtering or equivalent algorithm */ | |
238 } SDL_TextureScaleMode; | |
239 | |
240 /** | |
241 * \typedef SDL_TextureID | |
242 * | |
243 * \brief An efficient driver-specific representation of pixel data | |
244 */ | |
245 typedef Uint32 SDL_TextureID; | |
246 | |
247 /** | |
248 * \typedef SDL_GLContext | |
249 * | |
250 * \brief An opaque handle to an OpenGL context. | |
251 */ | |
252 typedef void *SDL_GLContext; | |
253 | |
254 | |
255 /* These are the currently supported flags for the SDL_surface */ | |
256 /* Used internally (read-only) */ | |
257 #define SDL_HWSURFACE 0x00000001 /* Surface represents a texture */ | |
258 #define SDL_PREALLOC 0x00000002 /* Surface uses preallocated memory */ | |
259 #define SDL_SRCALPHA 0x00000004 /* Blit uses source alpha blending */ | |
260 #define SDL_SRCCOLORKEY 0x00000008 /* Blit uses a source color key */ | |
261 #define SDL_RLEACCELOK 0x00000010 /* Private flag */ | |
262 #define SDL_RLEACCEL 0x00000020 /* Surface is RLE encoded */ | |
263 | |
264 /* Evaluates to true if the surface needs to be locked before access */ | |
265 #define SDL_MUSTLOCK(S) (((S)->flags & (SDL_HWSURFACE|SDL_RLEACCEL)) != 0) | |
84 | 266 |
85 /* This structure should be treated as read-only, except for 'pixels', | 267 /* This structure should be treated as read-only, except for 'pixels', |
86 which, if not NULL, contains the raw pixel data for the surface. | 268 which, if not NULL, contains the raw pixel data for the surface. |
87 */ | 269 */ |
88 typedef struct SDL_Surface { | 270 typedef struct SDL_Surface |
89 Uint32 flags; /* Read-only */ | 271 { |
90 SDL_PixelFormat *format; /* Read-only */ | 272 Uint32 flags; /* Read-only */ |
91 int w, h; /* Read-only */ | 273 SDL_PixelFormat *format; /* Read-only */ |
92 Uint16 pitch; /* Read-only */ | 274 int w, h; /* Read-only */ |
93 void *pixels; /* Read-write */ | 275 int pitch; /* Read-only */ |
94 int offset; /* Private */ | 276 void *pixels; /* Read-write */ |
95 | 277 |
96 /* Hardware-specific surface info */ | 278 /* texture associated with the surface, if any */ |
97 struct private_hwdata *hwdata; | 279 SDL_TextureID textureID; |
98 | 280 |
99 /* clipping information */ | 281 /* information needed for surfaces requiring locks */ |
100 SDL_Rect clip_rect; /* Read-only */ | 282 int locked; |
101 Uint32 unused1; /* for binary compatibility */ | 283 void *lock_data; |
102 | 284 |
103 /* Allow recursive locks */ | 285 /* clipping information */ |
104 Uint32 locked; /* Private */ | 286 SDL_Rect clip_rect; /* Read-only */ |
105 | 287 |
106 /* info for fast blit mapping to other surfaces */ | 288 /* info for fast blit mapping to other surfaces */ |
107 struct SDL_BlitMap *map; /* Private */ | 289 struct SDL_BlitMap *map; /* Private */ |
108 | 290 |
109 /* format version, bumped at every change to invalidate blit maps */ | 291 /* format version, bumped at every change to invalidate blit maps */ |
110 unsigned int format_version; /* Private */ | 292 unsigned int format_version; /* Private */ |
111 | 293 |
112 /* Reference count -- used when freeing surface */ | 294 /* Reference count -- used when freeing surface */ |
113 int refcount; /* Read-mostly */ | 295 int refcount; /* Read-mostly */ |
114 } SDL_Surface; | 296 } SDL_Surface; |
115 | 297 |
116 /* These are the currently supported flags for the SDL_surface */ | |
117 /* Available for SDL_CreateRGBSurface() or SDL_SetVideoMode() */ | |
118 #define SDL_SWSURFACE 0x00000000 /* Surface is in system memory */ | |
119 #define SDL_HWSURFACE 0x00000001 /* Surface is in video memory */ | |
120 #define SDL_ASYNCBLIT 0x00000004 /* Use asynchronous blits if possible */ | |
121 /* Available for SDL_SetVideoMode() */ | |
122 #define SDL_ANYFORMAT 0x10000000 /* Allow any video depth/pixel-format */ | |
123 #define SDL_HWPALETTE 0x20000000 /* Surface has exclusive palette */ | |
124 #define SDL_DOUBLEBUF 0x40000000 /* Set up double-buffered video mode */ | |
125 #define SDL_FULLSCREEN 0x80000000 /* Surface is a full screen display */ | |
126 #define SDL_OPENGL 0x00000002 /* Create an OpenGL rendering context */ | |
127 #define SDL_OPENGLBLIT 0x0000000A /* Create an OpenGL rendering context and use it for blitting */ | |
128 #define SDL_RESIZABLE 0x00000010 /* This video mode may be resized */ | |
129 #define SDL_NOFRAME 0x00000020 /* No window caption or edge frame */ | |
130 /* Used internally (read-only) */ | |
131 #define SDL_HWACCEL 0x00000100 /* Blit uses hardware acceleration */ | |
132 #define SDL_SRCCOLORKEY 0x00001000 /* Blit uses a source color key */ | |
133 #define SDL_RLEACCELOK 0x00002000 /* Private flag */ | |
134 #define SDL_RLEACCEL 0x00004000 /* Surface is RLE encoded */ | |
135 #define SDL_SRCALPHA 0x00010000 /* Blit uses source alpha blending */ | |
136 #define SDL_PREALLOC 0x01000000 /* Surface uses preallocated memory */ | |
137 | |
138 /* Evaluates to true if the surface needs to be locked before access */ | |
139 #define SDL_MUSTLOCK(surface) \ | |
140 (surface->offset || \ | |
141 ((surface->flags & (SDL_HWSURFACE|SDL_ASYNCBLIT|SDL_RLEACCEL)) != 0)) | |
142 | |
143 /* typedef for private surface blitting functions */ | 298 /* typedef for private surface blitting functions */ |
144 typedef int (*SDL_blit)(struct SDL_Surface *src, SDL_Rect *srcrect, | 299 typedef int (*SDL_blit) (struct SDL_Surface * src, SDL_Rect * srcrect, |
145 struct SDL_Surface *dst, SDL_Rect *dstrect); | 300 struct SDL_Surface * dst, SDL_Rect * dstrect); |
146 | 301 |
147 | 302 |
148 /* Useful for determining the video hardware capabilities */ | 303 /** |
149 typedef struct SDL_VideoInfo { | 304 * \enum SDL_GLattr |
150 Uint32 hw_available :1; /* Flag: Can you create hardware surfaces? */ | 305 * |
151 Uint32 wm_available :1; /* Flag: Can you talk to a window manager? */ | 306 * \brief OpenGL configuration attributes |
152 Uint32 UnusedBits1 :6; | 307 */ |
153 Uint32 UnusedBits2 :1; | 308 typedef enum |
154 Uint32 blit_hw :1; /* Flag: Accelerated blits HW --> HW */ | 309 { |
155 Uint32 blit_hw_CC :1; /* Flag: Accelerated blits with Colorkey */ | |
156 Uint32 blit_hw_A :1; /* Flag: Accelerated blits with Alpha */ | |
157 Uint32 blit_sw :1; /* Flag: Accelerated blits SW --> HW */ | |
158 Uint32 blit_sw_CC :1; /* Flag: Accelerated blits with Colorkey */ | |
159 Uint32 blit_sw_A :1; /* Flag: Accelerated blits with Alpha */ | |
160 Uint32 blit_fill :1; /* Flag: Accelerated color fill */ | |
161 Uint32 UnusedBits3 :16; | |
162 Uint32 video_mem; /* The total amount of video memory (in K) */ | |
163 SDL_PixelFormat *vfmt; /* Value: The format of the video surface */ | |
164 int current_w; /* Value: The current video mode width */ | |
165 int current_h; /* Value: The current video mode height */ | |
166 } SDL_VideoInfo; | |
167 | |
168 | |
169 /* The most common video overlay formats. | |
170 For an explanation of these pixel formats, see: | |
171 http://www.webartz.com/fourcc/indexyuv.htm | |
172 | |
173 For information on the relationship between color spaces, see: | |
174 http://www.neuro.sfc.keio.ac.jp/~aly/polygon/info/color-space-faq.html | |
175 */ | |
176 #define SDL_YV12_OVERLAY 0x32315659 /* Planar mode: Y + V + U (3 planes) */ | |
177 #define SDL_IYUV_OVERLAY 0x56555949 /* Planar mode: Y + U + V (3 planes) */ | |
178 #define SDL_YUY2_OVERLAY 0x32595559 /* Packed mode: Y0+U0+Y1+V0 (1 plane) */ | |
179 #define SDL_UYVY_OVERLAY 0x59565955 /* Packed mode: U0+Y0+V0+Y1 (1 plane) */ | |
180 #define SDL_YVYU_OVERLAY 0x55595659 /* Packed mode: Y0+V0+Y1+U0 (1 plane) */ | |
181 | |
182 /* The YUV hardware video overlay */ | |
183 typedef struct SDL_Overlay { | |
184 Uint32 format; /* Read-only */ | |
185 int w, h; /* Read-only */ | |
186 int planes; /* Read-only */ | |
187 Uint16 *pitches; /* Read-only */ | |
188 Uint8 **pixels; /* Read-write */ | |
189 | |
190 /* Hardware-specific surface info */ | |
191 struct private_yuvhwfuncs *hwfuncs; | |
192 struct private_yuvhwdata *hwdata; | |
193 | |
194 /* Special flags */ | |
195 Uint32 hw_overlay :1; /* Flag: This overlay hardware accelerated? */ | |
196 Uint32 UnusedBits :31; | |
197 } SDL_Overlay; | |
198 | |
199 | |
200 /* Public enumeration for setting the OpenGL window attributes. */ | |
201 typedef enum { | |
202 SDL_GL_RED_SIZE, | 310 SDL_GL_RED_SIZE, |
203 SDL_GL_GREEN_SIZE, | 311 SDL_GL_GREEN_SIZE, |
204 SDL_GL_BLUE_SIZE, | 312 SDL_GL_BLUE_SIZE, |
205 SDL_GL_ALPHA_SIZE, | 313 SDL_GL_ALPHA_SIZE, |
206 SDL_GL_BUFFER_SIZE, | 314 SDL_GL_BUFFER_SIZE, |
212 SDL_GL_ACCUM_BLUE_SIZE, | 320 SDL_GL_ACCUM_BLUE_SIZE, |
213 SDL_GL_ACCUM_ALPHA_SIZE, | 321 SDL_GL_ACCUM_ALPHA_SIZE, |
214 SDL_GL_STEREO, | 322 SDL_GL_STEREO, |
215 SDL_GL_MULTISAMPLEBUFFERS, | 323 SDL_GL_MULTISAMPLEBUFFERS, |
216 SDL_GL_MULTISAMPLESAMPLES, | 324 SDL_GL_MULTISAMPLESAMPLES, |
217 SDL_GL_ACCELERATED_VISUAL, | 325 SDL_GL_ACCELERATED_VISUAL |
218 SDL_GL_SWAP_CONTROL | |
219 } SDL_GLattr; | 326 } SDL_GLattr; |
220 | 327 |
221 /* flags for SDL_SetPalette() */ | |
222 #define SDL_LOGPAL 0x01 | |
223 #define SDL_PHYSPAL 0x02 | |
224 | 328 |
225 /* Function prototypes */ | 329 /* Function prototypes */ |
226 | 330 |
227 /* These functions are used internally, and should not be used unless you | 331 /** |
228 * have a specific need to specify the video driver you want to use. | 332 * \fn int SDL_GetNumVideoDrivers(void) |
229 * You should normally use SDL_Init() or SDL_InitSubSystem(). | 333 * |
230 * | 334 * \brief Get the number of video drivers compiled into SDL |
231 * SDL_VideoInit() initializes the video subsystem -- sets up a connection | 335 * |
232 * to the window manager, etc, and determines the current video mode and | 336 * \sa SDL_GetVideoDriver() |
233 * pixel format, but does not initialize a window or graphics mode. | 337 */ |
234 * Note that event handling is activated by this routine. | 338 extern DECLSPEC int SDLCALL SDL_GetNumVideoDrivers(void); |
235 * | 339 |
236 * If you use both sound and video in your application, you need to call | 340 /** |
237 * SDL_Init() before opening the sound device, otherwise under Win32 DirectX, | 341 * \fn const char *SDL_GetVideoDriver(int index) |
238 * you won't be able to set full-screen display modes. | 342 * |
239 */ | 343 * \brief Get the name of a built in video driver. |
240 extern DECLSPEC int SDLCALL SDL_VideoInit(const char *driver_name, Uint32 flags); | 344 * |
345 * \note The video drivers are presented in the order in which they are | |
346 * normally checked during initialization. | |
347 * | |
348 * \sa SDL_GetNumVideoDrivers() | |
349 */ | |
350 extern DECLSPEC const char *SDLCALL SDL_GetVideoDriver(int index); | |
351 | |
352 /** | |
353 * \fn int SDL_VideoInit(const char *driver_name, Uint32 flags) | |
354 * | |
355 * \brief Initialize the video subsystem, optionally specifying a video driver. | |
356 * | |
357 * \param driver_name Initialize a specific driver by name, or NULL for the default video driver. | |
358 * \param flags FIXME: Still needed? | |
359 * | |
360 * \return 0 on success, -1 on error | |
361 * | |
362 * This function initializes the video subsystem; setting up a connection | |
363 * to the window manager, etc, and determines the available display modes | |
364 * and pixel formats, but does not initialize a window or graphics mode. | |
365 * | |
366 * \sa SDL_VideoQuit() | |
367 */ | |
368 extern DECLSPEC int SDLCALL SDL_VideoInit(const char *driver_name, | |
369 Uint32 flags); | |
370 | |
371 /** | |
372 * \fn void SDL_VideoQuit(void) | |
373 * | |
374 * \brief Shuts down the video subsystem. | |
375 * | |
376 * This function closes all windows, and restores the original video mode. | |
377 * | |
378 * \sa SDL_VideoInit() | |
379 */ | |
241 extern DECLSPEC void SDLCALL SDL_VideoQuit(void); | 380 extern DECLSPEC void SDLCALL SDL_VideoQuit(void); |
242 | 381 |
243 /* This function fills the given character buffer with the name of the | 382 /** |
244 * video driver, and returns a pointer to it if the video driver has | 383 * \fn const char *SDL_GetCurrentVideoDriver(void) |
245 * been initialized. It returns NULL if no driver has been initialized. | 384 * |
246 */ | 385 * \brief Returns the name of the currently initialized video driver. |
247 extern DECLSPEC char * SDLCALL SDL_VideoDriverName(char *namebuf, int maxlen); | 386 * |
248 | 387 * \return The name of the current video driver or NULL if no driver |
249 /* | 388 * has been initialized |
250 * This function returns a pointer to the current display surface. | 389 * |
251 * If SDL is doing format conversion on the display surface, this | 390 * \sa SDL_GetNumVideoDrivers() |
252 * function returns the publicly visible surface, not the real video | 391 * \sa SDL_GetVideoDriver() |
253 * surface. | 392 */ |
254 */ | 393 extern DECLSPEC const char *SDLCALL SDL_GetCurrentVideoDriver(void); |
255 extern DECLSPEC SDL_Surface * SDLCALL SDL_GetVideoSurface(void); | 394 |
256 | 395 /** |
257 /* | 396 * \fn int SDL_GetNumVideoDisplays(void) |
258 * This function returns a read-only pointer to information about the | 397 * |
259 * video hardware. If this is called before SDL_SetVideoMode(), the 'vfmt' | 398 * \brief Returns the number of available video displays. |
260 * member of the returned structure will contain the pixel format of the | 399 * |
261 * "best" video mode. | 400 * \sa SDL_SelectVideoDisplay() |
262 */ | 401 */ |
263 extern DECLSPEC const SDL_VideoInfo * SDLCALL SDL_GetVideoInfo(void); | 402 extern DECLSPEC int SDLCALL SDL_GetNumVideoDisplays(void); |
264 | 403 |
265 /* | 404 /** |
266 * Check to see if a particular video mode is supported. | 405 * \fn int SDL_SelectVideoDisplay(int index) |
267 * It returns 0 if the requested mode is not supported under any bit depth, | 406 * |
268 * or returns the bits-per-pixel of the closest available mode with the | 407 * \brief Set the index of the currently selected display. |
269 * given width and height. If this bits-per-pixel is different from the | 408 * |
270 * one used when setting the video mode, SDL_SetVideoMode() will succeed, | 409 * \return The index of the currently selected display. |
271 * but will emulate the requested bits-per-pixel with a shadow surface. | 410 * |
272 * | 411 * \note You can query the currently selected display by passing an index of -1. |
273 * The arguments to SDL_VideoModeOK() are the same ones you would pass to | 412 * |
274 * SDL_SetVideoMode() | 413 * \sa SDL_GetNumVideoDisplays() |
275 */ | 414 */ |
276 extern DECLSPEC int SDLCALL SDL_VideoModeOK(int width, int height, int bpp, Uint32 flags); | 415 extern DECLSPEC int SDLCALL SDL_SelectVideoDisplay(int index); |
277 | 416 |
278 /* | 417 /** |
279 * Return a pointer to an array of available screen dimensions for the | 418 * \fn int SDL_GetNumDisplayModes(void) |
280 * given format and video flags, sorted largest to smallest. Returns | 419 * |
281 * NULL if there are no dimensions available for a particular format, | 420 * \brief Returns the number of available display modes for the current display. |
282 * or (SDL_Rect **)-1 if any dimension is okay for the given format. | 421 * |
283 * | 422 * \sa SDL_GetDisplayMode() |
284 * If 'format' is NULL, the mode list will be for the format given | 423 */ |
285 * by SDL_GetVideoInfo()->vfmt | 424 extern DECLSPEC int SDLCALL SDL_GetNumDisplayModes(void); |
286 */ | 425 |
287 extern DECLSPEC SDL_Rect ** SDLCALL SDL_ListModes(SDL_PixelFormat *format, Uint32 flags); | 426 /** |
288 | 427 * \fn const SDL_DisplayMode *SDL_GetDisplayMode(int index) |
289 /* | 428 * |
290 * Set up a video mode with the specified width, height and bits-per-pixel. | 429 * \brief Retrieve information about a specific display mode. |
291 * | 430 * |
292 * If 'bpp' is 0, it is treated as the current display bits per pixel. | 431 * \note The display modes are sorted in this priority: |
293 * | 432 * \li bits per pixel -> more colors to fewer colors |
294 * If SDL_ANYFORMAT is set in 'flags', the SDL library will try to set the | 433 * \li width -> largest to smallest |
295 * requested bits-per-pixel, but will return whatever video pixel format is | 434 * \li height -> largest to smallest |
296 * available. The default is to emulate the requested pixel format if it | 435 * \li refresh rate -> highest to lowest |
297 * is not natively available. | 436 * |
298 * | 437 * \sa SDL_GetNumDisplayModes() |
299 * If SDL_HWSURFACE is set in 'flags', the video surface will be placed in | 438 */ |
300 * video memory, if possible, and you may have to call SDL_LockSurface() | 439 extern DECLSPEC const SDL_DisplayMode *SDLCALL SDL_GetDisplayMode(int index); |
301 * in order to access the raw framebuffer. Otherwise, the video surface | 440 |
302 * will be created in system memory. | 441 /** |
303 * | 442 * \fn const SDL_DisplayMode *SDL_GetDesktopDisplayMode(void) |
304 * If SDL_ASYNCBLIT is set in 'flags', SDL will try to perform rectangle | 443 * |
305 * updates asynchronously, but you must always lock before accessing pixels. | 444 * \brief Retrieve information about the desktop display mode for the current display. |
306 * SDL will wait for updates to complete before returning from the lock. | 445 */ |
307 * | 446 extern DECLSPEC const SDL_DisplayMode *SDLCALL |
308 * If SDL_HWPALETTE is set in 'flags', the SDL library will guarantee | 447 SDL_GetDesktopDisplayMode(void); |
309 * that the colors set by SDL_SetColors() will be the colors you get. | 448 |
310 * Otherwise, in 8-bit mode, SDL_SetColors() may not be able to set all | 449 /** |
311 * of the colors exactly the way they are requested, and you should look | 450 * \fn const SDL_DisplayMode *SDL_GetCurrentDisplayMode(void) |
312 * at the video surface structure to determine the actual palette. | 451 * |
313 * If SDL cannot guarantee that the colors you request can be set, | 452 * \brief Retrieve information about the current display mode. |
314 * i.e. if the colormap is shared, then the video surface may be created | 453 */ |
315 * under emulation in system memory, overriding the SDL_HWSURFACE flag. | 454 extern DECLSPEC const SDL_DisplayMode *SDLCALL |
316 * | 455 SDL_GetCurrentDisplayMode(void); |
317 * If SDL_FULLSCREEN is set in 'flags', the SDL library will try to set | 456 |
318 * a fullscreen video mode. The default is to create a windowed mode | 457 /** |
319 * if the current graphics system has a window manager. | 458 * \fn SDL_DisplayMode *SDL_GetClosestDisplayMode(const SDL_DisplayMode *mode, SDL_DisplayMode *closest) |
320 * If the SDL library is able to set a fullscreen video mode, this flag | 459 * |
321 * will be set in the surface that is returned. | 460 * \brief Get the closest match to the requested display mode. |
322 * | 461 * |
323 * If SDL_DOUBLEBUF is set in 'flags', the SDL library will try to set up | 462 * \param mode The desired display mode |
324 * two surfaces in video memory and swap between them when you call | 463 * \param closest A pointer to a display mode to be filled in with the closest match of the available display modes. |
325 * SDL_Flip(). This is usually slower than the normal single-buffering | 464 * |
326 * scheme, but prevents "tearing" artifacts caused by modifying video | 465 * \return The passed in value 'closest', or NULL if no matching video mode was available. |
327 * memory while the monitor is refreshing. It should only be used by | 466 * |
328 * applications that redraw the entire screen on every update. | 467 * 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. |
329 * | 468 * |
330 * If SDL_RESIZABLE is set in 'flags', the SDL library will allow the | 469 * \sa SDL_GetNumDisplayModes() |
331 * window manager, if any, to resize the window at runtime. When this | 470 * \sa SDL_GetDisplayMode() |
332 * occurs, SDL will send a SDL_VIDEORESIZE event to you application, | 471 */ |
333 * and you must respond to the event by re-calling SDL_SetVideoMode() | 472 extern DECLSPEC SDL_DisplayMode *SDLCALL SDL_GetClosestDisplayMode(const |
334 * with the requested size (or another size that suits the application). | 473 SDL_DisplayMode |
335 * | 474 * mode, |
336 * If SDL_NOFRAME is set in 'flags', the SDL library will create a window | 475 SDL_DisplayMode |
337 * without any title bar or frame decoration. Fullscreen video modes have | 476 * closest); |
338 * this flag set automatically. | 477 |
339 * | 478 /** |
340 * This function returns the video framebuffer surface, or NULL if it fails. | 479 * \fn int SDL_SetFullscreenDisplayMode(const SDL_DisplayMode *mode) |
341 * | 480 * |
342 * If you rely on functionality provided by certain video flags, check the | 481 * \brief Set the display mode used when a fullscreen window is visible |
343 * flags of the returned surface to make sure that functionality is available. | 482 * on the currently selected display. |
344 * SDL will fall back to reduced functionality if the exact flags you wanted | 483 * |
345 * are not available. | 484 * \param mode The mode to use, or NULL for the desktop mode. |
346 */ | 485 * |
347 extern DECLSPEC SDL_Surface * SDLCALL SDL_SetVideoMode | 486 * \return 0 on success, or -1 if setting the display mode failed. |
348 (int width, int height, int bpp, Uint32 flags); | 487 * |
349 | 488 * \sa SDL_SetWindowFullscreen() |
350 /* | 489 */ |
351 * Makes sure the given list of rectangles is updated on the given screen. | 490 extern DECLSPEC int SDLCALL SDL_SetFullscreenDisplayMode(const SDL_DisplayMode |
352 * If 'x', 'y', 'w' and 'h' are all 0, SDL_UpdateRect will update the entire | 491 * mode); |
353 * screen. | 492 |
354 * These functions should not be called while 'screen' is locked. | 493 /** |
355 */ | 494 * \fn const SDL_DisplayMode *SDL_GetFullscreenDisplayMode(void) |
356 extern DECLSPEC void SDLCALL SDL_UpdateRects | 495 * |
357 (SDL_Surface *screen, int numrects, SDL_Rect *rects); | 496 * \brief Query the display mode used when a fullscreen window is visible |
358 extern DECLSPEC void SDLCALL SDL_UpdateRect | 497 * on the currently selected display. |
359 (SDL_Surface *screen, Sint32 x, Sint32 y, Uint32 w, Uint32 h); | 498 */ |
360 | 499 extern DECLSPEC const SDL_DisplayMode *SDLCALL |
361 /* | 500 SDL_GetFullscreenDisplayMode(void); |
362 * On hardware that supports double-buffering, this function sets up a flip | 501 |
363 * and returns. The hardware will wait for vertical retrace, and then swap | 502 /** |
364 * video buffers before the next video surface blit or lock will return. | 503 * \fn int SDL_SetDisplayPalette(const SDL_Color *colors, int firstcolor, int ncolors) |
365 * On hardware that doesn not support double-buffering, this is equivalent | 504 * |
366 * to calling SDL_UpdateRect(screen, 0, 0, 0, 0); | 505 * \brief Set the palette entries for indexed display modes. |
367 * The SDL_DOUBLEBUF flag must have been passed to SDL_SetVideoMode() when | 506 * |
368 * setting the video mode for this function to perform hardware flipping. | 507 * \return 0 on success, or -1 if the display mode isn't palettized or the colors couldn't be set. |
369 * This function returns 0 if successful, or -1 if there was an error. | 508 */ |
370 */ | 509 extern DECLSPEC int SDLCALL SDL_SetDisplayPalette(const SDL_Color * colors, |
371 extern DECLSPEC int SDLCALL SDL_Flip(SDL_Surface *screen); | 510 int firstcolor, |
372 | 511 int ncolors); |
373 /* | 512 |
374 * Set the gamma correction for each of the color channels. | 513 /** |
375 * The gamma values range (approximately) between 0.1 and 10.0 | 514 * \fn int SDL_GetDisplayPalette(SDL_Color *colors, int firstcolor, int ncolors) |
376 * | 515 * |
377 * If this function isn't supported directly by the hardware, it will | 516 * \brief Gets the palette entries for indexed display modes. |
378 * be emulated using gamma ramps, if available. If successful, this | 517 * |
379 * function returns 0, otherwise it returns -1. | 518 * \return 0 on success, or -1 if the display mode isn't palettized |
519 */ | |
520 extern DECLSPEC int SDLCALL SDL_GetDisplayPalette(SDL_Color * colors, | |
521 int firstcolor, | |
522 int ncolors); | |
523 | |
524 /** | |
525 * \fn int SDL_SetGamma(float red, float green, float blue) | |
526 * | |
527 * \brief Set the gamma correction for each of the color channels on the currently selected display. | |
528 * | |
529 * \return 0 on success, or -1 if setting the gamma isn't supported. | |
530 * | |
531 * \sa SDL_SetGammaRamp() | |
380 */ | 532 */ |
381 extern DECLSPEC int SDLCALL SDL_SetGamma(float red, float green, float blue); | 533 extern DECLSPEC int SDLCALL SDL_SetGamma(float red, float green, float blue); |
382 | 534 |
383 /* | 535 /** |
536 * \fn int SDL_SetGammaRamp(const Uint16 * red, const Uint16 * green, const Uint16 * blue) | |
537 * | |
538 * \brief Set the gamma ramp for the currently selected display. | |
539 * | |
540 * \param red The translation table for the red channel, or NULL | |
541 * \param green The translation table for the green channel, or NULL | |
542 * \param blue The translation table for the blue channel, or NULL | |
543 * | |
544 * \return 0 on success, or -1 if gamma ramps are unsupported. | |
545 * | |
384 * Set the gamma translation table for the red, green, and blue channels | 546 * Set the gamma translation table for the red, green, and blue channels |
385 * of the video hardware. Each table is an array of 256 16-bit quantities, | 547 * of the video hardware. Each table is an array of 256 16-bit quantities, |
386 * representing a mapping between the input and output for that channel. | 548 * representing a mapping between the input and output for that channel. |
387 * The input is the index into the array, and the output is the 16-bit | 549 * The input is the index into the array, and the output is the 16-bit |
388 * gamma value at that index, scaled to the output color precision. | 550 * gamma value at that index, scaled to the output color precision. |
389 * | 551 * |
390 * You may pass NULL for any of the channels to leave it unchanged. | 552 * \sa SDL_GetGammaRamp() |
391 * If the call succeeds, it will return 0. If the display driver or | 553 */ |
392 * hardware does not support gamma translation, or otherwise fails, | 554 extern DECLSPEC int SDLCALL SDL_SetGammaRamp(const Uint16 * red, |
393 * this function will return -1. | 555 const Uint16 * green, |
394 */ | 556 const Uint16 * blue); |
395 extern DECLSPEC int SDLCALL SDL_SetGammaRamp(const Uint16 *red, const Uint16 *green, const Uint16 *blue); | 557 |
396 | 558 /** |
397 /* | 559 * \fn int SDL_GetGammaRamp(Uint16 * red, Uint16 * green, Uint16 * blue) |
398 * Retrieve the current values of the gamma translation tables. | 560 * |
561 * \brief Get the gamma ramp for the currently selected display. | |
562 * | |
563 * \param red A pointer to a 256 element array of 16-bit quantities to hold the translation table for the red channel, or NULL. | |
564 * \param green A pointer to a 256 element array of 16-bit quantities to hold the translation table for the green channel, or NULL. | |
565 * \param blue A pointer to a 256 element array of 16-bit quantities to hold the translation table for the blue channel, or NULL. | |
399 * | 566 * |
400 * You must pass in valid pointers to arrays of 256 16-bit quantities. | 567 * \return 0 on success, or -1 if gamma ramps are unsupported. |
401 * Any of the pointers may be NULL to ignore that channel. | 568 * |
402 * If the call succeeds, it will return 0. If the display driver or | 569 * \sa SDL_SetGammaRamp() |
403 * hardware does not support gamma translation, or otherwise fails, | 570 */ |
404 * this function will return -1. | 571 extern DECLSPEC int SDLCALL SDL_GetGammaRamp(Uint16 * red, Uint16 * green, |
405 */ | 572 Uint16 * blue); |
406 extern DECLSPEC int SDLCALL SDL_GetGammaRamp(Uint16 *red, Uint16 *green, Uint16 *blue); | 573 |
407 | 574 |
408 /* | 575 /** |
409 * Sets a portion of the colormap for the given 8-bit surface. If 'surface' | 576 * \fn SDL_WindowID SDL_CreateWindow(const char *title, int x, int y, int w, int h, Uint32 flags) |
410 * is not a palettized surface, this function does nothing, returning 0. | 577 * |
411 * If all of the colors were set as passed to SDL_SetColors(), it will | 578 * \brief Create a window with the specified position, dimensions, and flags. |
412 * return 1. If not all the color entries were set exactly as given, | 579 * |
413 * it will return 0, and you should look at the surface palette to | 580 * \param title The title of the window |
414 * determine the actual color palette. | 581 * \param x The x position of the window |
415 * | 582 * \param y The y position of the window |
416 * When 'surface' is the surface associated with the current display, the | 583 * \param w The width of the window |
417 * display colormap will be updated with the requested colors. If | 584 * \param h The height of the window |
418 * SDL_HWPALETTE was set in SDL_SetVideoMode() flags, SDL_SetColors() | 585 * \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 |
419 * will always return 1, and the palette is guaranteed to be set the way | 586 * |
420 * you desire, even if the window colormap has to be warped or run under | 587 * \return The id of the window created, or zero if window creation failed. |
421 * emulation. | 588 * |
422 */ | 589 * \note Setting the position to -1, -1, indicates any position is fine. |
423 extern DECLSPEC int SDLCALL SDL_SetColors(SDL_Surface *surface, | 590 * |
424 SDL_Color *colors, int firstcolor, int ncolors); | 591 * \sa SDL_DestroyWindow() |
425 | 592 */ |
426 /* | 593 extern DECLSPEC SDL_WindowID SDLCALL SDL_CreateWindow(const char *title, |
427 * Sets a portion of the colormap for a given 8-bit surface. | 594 int x, int y, int w, |
428 * 'flags' is one or both of: | 595 int h, Uint32 flags); |
429 * SDL_LOGPAL -- set logical palette, which controls how blits are mapped | 596 |
430 * to/from the surface, | 597 /** |
431 * SDL_PHYSPAL -- set physical palette, which controls how pixels look on | 598 * \fn SDL_WindowID SDL_CreateWindowFrom(void *data) |
432 * the screen | 599 * |
433 * Only screens have physical palettes. Separate change of physical/logical | 600 * \brief Create an SDL window struct from an existing native window. |
434 * palettes is only possible if the screen has SDL_HWPALETTE set. | 601 * |
435 * | 602 * \param data A pointer to driver-dependent window creation data |
436 * The return value is 1 if all colours could be set as requested, and 0 | 603 * |
437 * otherwise. | 604 * \return The id of the window created, or zero if window creation failed. |
438 * | 605 * |
439 * SDL_SetColors() is equivalent to calling this function with | 606 * \warning This function is NOT SUPPORTED, use at your own risk! |
440 * flags = (SDL_LOGPAL|SDL_PHYSPAL). | 607 * |
441 */ | 608 * \sa SDL_DestroyWindow() |
442 extern DECLSPEC int SDLCALL SDL_SetPalette(SDL_Surface *surface, int flags, | 609 */ |
443 SDL_Color *colors, int firstcolor, | 610 extern DECLSPEC SDL_WindowID SDLCALL SDL_CreateWindowFrom(const void *data); |
444 int ncolors); | 611 |
612 /** | |
613 * \fn Uint32 SDL_GetWindowFlags(SDL_WindowID windowID) | |
614 * | |
615 * \brief Get the window flags. | |
616 */ | |
617 extern DECLSPEC Uint32 SDLCALL SDL_GetWindowFlags(SDL_WindowID windowID); | |
618 | |
619 /** | |
620 * \fn void SDL_SetWindowTitle(SDL_WindowID windowID, const char *title) | |
621 * | |
622 * \brief Set the title of the window, in UTF-8 format. | |
623 * | |
624 * \sa SDL_GetWindowTitle() | |
625 */ | |
626 extern DECLSPEC void SDLCALL SDL_SetWindowTitle(SDL_WindowID windowID, | |
627 const char *title); | |
628 | |
629 /** | |
630 * \fn const char *SDL_GetWindowTitle(SDL_WindowID windowID) | |
631 * | |
632 * \brief Get the title of the window, in UTF-8 format. | |
633 * | |
634 * \sa SDL_SetWindowTitle() | |
635 */ | |
636 extern DECLSPEC const char *SDLCALL SDL_GetWindowTitle(SDL_WindowID windowID); | |
637 | |
638 /** | |
639 * \fn void SDL_SetWindowIcon(SDL_Surface *icon) | |
640 * | |
641 * \brief Set the icon of the window. | |
642 * | |
643 * \param icon The icon for the window | |
644 * | |
645 * FIXME: The icon needs to be set before the window is first shown. Should some icon representation be part of the window creation data? | |
646 */ | |
647 extern DECLSPEC void SDLCALL SDL_SetWindowIcon(SDL_Surface * icon); | |
648 | |
649 /** | |
650 * \fn void SDL_SetWindowData(SDL_WindowID windowID, void *userdata) | |
651 * | |
652 * \brief Associate an arbitrary pointer with the window. | |
653 * | |
654 * \sa SDL_GetWindowData() | |
655 */ | |
656 extern DECLSPEC void SDLCALL SDL_SetWindowData(SDL_WindowID windowID, | |
657 void *userdata); | |
658 | |
659 /** | |
660 * \fn void *SDL_GetWindowData(SDL_WindowID windowID) | |
661 * | |
662 * \brief Retrieve the data pointer associated with the window. | |
663 * | |
664 * \sa SDL_SetWindowData() | |
665 */ | |
666 extern DECLSPEC void *SDLCALL SDL_GetWindowData(SDL_WindowID windowID); | |
667 | |
668 /** | |
669 * \fn void SDL_SetWindowPosition(SDL_WindowID windowID, int x, int y) | |
670 * | |
671 * \brief Set the position of the window. | |
672 * | |
673 * \param windowID The window to reposition | |
674 * \param x The x coordinate of the window, SDL_WINDOWPOS_CENTERED, or SDL_WINDOWPOS_UNDEFINED | |
675 * \param y The y coordinate of the window, SDL_WINDOWPOS_CENTERED, or SDL_WINDOWPOS_UNDEFINED | |
676 * | |
677 * \note The window coordinate origin is the upper left of the display. | |
678 * | |
679 * \sa SDL_GetWindowPosition() | |
680 */ | |
681 extern DECLSPEC void SDLCALL SDL_SetWindowPosition(SDL_WindowID windowID, | |
682 int x, int y); | |
683 | |
684 /** | |
685 * \fn void SDL_GetWindowPosition(SDL_WindowID windowID, int *x, int *y) | |
686 * | |
687 * \brief Get the position of the window. | |
688 * | |
689 * \sa SDL_SetWindowPosition() | |
690 */ | |
691 extern DECLSPEC void SDLCALL SDL_GetWindowPosition(SDL_WindowID windowID, | |
692 int *x, int *y); | |
693 | |
694 /** | |
695 * \fn void SDL_SetWindowSize(SDL_WindowID windowID, int w, int w) | |
696 * | |
697 * \brief Set the size of the window's client area. | |
698 * | |
699 * \note You can't change the size of a fullscreen window, it automatically | |
700 * matches the size of the display mode. | |
701 * | |
702 * \sa SDL_GetWindowSize() | |
703 */ | |
704 extern DECLSPEC void SDLCALL SDL_SetWindowSize(SDL_WindowID windowID, int w, | |
705 int h); | |
706 | |
707 /** | |
708 * \fn void SDL_GetWindowSize(SDL_WindowID windowID, int *w, int *w) | |
709 * | |
710 * \brief Get the size of the window's client area. | |
711 * | |
712 * \sa SDL_SetWindowSize() | |
713 */ | |
714 extern DECLSPEC void SDLCALL SDL_GetWindowSize(SDL_WindowID windowID, int *w, | |
715 int *h); | |
716 | |
717 /** | |
718 * \fn void SDL_ShowWindow(SDL_WindowID windowID) | |
719 * | |
720 * \brief Show the window | |
721 * | |
722 * \sa SDL_HideWindow() | |
723 */ | |
724 extern DECLSPEC void SDLCALL SDL_ShowWindow(SDL_WindowID windowID); | |
725 | |
726 /** | |
727 * \fn void SDL_HideWindow(SDL_WindowID windowID) | |
728 * | |
729 * \brief Hide the window | |
730 * | |
731 * \sa SDL_ShowWindow() | |
732 */ | |
733 extern DECLSPEC void SDLCALL SDL_HideWindow(SDL_WindowID windowID); | |
734 | |
735 /** | |
736 * \fn void SDL_RaiseWindow(SDL_WindowID windowID) | |
737 * | |
738 * \brief Raise the window above other windows and set the input focus. | |
739 */ | |
740 extern DECLSPEC void SDLCALL SDL_RaiseWindow(SDL_WindowID windowID); | |
741 | |
742 /** | |
743 * \fn void SDL_MaximizeWindow(SDL_WindowID windowID) | |
744 * | |
745 * \brief Make the window as large as possible. | |
746 * | |
747 * \sa SDL_RestoreWindow() | |
748 */ | |
749 extern DECLSPEC void SDLCALL SDL_MaximizeWindow(SDL_WindowID windowID); | |
750 | |
751 /** | |
752 * \fn void SDL_MinimizeWindow(SDL_WindowID windowID) | |
753 * | |
754 * \brief Minimize the window to an iconic representation. | |
755 * | |
756 * \sa SDL_RestoreWindow() | |
757 */ | |
758 extern DECLSPEC void SDLCALL SDL_MinimizeWindow(SDL_WindowID windowID); | |
759 | |
760 /** | |
761 * \fn void SDL_RestoreWindow(SDL_WindowID windowID) | |
762 * | |
763 * \brief Restore the size and position of a minimized or maximized window. | |
764 * | |
765 * \sa SDL_MaximizeWindow() | |
766 * \sa SDL_MinimizeWindow() | |
767 */ | |
768 extern DECLSPEC void SDLCALL SDL_RestoreWindow(SDL_WindowID windowID); | |
769 | |
770 /** | |
771 * \fn int SDL_SetWindowFullscreen(SDL_WindowID windowID, int fullscreen) | |
772 * | |
773 * \brief Set the window's fullscreen state. | |
774 * | |
775 * \return 0 on success, or -1 if setting the display mode failed. | |
776 * | |
777 * \sa SDL_SetFullscreenDisplayMode() | |
778 */ | |
779 extern DECLSPEC int SDLCALL SDL_SetWindowFullscreen(SDL_WindowID windowID, | |
780 int fullscreen); | |
781 | |
782 /** | |
783 * \fn void SDL_SetWindowGrab(SDL_WindowID windowID, int mode) | |
784 * | |
785 * \brief Set the window's input grab mode. | |
786 * | |
787 * \param mode This is 1 to grab input, and 0 to release input. | |
788 * | |
789 * \sa SDL_GetWindowGrab() | |
790 */ | |
791 extern DECLSPEC void SDLCALL SDL_SetWindowGrab(SDL_WindowID windowID, | |
792 int mode); | |
793 | |
794 /** | |
795 * \fn int SDL_GetWindowGrab(SDL_WindowID windowID) | |
796 * | |
797 * \brief Get the window's input grab mode. | |
798 * | |
799 * \return This returns 1 if input is grabbed, and 0 otherwise. | |
800 * | |
801 * \sa SDL_SetWindowGrab() | |
802 */ | |
803 extern DECLSPEC int SDLCALL SDL_GetWindowGrab(SDL_WindowID windowID); | |
804 | |
805 /** | |
806 * \fn SDL_bool SDL_GetWindowWMInfo(SDL_WindowID windowID, struct SDL_SysWMinfo * info) | |
807 * | |
808 * \brief Get driver specific information about a window. | |
809 * | |
810 * \note Include SDL_syswm.h for the declaration of SDL_SysWMinfo. | |
811 */ | |
812 struct SDL_SysWMinfo; | |
813 extern DECLSPEC SDL_bool SDLCALL SDL_GetWindowWMInfo(SDL_WindowID windowID, | |
814 struct SDL_SysWMinfo | |
815 *info); | |
816 | |
817 /** | |
818 * \fn void SDL_DestroyWindow(SDL_WindowID windowID) | |
819 * | |
820 * \brief Destroy a window. | |
821 */ | |
822 extern DECLSPEC void SDLCALL SDL_DestroyWindow(SDL_WindowID windowID); | |
823 | |
824 /** | |
825 * \fn int SDL_GetNumRenderers(void) | |
826 * | |
827 * \brief Get the number of render managers on the current display. | |
828 * | |
829 * A render manager is a set of code that handles rendering and texture | |
830 * management on a particular display. Normally there is only one, but | |
831 * some drivers may have several available with different capabilities. | |
832 * | |
833 * \sa SDL_GetRendererInfo() | |
834 * \sa SDL_CreateRenderer() | |
835 */ | |
836 extern DECLSPEC int SDLCALL SDL_GetNumRenderers(void); | |
837 | |
838 /** | |
839 * \fn SDL_RendererInfo *SDL_GetRendererInfo(int index) | |
840 * | |
841 * \brief Get information about a specific render manager on the current | |
842 * display. | |
843 * | |
844 * \sa SDL_CreateRenderer() | |
845 */ | |
846 extern DECLSPEC int SDLCALL SDL_GetRendererInfo(int index, | |
847 SDL_RendererInfo * info); | |
848 | |
849 /** | |
850 * \fn int SDL_CreateRenderer(SDL_WindowID window, int index, Uint32 flags) | |
851 * | |
852 * \brief Create and make active a 2D rendering context for a window. | |
853 * | |
854 * \param windowID The window used for rendering | |
855 * \param index The index of the render manager to initialize, or -1 to initialize the first one supporting the requested flags. | |
856 * \param flags SDL_RendererFlags | |
857 * | |
858 * \return 0 on success, -1 if the flags were not supported, or -2 if | |
859 * there isn't enough memory to support the requested flags | |
860 * | |
861 * \sa SDL_SelectRenderer() | |
862 * \sa SDL_DestroyRenderer() | |
863 */ | |
864 extern DECLSPEC int SDLCALL SDL_CreateRenderer(SDL_WindowID windowID, | |
865 int index, Uint32 flags); | |
866 | |
867 /** | |
868 * \fn int SDL_SelectRenderer(SDL_WindowID windowID) | |
869 * | |
870 * \brief Select the rendering context for a particular window. | |
871 * | |
872 * \return 0 on success, -1 if the selected window doesn't have a | |
873 * rendering context. | |
874 */ | |
875 extern DECLSPEC int SDLCALL SDL_SelectRenderer(SDL_WindowID windowID); | |
876 | |
877 /** | |
878 * \fn SDL_TextureID SDL_CreateTexture(Uint32 format, int access, int w, int h) | |
879 * | |
880 * \brief Create a texture for the current rendering context. | |
881 * | |
882 * \param format The format of the texture | |
883 * \param access One of the enumerated values in SDL_TextureAccess | |
884 * \param w The width of the texture in pixels | |
885 * \param h The height of the texture in pixels | |
886 * | |
887 * \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. | |
888 * | |
889 * \sa SDL_QueryTexture() | |
890 * \sa SDL_DestroyTexture() | |
891 */ | |
892 extern DECLSPEC SDL_TextureID SDLCALL SDL_CreateTexture(Uint32 format, | |
893 int access, int w, | |
894 int h); | |
895 | |
896 /** | |
897 * \fn SDL_TextureID SDL_CreateTextureFromSurface(Uint32 format, int access, SDL_Surface *surface) | |
898 * | |
899 * \brief Create a texture from an existing surface. | |
900 * | |
901 * \param format The format of the texture, or 0 to pick an appropriate format | |
902 * \param access One of the enumerated values in SDL_TextureAccess | |
903 * \param surface The surface containing pixel data used to fill the texture | |
904 * | |
905 * \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. | |
906 * | |
907 * \note The surface is not modified or freed by this function. | |
908 * | |
909 * \sa SDL_QueryTexture() | |
910 * \sa SDL_DestroyTexture() | |
911 */ | |
912 extern DECLSPEC SDL_TextureID SDLCALL SDL_CreateTextureFromSurface(Uint32 | |
913 format, | |
914 int access, | |
915 SDL_Surface | |
916 * surface); | |
917 | |
918 /** | |
919 * \fn int SDL_QueryTexture(SDL_TextureID textureID, Uint32 *format, int *access, int *w, int *h) | |
920 * | |
921 * \brief Query the attributes of a texture | |
922 * | |
923 * \param texture A texture to be queried | |
924 * \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. | |
925 * \param access A pointer filled in with the actual access to the texture. | |
926 * \param w A pointer filled in with the width of the texture in pixels | |
927 * \param h A pointer filled in with the height of the texture in pixels | |
928 * | |
929 * \return 0 on success, or -1 if the texture is not valid | |
930 */ | |
931 extern DECLSPEC int SDLCALL SDL_QueryTexture(SDL_TextureID textureID, | |
932 Uint32 * format, int *access, | |
933 int *w, int *h); | |
934 | |
935 /** | |
936 * \fn int SDL_QueryTexturePixels(SDL_TextureID textureID, void **pixels, int pitch) | |
937 * | |
938 * \brief Query the pixels of a texture, if the texture does not need to be locked for pixel access. | |
939 * | |
940 * \param texture A texture to be queried, which was created with SDL_TextureAccess_Local | |
941 * \param pixels A pointer filled with a pointer to the pixels for the texture | |
942 * \param pitch A pointer filled in with the pitch of the pixel data | |
943 * | |
944 * \return 0 on success, or -1 if the texture is not valid, or must be locked for pixel access. | |
945 */ | |
946 extern DECLSPEC int SDLCALL SDL_QueryTexturePixels(SDL_TextureID textureID, | |
947 void **pixels, int *pitch); | |
948 | |
949 /** | |
950 * \fn int SDL_SetTexturePalette(SDL_TextureID textureID, const SDL_Color * colors, int firstcolor, int ncolors) | |
951 * | |
952 * \brief Update an indexed texture with a color palette | |
953 * | |
954 * \param texture The texture to update | |
955 * \param colors The array of RGB color data | |
956 * \param firstcolor The first index to update | |
957 * \param ncolors The number of palette entries to fill with the color data | |
958 * | |
959 * \return 0 on success, or -1 if the texture is not valid or not an indexed texture | |
960 */ | |
961 extern DECLSPEC int SDLCALL SDL_SetTexturePalette(SDL_TextureID textureID, | |
962 const SDL_Color * colors, | |
963 int firstcolor, | |
964 int ncolors); | |
965 | |
966 /** | |
967 * \fn int SDL_GetTexturePalette(SDL_TextureID textureID, SDL_Color * colors, int firstcolor, int ncolors) | |
968 * | |
969 * \brief Update an indexed texture with a color palette | |
970 * | |
971 * \param texture The texture to update | |
972 * \param colors The array to fill with RGB color data | |
973 * \param firstcolor The first index to retrieve | |
974 * \param ncolors The number of palette entries to retrieve | |
975 * | |
976 * \return 0 on success, or -1 if the texture is not valid or not an indexed texture | |
977 */ | |
978 extern DECLSPEC int SDLCALL SDL_GetTexturePalette(SDL_TextureID textureID, | |
979 SDL_Color * colors, | |
980 int firstcolor, | |
981 int ncolors); | |
982 | |
983 /** | |
984 * \fn int SDL_UpdateTexture(SDL_TextureID textureID, const SDL_Rect *rect, const void *pixels, int pitch) | |
985 * | |
986 * \brief Update the given texture rectangle with new pixel data. | |
987 * | |
988 * \param texture The texture to update | |
989 * \param rect A pointer to the rectangle of pixels to update, or NULL to update the entire texture. | |
990 * \param pixels The raw pixel data | |
991 * \param pitch The number of bytes between rows of pixel data | |
992 * | |
993 * \return 0 on success, or -1 if the texture is not valid | |
994 * | |
995 * \note This is a very slow function for textures not created with SDL_TextureAccess_Local. | |
996 */ | |
997 extern DECLSPEC int SDLCALL SDL_UpdateTexture(SDL_TextureID textureID, | |
998 const SDL_Rect * rect, | |
999 const void *pixels, int pitch); | |
1000 | |
1001 /** | |
1002 * \fn void SDL_LockTexture(SDL_TextureID textureID, const SDL_Rect *rect, int markDirty, void **pixels, int *pitch) | |
1003 * | |
1004 * \brief Lock a portion of the texture for pixel access. | |
1005 * | |
1006 * \param texture The texture to lock for access, which must have been created with SDL_TextureAccess_Local. | |
1007 * \param rect A pointer to the rectangle to lock for access. If the rect is NULL, the entire texture will be locked. | |
1008 * \param markDirty If this is nonzero, the locked area will be marked dirty when the texture is unlocked. | |
1009 * \param pixels This is filled in with a pointer to the locked pixels, appropriately offset by the locked area. | |
1010 * \param pitch This is filled in with the pitch of the locked pixels. | |
1011 * | |
1012 * \return 0 on success, or -1 if the texture is not valid or was created with SDL_TextureAccess_Remote | |
1013 * | |
1014 * \sa SDL_DirtyTexture() | |
1015 * \sa SDL_UnlockTexture() | |
1016 */ | |
1017 extern DECLSPEC int SDLCALL SDL_LockTexture(SDL_TextureID textureID, | |
1018 const SDL_Rect * rect, | |
1019 int markDirty, void **pixels, | |
1020 int *pitch); | |
1021 | |
1022 /** | |
1023 * \fn void SDL_UnlockTexture(SDL_TextureID textureID) | |
1024 * | |
1025 * \brief Unlock a texture, uploading the changes to video memory, if needed. | |
1026 * | |
1027 * \sa SDL_LockTexture() | |
1028 * \sa SDL_DirtyTexture() | |
1029 */ | |
1030 extern DECLSPEC void SDLCALL SDL_UnlockTexture(SDL_TextureID textureID); | |
1031 | |
1032 /** | |
1033 * \fn void SDL_DirtyTexture(SDL_TextureID textureID, int numrects, const SDL_Rect * rects) | |
1034 * | |
1035 * \brief Mark the specified rectangles of the texture as dirty. | |
1036 * | |
1037 * \note The texture must have been created with SDL_TextureAccess_Local. | |
1038 * | |
1039 * \sa SDL_LockTexture() | |
1040 * \sa SDL_UnlockTexture() | |
1041 */ | |
1042 extern DECLSPEC void SDLCALL SDL_DirtyTexture(SDL_TextureID textureID, | |
1043 int numrects, | |
1044 const SDL_Rect * rects); | |
1045 | |
1046 /** | |
1047 * \fn void SDL_SelectRenderTexture(SDL_TextureID textureID) | |
1048 * | |
1049 * \brief Select a texture as the rendering target, or 0 to reselect the current window. | |
1050 * | |
1051 * \note The texture must have been created with SDL_TextureAccess_Render. | |
1052 */ | |
1053 extern DECLSPEC void SDLCALL SDL_SelectRenderTexture(SDL_TextureID textureID); | |
1054 | |
1055 /** | |
1056 * \fn void SDL_RenderFill(const SDL_Rect *rect, Uint32 color) | |
1057 * | |
1058 * \brief Fill the current rendering target with the specified color. | |
1059 * | |
1060 * \param rect A pointer to the destination rectangle, or NULL for the entire rendering target. | |
1061 * \param color An ARGB color value. | |
1062 * | |
1063 * \return 0 on success, or -1 if there is no renderer current | |
1064 */ | |
1065 extern DECLSPEC int SDLCALL SDL_RenderFill(const SDL_Rect * rect, | |
1066 Uint32 color); | |
1067 | |
1068 /** | |
1069 * \fn int SDL_RenderCopy(SDL_TextureID textureID, const SDL_Rect *srcrect, const SDL_Rect *dstrect, Uint32 blendMode, Uint32 scaleMode) | |
1070 * | |
1071 * \brief Copy a portion of the texture to the current rendering target. | |
1072 * | |
1073 * \param texture The source texture. | |
1074 * \param srcrect A pointer to the source rectangle, or NULL for the entire texture. | |
1075 * \param dstrect A pointer to the destination rectangle, or NULL for the entire rendering target. | |
1076 * \param blendMode SDL_TextureBlendMode to be used if the source texture has an alpha channel. | |
1077 * \param scaleMode SDL_TextureScaleMode to be used if the source and destination rectangles don't have the same width and height. | |
1078 * | |
1079 * \return 0 on success, or -1 if there is no renderer current, or the driver doesn't support the requested operation. | |
1080 * | |
1081 * \note You can check the video driver info to see what operations are supported. | |
1082 */ | |
1083 extern DECLSPEC int SDLCALL SDL_RenderCopy(SDL_TextureID textureID, | |
1084 const SDL_Rect * srcrect, | |
1085 const SDL_Rect * dstrect, | |
1086 int blendMode, int scaleMode); | |
1087 | |
1088 /** | |
1089 * \fn int SDL_RenderReadPixels(const SDL_Rect *rect, void *pixels, int pitch) | |
1090 * | |
1091 * \brief Read pixels from the current rendering target. | |
1092 * | |
1093 * \param rect A pointer to the rectangle to read, or NULL for the entire render target | |
1094 * \param pixels A pointer to be filled in with the pixel data | |
1095 * \param pitch The pitch of the pixels parameter | |
1096 * | |
1097 * \return 0 on success, or -1 if pixel reading is not supported. | |
1098 * | |
1099 * \warning This is a very slow operation, and should not be used frequently. | |
1100 */ | |
1101 extern DECLSPEC int SDLCALL SDL_RenderReadPixels(const SDL_Rect * rect, | |
1102 void *pixels, int pitch); | |
1103 | |
1104 /** | |
1105 * \fn int SDL_RenderWritePixels(const SDL_Rect *rect, const void *pixels, int pitch) | |
1106 * | |
1107 * \brief Write pixels to the current rendering target. | |
1108 * | |
1109 * \param rect A pointer to the rectangle to write, or NULL for the entire render target | |
1110 * \param pixels A pointer to the pixel data to write | |
1111 * \param pitch The pitch of the pixels parameter | |
1112 * | |
1113 * \return 0 on success, or -1 if pixel writing is not supported. | |
1114 * | |
1115 * \warning This is a very slow operation, and should not be used frequently. | |
1116 */ | |
1117 extern DECLSPEC int SDLCALL SDL_RenderWritePixels(const SDL_Rect * rect, | |
1118 const void *pixels, | |
1119 int pitch); | |
1120 | |
1121 /** | |
1122 * \fn void SDL_RenderPresent(void) | |
1123 * | |
1124 * \brief Update the screen with rendering performed. | |
1125 */ | |
1126 extern DECLSPEC void SDLCALL SDL_RenderPresent(void); | |
1127 | |
1128 /** | |
1129 * \fn void SDL_DestroyTexture(SDL_TextureID textureID); | |
1130 * | |
1131 * \brief Destroy the specified texture. | |
1132 * | |
1133 * \sa SDL_CreateTexture() | |
1134 * \sa SDL_CreateTextureFromSurface() | |
1135 */ | |
1136 extern DECLSPEC void SDLCALL SDL_DestroyTexture(SDL_TextureID textureID); | |
1137 | |
1138 /** | |
1139 * \fn void SDL_DestroyRenderer(SDL_WindowID windowID); | |
1140 * | |
1141 * \brief Destroy the rendering context for a window and free associated | |
1142 * textures. | |
1143 * | |
1144 * \sa SDL_CreateRenderer() | |
1145 */ | |
1146 extern DECLSPEC void SDLCALL SDL_DestroyRenderer(SDL_WindowID windowID); | |
445 | 1147 |
446 /* | 1148 /* |
447 * Maps an RGB triple to an opaque pixel value for a given pixel format | 1149 * Maps an RGB triple to an opaque pixel value for a given pixel format |
448 */ | 1150 */ |
449 extern DECLSPEC Uint32 SDLCALL SDL_MapRGB | 1151 extern DECLSPEC Uint32 SDLCALL SDL_MapRGB |
450 (SDL_PixelFormat *format, Uint8 r, Uint8 g, Uint8 b); | 1152 (SDL_PixelFormat * format, Uint8 r, Uint8 g, Uint8 b); |
451 | 1153 |
452 /* | 1154 /* |
453 * Maps an RGBA quadruple to a pixel value for a given pixel format | 1155 * Maps an RGBA quadruple to a pixel value for a given pixel format |
454 */ | 1156 */ |
455 extern DECLSPEC Uint32 SDLCALL SDL_MapRGBA(SDL_PixelFormat *format, | 1157 extern DECLSPEC Uint32 SDLCALL SDL_MapRGBA(SDL_PixelFormat * format, |
456 Uint8 r, Uint8 g, Uint8 b, Uint8 a); | 1158 Uint8 r, Uint8 g, Uint8 b, |
1159 Uint8 a); | |
457 | 1160 |
458 /* | 1161 /* |
459 * Maps a pixel value into the RGB components for a given pixel format | 1162 * Maps a pixel value into the RGB components for a given pixel format |
460 */ | 1163 */ |
461 extern DECLSPEC void SDLCALL SDL_GetRGB(Uint32 pixel, SDL_PixelFormat *fmt, | 1164 extern DECLSPEC void SDLCALL SDL_GetRGB(Uint32 pixel, SDL_PixelFormat * fmt, |
462 Uint8 *r, Uint8 *g, Uint8 *b); | 1165 Uint8 * r, Uint8 * g, Uint8 * b); |
463 | 1166 |
464 /* | 1167 /* |
465 * Maps a pixel value into the RGBA components for a given pixel format | 1168 * Maps a pixel value into the RGBA components for a given pixel format |
466 */ | 1169 */ |
467 extern DECLSPEC void SDLCALL SDL_GetRGBA(Uint32 pixel, SDL_PixelFormat *fmt, | 1170 extern DECLSPEC void SDLCALL SDL_GetRGBA(Uint32 pixel, SDL_PixelFormat * fmt, |
468 Uint8 *r, Uint8 *g, Uint8 *b, Uint8 *a); | 1171 Uint8 * r, Uint8 * g, Uint8 * b, |
1172 Uint8 * a); | |
469 | 1173 |
470 /* | 1174 /* |
471 * Allocate and free an RGB surface (must be called after SDL_SetVideoMode) | 1175 * Allocate and free an RGB surface (must be called after SDL_SetVideoMode) |
472 * If the depth is 4 or 8 bits, an empty palette is allocated for the surface. | 1176 * If the depth is 4 or 8 bits, an empty palette is allocated for the surface. |
473 * If the depth is greater than 8 bits, the pixel format is set using the | 1177 * If the depth is greater than 8 bits, the pixel format is set using the |
474 * flags '[RGB]mask'. | 1178 * flags '[RGB]mask'. |
475 * If the function runs out of memory, it will return NULL. | 1179 * If the function runs out of memory, it will return NULL. |
476 * | 1180 * |
477 * The 'flags' tell what kind of surface to create. | 1181 * The 'flags' tell what kind of surface to create. |
478 * SDL_SWSURFACE means that the surface should be created in system memory. | |
479 * SDL_HWSURFACE means that the surface should be created in video memory, | |
480 * with the same format as the display surface. This is useful for surfaces | |
481 * that will not change much, to take advantage of hardware acceleration | |
482 * when being blitted to the display surface. | |
483 * SDL_ASYNCBLIT means that SDL will try to perform asynchronous blits with | |
484 * this surface, but you must always lock it before accessing the pixels. | |
485 * SDL will wait for current blits to finish before returning from the lock. | |
486 * SDL_SRCCOLORKEY indicates that the surface will be used for colorkey blits. | 1182 * SDL_SRCCOLORKEY indicates that the surface will be used for colorkey blits. |
487 * If the hardware supports acceleration of colorkey blits between | 1183 * SDL_SRCALPHA means that the surface will be used for alpha blits. |
488 * two surfaces in video memory, SDL will try to place the surface in | 1184 */ |
489 * video memory. If this isn't possible or if there is no hardware | 1185 extern DECLSPEC SDL_Surface *SDLCALL SDL_CreateRGBSurface |
490 * acceleration available, the surface will be placed in system memory. | 1186 (Uint32 flags, int width, int height, int depth, |
491 * SDL_SRCALPHA means that the surface will be used for alpha blits and | 1187 Uint32 Rmask, Uint32 Gmask, Uint32 Bmask, Uint32 Amask); |
492 * if the hardware supports hardware acceleration of alpha blits between | 1188 extern DECLSPEC SDL_Surface *SDLCALL SDL_CreateRGBSurfaceFrom(void *pixels, |
493 * two surfaces in video memory, to place the surface in video memory | 1189 int width, |
494 * if possible, otherwise it will be placed in system memory. | 1190 int height, |
495 * If the surface is created in video memory, blits will be _much_ faster, | 1191 int depth, |
496 * but the surface format must be identical to the video surface format, | 1192 int pitch, |
497 * and the only way to access the pixels member of the surface is to use | 1193 Uint32 Rmask, |
498 * the SDL_LockSurface() and SDL_UnlockSurface() calls. | 1194 Uint32 Gmask, |
499 * If the requested surface actually resides in video memory, SDL_HWSURFACE | 1195 Uint32 Bmask, |
500 * will be set in the flags member of the returned surface. If for some | 1196 Uint32 Amask); |
501 * reason the surface could not be placed in video memory, it will not have | 1197 extern DECLSPEC SDL_Surface *SDLCALL |
502 * the SDL_HWSURFACE flag set, and will be created in system memory instead. | 1198 SDL_CreateRGBSurfaceFromTexture(SDL_TextureID textureID); |
503 */ | 1199 extern DECLSPEC void SDLCALL SDL_FreeSurface(SDL_Surface * surface); |
504 #define SDL_AllocSurface SDL_CreateRGBSurface | 1200 |
505 extern DECLSPEC SDL_Surface * SDLCALL SDL_CreateRGBSurface | 1201 /** |
506 (Uint32 flags, int width, int height, int depth, | 1202 * \fn int SDL_SetSurfacePalette(SDL_Surface *surface, SDL_Palette *palette) |
507 Uint32 Rmask, Uint32 Gmask, Uint32 Bmask, Uint32 Amask); | 1203 * |
508 extern DECLSPEC SDL_Surface * SDLCALL SDL_CreateRGBSurfaceFrom(void *pixels, | 1204 * \brief Set the palette used by a surface. |
509 int width, int height, int depth, int pitch, | 1205 * |
510 Uint32 Rmask, Uint32 Gmask, Uint32 Bmask, Uint32 Amask); | 1206 * \return 0, or -1 if the surface format doesn't use a palette. |
511 extern DECLSPEC void SDLCALL SDL_FreeSurface(SDL_Surface *surface); | 1207 * |
1208 * \note A single palette can be shared with many surfaces. | |
1209 */ | |
1210 extern DECLSPEC int SDLCALL SDL_SetSurfacePalette(SDL_Surface * surface, | |
1211 SDL_Palette * palette); | |
512 | 1212 |
513 /* | 1213 /* |
514 * SDL_LockSurface() sets up a surface for directly accessing the pixels. | 1214 * SDL_LockSurface() sets up a surface for directly accessing the pixels. |
515 * Between calls to SDL_LockSurface()/SDL_UnlockSurface(), you can write | 1215 * Between calls to SDL_LockSurface()/SDL_UnlockSurface(), you can write |
516 * to and read from 'surface->pixels', using the pixel format stored in | 1216 * to and read from 'surface->pixels', using the pixel format stored in |
517 * 'surface->format'. Once you are done accessing the surface, you should | 1217 * 'surface->format'. Once you are done accessing the surface, you should |
518 * use SDL_UnlockSurface() to release it. | 1218 * use SDL_UnlockSurface() to release it. |
519 * | 1219 * |
520 * Not all surfaces require locking. If SDL_MUSTLOCK(surface) evaluates | 1220 * Not all surfaces require locking. If SDL_MUSTLOCK(surface) evaluates |
521 * to 0, then you can read and write to the surface at any time, and the | 1221 * to 0, then you can read and write to the surface at any time, and the |
522 * pixel format of the surface will not change. In particular, if the | 1222 * pixel format of the surface will not change. |
523 * SDL_HWSURFACE flag is not given when calling SDL_SetVideoMode(), you | |
524 * will not need to lock the display surface before accessing it. | |
525 * | 1223 * |
526 * No operating system or library calls should be made between lock/unlock | 1224 * No operating system or library calls should be made between lock/unlock |
527 * pairs, as critical system locks may be held during this time. | 1225 * pairs, as critical system locks may be held during this time. |
528 * | 1226 * |
529 * SDL_LockSurface() returns 0, or -1 if the surface couldn't be locked. | 1227 * SDL_LockSurface() returns 0, or -1 if the surface couldn't be locked. |
530 */ | 1228 */ |
531 extern DECLSPEC int SDLCALL SDL_LockSurface(SDL_Surface *surface); | 1229 extern DECLSPEC int SDLCALL SDL_LockSurface(SDL_Surface * surface); |
532 extern DECLSPEC void SDLCALL SDL_UnlockSurface(SDL_Surface *surface); | 1230 extern DECLSPEC void SDLCALL SDL_UnlockSurface(SDL_Surface * surface); |
533 | 1231 |
534 /* | 1232 /* |
535 * Load a surface from a seekable SDL data source (memory or file.) | 1233 * Load a surface from a seekable SDL data source (memory or file.) |
536 * If 'freesrc' is non-zero, the source will be closed after being read. | 1234 * If 'freesrc' is non-zero, the source will be closed after being read. |
537 * Returns the new surface, or NULL if there was an error. | 1235 * Returns the new surface, or NULL if there was an error. |
538 * The new surface should be freed with SDL_FreeSurface(). | 1236 * The new surface should be freed with SDL_FreeSurface(). |
539 */ | 1237 */ |
540 extern DECLSPEC SDL_Surface * SDLCALL SDL_LoadBMP_RW(SDL_RWops *src, int freesrc); | 1238 extern DECLSPEC SDL_Surface *SDLCALL SDL_LoadBMP_RW(SDL_RWops * src, |
1239 int freesrc); | |
541 | 1240 |
542 /* Convenience macro -- load a surface from a file */ | 1241 /* Convenience macro -- load a surface from a file */ |
543 #define SDL_LoadBMP(file) SDL_LoadBMP_RW(SDL_RWFromFile(file, "rb"), 1) | 1242 #define SDL_LoadBMP(file) SDL_LoadBMP_RW(SDL_RWFromFile(file, "rb"), 1) |
544 | 1243 |
545 /* | 1244 /* |
546 * Save a surface to a seekable SDL data source (memory or file.) | 1245 * Save a surface to a seekable SDL data source (memory or file.) |
547 * If 'freedst' is non-zero, the source will be closed after being written. | 1246 * If 'freedst' is non-zero, the source will be closed after being written. |
548 * Returns 0 if successful or -1 if there was an error. | 1247 * Returns 0 if successful or -1 if there was an error. |
549 */ | 1248 */ |
550 extern DECLSPEC int SDLCALL SDL_SaveBMP_RW | 1249 extern DECLSPEC int SDLCALL SDL_SaveBMP_RW |
551 (SDL_Surface *surface, SDL_RWops *dst, int freedst); | 1250 (SDL_Surface * surface, SDL_RWops * dst, int freedst); |
552 | 1251 |
553 /* Convenience macro -- save a surface to a file */ | 1252 /* Convenience macro -- save a surface to a file */ |
554 #define SDL_SaveBMP(surface, file) \ | 1253 #define SDL_SaveBMP(surface, file) \ |
555 SDL_SaveBMP_RW(surface, SDL_RWFromFile(file, "wb"), 1) | 1254 SDL_SaveBMP_RW(surface, SDL_RWFromFile(file, "wb"), 1) |
556 | 1255 |
562 * and removes RLE acceleration if absent. | 1261 * and removes RLE acceleration if absent. |
563 * If 'flag' is 0, this function clears any current color key. | 1262 * If 'flag' is 0, this function clears any current color key. |
564 * This function returns 0, or -1 if there was an error. | 1263 * This function returns 0, or -1 if there was an error. |
565 */ | 1264 */ |
566 extern DECLSPEC int SDLCALL SDL_SetColorKey | 1265 extern DECLSPEC int SDLCALL SDL_SetColorKey |
567 (SDL_Surface *surface, Uint32 flag, Uint32 key); | 1266 (SDL_Surface * surface, Uint32 flag, Uint32 key); |
568 | 1267 |
569 /* | 1268 /* |
570 * This function sets the alpha value for the entire surface, as opposed to | 1269 * This function sets the alpha value for the entire surface, as opposed to |
571 * using the alpha component of each pixel. This value measures the range | 1270 * using the alpha component of each pixel. This value measures the range |
572 * of transparency of the surface, 0 being completely transparent to 255 | 1271 * of transparency of the surface, 0 being completely transparent to 255 |
579 * OR:ing the flag with SDL_RLEACCEL requests RLE acceleration for the | 1278 * OR:ing the flag with SDL_RLEACCEL requests RLE acceleration for the |
580 * surface; if SDL_RLEACCEL is not specified, the RLE accel will be removed. | 1279 * surface; if SDL_RLEACCEL is not specified, the RLE accel will be removed. |
581 * | 1280 * |
582 * The 'alpha' parameter is ignored for surfaces that have an alpha channel. | 1281 * The 'alpha' parameter is ignored for surfaces that have an alpha channel. |
583 */ | 1282 */ |
584 extern DECLSPEC int SDLCALL SDL_SetAlpha(SDL_Surface *surface, Uint32 flag, Uint8 alpha); | 1283 extern DECLSPEC int SDLCALL SDL_SetAlpha(SDL_Surface * surface, Uint32 flag, |
1284 Uint8 alpha); | |
585 | 1285 |
586 /* | 1286 /* |
587 * Sets the clipping rectangle for the destination surface in a blit. | 1287 * Sets the clipping rectangle for the destination surface in a blit. |
588 * | 1288 * |
589 * If the clip rectangle is NULL, clipping will be disabled. | 1289 * If the clip rectangle is NULL, clipping will be disabled. |
593 * the intersection of the surface area and the clipping rectangle. | 1293 * the intersection of the surface area and the clipping rectangle. |
594 * | 1294 * |
595 * Note that blits are automatically clipped to the edges of the source | 1295 * Note that blits are automatically clipped to the edges of the source |
596 * and destination surfaces. | 1296 * and destination surfaces. |
597 */ | 1297 */ |
598 extern DECLSPEC SDL_bool SDLCALL SDL_SetClipRect(SDL_Surface *surface, const SDL_Rect *rect); | 1298 extern DECLSPEC SDL_bool SDLCALL SDL_SetClipRect(SDL_Surface * surface, |
1299 const SDL_Rect * rect); | |
599 | 1300 |
600 /* | 1301 /* |
601 * Gets the clipping rectangle for the destination surface in a blit. | 1302 * Gets the clipping rectangle for the destination surface in a blit. |
602 * 'rect' must be a pointer to a valid rectangle which will be filled | 1303 * 'rect' must be a pointer to a valid rectangle which will be filled |
603 * with the correct values. | 1304 * with the correct values. |
604 */ | 1305 */ |
605 extern DECLSPEC void SDLCALL SDL_GetClipRect(SDL_Surface *surface, SDL_Rect *rect); | 1306 extern DECLSPEC void SDLCALL SDL_GetClipRect(SDL_Surface * surface, |
1307 SDL_Rect * rect); | |
606 | 1308 |
607 /* | 1309 /* |
608 * Creates a new surface of the specified format, and then copies and maps | 1310 * Creates a new surface of the specified format, and then copies and maps |
609 * the given surface to it so the blit of the converted surface will be as | 1311 * the given surface to it so the blit of the converted surface will be as |
610 * fast as possible. If this function fails, it returns NULL. | 1312 * fast as possible. If this function fails, it returns NULL. |
614 * SDL will try to RLE accelerate colorkey and alpha blits in the resulting | 1316 * SDL will try to RLE accelerate colorkey and alpha blits in the resulting |
615 * surface. | 1317 * surface. |
616 * | 1318 * |
617 * This function is used internally by SDL_DisplayFormat(). | 1319 * This function is used internally by SDL_DisplayFormat(). |
618 */ | 1320 */ |
619 extern DECLSPEC SDL_Surface * SDLCALL SDL_ConvertSurface | 1321 extern DECLSPEC SDL_Surface *SDLCALL SDL_ConvertSurface |
620 (SDL_Surface *src, SDL_PixelFormat *fmt, Uint32 flags); | 1322 (SDL_Surface * src, SDL_PixelFormat * fmt, Uint32 flags); |
1323 | |
1324 /* | |
1325 * This function performs a fast fill of the given rectangle with 'color' | |
1326 * The given rectangle is clipped to the destination surface clip area | |
1327 * and the final fill rectangle is saved in the passed in pointer. | |
1328 * If 'dstrect' is NULL, the whole surface will be filled with 'color' | |
1329 * The color should be a pixel of the format used by the surface, and | |
1330 * can be generated by the SDL_MapRGB() function. | |
1331 * This function returns 0 on success, or -1 on error. | |
1332 */ | |
1333 extern DECLSPEC int SDLCALL SDL_FillRect | |
1334 (SDL_Surface * dst, SDL_Rect * dstrect, Uint32 color); | |
621 | 1335 |
622 /* | 1336 /* |
623 * This performs a fast blit from the source surface to the destination | 1337 * This performs a fast blit from the source surface to the destination |
624 * surface. It assumes that the source and destination rectangles are | 1338 * surface. It assumes that the source and destination rectangles are |
625 * the same size. If either 'srcrect' or 'dstrect' are NULL, the entire | 1339 * the same size. If either 'srcrect' or 'dstrect' are NULL, the entire |
692 | 1406 |
693 /* This is the public blit function, SDL_BlitSurface(), and it performs | 1407 /* This is the public blit function, SDL_BlitSurface(), and it performs |
694 rectangle validation and clipping before passing it to SDL_LowerBlit() | 1408 rectangle validation and clipping before passing it to SDL_LowerBlit() |
695 */ | 1409 */ |
696 extern DECLSPEC int SDLCALL SDL_UpperBlit | 1410 extern DECLSPEC int SDLCALL SDL_UpperBlit |
697 (SDL_Surface *src, SDL_Rect *srcrect, | 1411 (SDL_Surface * src, SDL_Rect * srcrect, |
698 SDL_Surface *dst, SDL_Rect *dstrect); | 1412 SDL_Surface * dst, SDL_Rect * dstrect); |
699 /* This is a semi-private blit function and it performs low-level surface | 1413 /* This is a semi-private blit function and it performs low-level surface |
700 blitting only. | 1414 blitting only. |
701 */ | 1415 */ |
702 extern DECLSPEC int SDLCALL SDL_LowerBlit | 1416 extern DECLSPEC int SDLCALL SDL_LowerBlit |
703 (SDL_Surface *src, SDL_Rect *srcrect, | 1417 (SDL_Surface * src, SDL_Rect * srcrect, |
704 SDL_Surface *dst, SDL_Rect *dstrect); | 1418 SDL_Surface * dst, SDL_Rect * dstrect); |
705 | 1419 |
706 /* | 1420 /** |
707 * This function performs a fast fill of the given rectangle with 'color' | 1421 * \fn int SDL_SoftStretch(SDL_Surface * src, SDL_Rect * srcrect, SDL_Surface * dst, SDL_Rect * dstrect) |
708 * The given rectangle is clipped to the destination surface clip area | 1422 * |
709 * and the final fill rectangle is saved in the passed in pointer. | 1423 * \brief Perform a fast, low quality, stretch blit between two surfaces of the same pixel format. |
710 * If 'dstrect' is NULL, the whole surface will be filled with 'color' | 1424 * |
711 * The color should be a pixel of the format used by the surface, and | 1425 * \note This function uses a static buffer, and is not thread-safe. |
712 * can be generated by the SDL_MapRGB() function. | 1426 */ |
713 * This function returns 0 on success, or -1 on error. | 1427 extern DECLSPEC int SDLCALL SDL_SoftStretch(SDL_Surface * src, |
714 */ | 1428 SDL_Rect * srcrect, |
715 extern DECLSPEC int SDLCALL SDL_FillRect | 1429 SDL_Surface * dst, |
716 (SDL_Surface *dst, SDL_Rect *dstrect, Uint32 color); | 1430 SDL_Rect * dstrect); |
717 | |
718 /* | |
719 * This function takes a surface and copies it to a new surface of the | |
720 * pixel format and colors of the video framebuffer, suitable for fast | |
721 * blitting onto the display surface. It calls SDL_ConvertSurface() | |
722 * | |
723 * If you want to take advantage of hardware colorkey or alpha blit | |
724 * acceleration, you should set the colorkey and alpha value before | |
725 * calling this function. | |
726 * | |
727 * If the conversion fails or runs out of memory, it returns NULL | |
728 */ | |
729 extern DECLSPEC SDL_Surface * SDLCALL SDL_DisplayFormat(SDL_Surface *surface); | |
730 | |
731 /* | |
732 * This function takes a surface and copies it to a new surface of the | |
733 * pixel format and colors of the video framebuffer (if possible), | |
734 * suitable for fast alpha blitting onto the display surface. | |
735 * The new surface will always have an alpha channel. | |
736 * | |
737 * If you want to take advantage of hardware colorkey or alpha blit | |
738 * acceleration, you should set the colorkey and alpha value before | |
739 * calling this function. | |
740 * | |
741 * If the conversion fails or runs out of memory, it returns NULL | |
742 */ | |
743 extern DECLSPEC SDL_Surface * SDLCALL SDL_DisplayFormatAlpha(SDL_Surface *surface); | |
744 | |
745 | |
746 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ | |
747 /* YUV video surface overlay functions */ | |
748 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ | |
749 | |
750 /* This function creates a video output overlay | |
751 Calling the returned surface an overlay is something of a misnomer because | |
752 the contents of the display surface underneath the area where the overlay | |
753 is shown is undefined - it may be overwritten with the converted YUV data. | |
754 */ | |
755 extern DECLSPEC SDL_Overlay * SDLCALL SDL_CreateYUVOverlay(int width, int height, | |
756 Uint32 format, SDL_Surface *display); | |
757 | |
758 /* Lock an overlay for direct access, and unlock it when you are done */ | |
759 extern DECLSPEC int SDLCALL SDL_LockYUVOverlay(SDL_Overlay *overlay); | |
760 extern DECLSPEC void SDLCALL SDL_UnlockYUVOverlay(SDL_Overlay *overlay); | |
761 | |
762 /* Blit a video overlay to the display surface. | |
763 The contents of the video surface underneath the blit destination are | |
764 not defined. | |
765 The width and height of the destination rectangle may be different from | |
766 that of the overlay, but currently only 2x scaling is supported. | |
767 */ | |
768 extern DECLSPEC int SDLCALL SDL_DisplayYUVOverlay(SDL_Overlay *overlay, SDL_Rect *dstrect); | |
769 | |
770 /* Free a video overlay */ | |
771 extern DECLSPEC void SDLCALL SDL_FreeYUVOverlay(SDL_Overlay *overlay); | |
772 | |
773 | 1431 |
774 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ | 1432 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ |
775 /* OpenGL support functions. */ | 1433 /* OpenGL support functions. */ |
776 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ | 1434 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ |
777 | 1435 |
778 /* | 1436 /** |
779 * Dynamically load an OpenGL library, or the default one if path is NULL | 1437 * \fn int SDL_GL_LoadLibrary(const char *path) |
780 * | 1438 * |
781 * If you do this, you need to retrieve all of the GL functions used in | 1439 * \brief Dynamically load an OpenGL library. |
782 * your program from the dynamic library using SDL_GL_GetProcAddress(). | 1440 * |
1441 * \param path The platform dependent OpenGL library name, or NULL to open the default OpenGL library | |
1442 * | |
1443 * \return 0 on success, or -1 if the library couldn't be loaded | |
1444 * | |
1445 * \note If you do this, you need to retrieve all of the GL functions used in | |
1446 * your program from the dynamic library using SDL_GL_GetProcAddress(). | |
1447 * | |
1448 * \sa SDL_GL_GetProcAddress() | |
783 */ | 1449 */ |
784 extern DECLSPEC int SDLCALL SDL_GL_LoadLibrary(const char *path); | 1450 extern DECLSPEC int SDLCALL SDL_GL_LoadLibrary(const char *path); |
785 | 1451 |
786 /* | 1452 /** |
787 * Get the address of a GL function | 1453 * \fn void *SDL_GL_GetProcAddress(const char *proc) |
788 */ | 1454 * |
789 extern DECLSPEC void * SDLCALL SDL_GL_GetProcAddress(const char* proc); | 1455 * \brief Get the address of an OpenGL function. |
790 | 1456 */ |
791 /* | 1457 extern DECLSPEC void *SDLCALL SDL_GL_GetProcAddress(const char *proc); |
792 * Set an attribute of the OpenGL subsystem before intialization. | 1458 |
1459 /** | |
1460 * \fn int SDL_GL_SetAttribute(SDL_GLattr attr, int value) | |
1461 * | |
1462 * \brief Set an OpenGL window attribute before window creation. | |
793 */ | 1463 */ |
794 extern DECLSPEC int SDLCALL SDL_GL_SetAttribute(SDL_GLattr attr, int value); | 1464 extern DECLSPEC int SDLCALL SDL_GL_SetAttribute(SDL_GLattr attr, int value); |
795 | 1465 |
796 /* | 1466 /** |
797 * Get an attribute of the OpenGL subsystem from the windowing | 1467 * \fn int SDL_GL_GetWindowAttribute(SDL_WindowID windowID, SDL_GLattr attr, int *value) |
798 * interface, such as glX. This is of course different from getting | 1468 * |
799 * the values from SDL's internal OpenGL subsystem, which only | 1469 * \brief Get the actual value for an OpenGL window attribute. |
800 * stores the values you request before initialization. | 1470 */ |
801 * | 1471 extern DECLSPEC int SDLCALL SDL_GL_GetWindowAttribute(SDL_WindowID windowID, |
802 * Developers should track the values they pass into SDL_GL_SetAttribute | 1472 SDL_GLattr attr, |
803 * themselves if they want to retrieve these values. | 1473 int *value); |
804 */ | 1474 |
805 extern DECLSPEC int SDLCALL SDL_GL_GetAttribute(SDL_GLattr attr, int* value); | 1475 /** |
806 | 1476 * \fn SDL_GLContext SDL_GL_CreateContext(SDL_WindowID windowID) |
807 /* | 1477 * |
1478 * \brief Create an OpenGL context for use with an OpenGL window, and make it current. | |
1479 * | |
1480 * \sa SDL_GL_DeleteContext() | |
1481 */ | |
1482 extern DECLSPEC SDL_GLContext SDLCALL SDL_GL_CreateContext(SDL_WindowID | |
1483 windowID); | |
1484 | |
1485 /** | |
1486 * \fn int SDL_GL_MakeCurrent(SDL_WindowID windowID, SDL_GLContext context) | |
1487 * | |
1488 * \brief Set up an OpenGL context for rendering into an OpenGL window. | |
1489 * | |
1490 * \note The context must have been created with a compatible window. | |
1491 */ | |
1492 extern DECLSPEC int SDLCALL SDL_GL_MakeCurrent(SDL_WindowID windowID, | |
1493 SDL_GLContext context); | |
1494 | |
1495 /** | |
1496 * \fn int SDL_GL_SetSwapInterval(int interval) | |
1497 * | |
1498 * \brief Set the swap interval for the current OpenGL context. | |
1499 * | |
1500 * \sa SDL_GL_GetSwapInterval() | |
1501 */ | |
1502 extern DECLSPEC int SDLCALL SDL_GL_SetSwapInterval(int interval); | |
1503 | |
1504 /** | |
1505 * \fn int SDL_GL_GetSwapInterval(void) | |
1506 * | |
1507 * \brief Get the swap interval for the current OpenGL context. | |
1508 * | |
1509 * \sa SDL_GL_SetSwapInterval() | |
1510 */ | |
1511 extern DECLSPEC int SDLCALL SDL_GL_GetSwapInterval(void); | |
1512 | |
1513 /** | |
1514 * \fn void SDL_GL_SwapBuffers(void) | |
1515 * | |
808 * Swap the OpenGL buffers, if double-buffering is supported. | 1516 * Swap the OpenGL buffers, if double-buffering is supported. |
809 */ | 1517 */ |
810 extern DECLSPEC void SDLCALL SDL_GL_SwapBuffers(void); | 1518 extern DECLSPEC void SDLCALL SDL_GL_SwapBuffers(void); |
811 | 1519 |
812 /* | 1520 /** |
813 * Internal functions that should not be called unless you have read | 1521 * \fn void SDL_GL_DeleteContext(SDL_GLContext context) |
814 * and understood the source code for these functions. | 1522 * |
815 */ | 1523 * \brief Delete an OpenGL context. |
816 extern DECLSPEC void SDLCALL SDL_GL_UpdateRects(int numrects, SDL_Rect* rects); | 1524 * |
817 extern DECLSPEC void SDLCALL SDL_GL_Lock(void); | 1525 * \sa SDL_GL_CreateContext() |
818 extern DECLSPEC void SDLCALL SDL_GL_Unlock(void); | 1526 */ |
819 | 1527 extern DECLSPEC void SDLCALL SDL_GL_DeleteContext(SDL_GLContext context); |
820 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ | 1528 |
821 /* These functions allow interaction with the window manager, if any. */ | 1529 /** |
822 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ | 1530 * \def SDL_RectEmpty() |
823 | 1531 * |
824 /* | 1532 * \brief Returns true if the rectangle has no area. |
825 * Sets/Gets the title and icon text of the display window (UTF-8 encoded) | 1533 */ |
826 */ | 1534 #define SDL_RectEmpty(X) (((X)->w <= 0) || ((X)->h <= 0)) |
827 extern DECLSPEC void SDLCALL SDL_WM_SetCaption(const char *title, const char *icon); | 1535 |
828 extern DECLSPEC void SDLCALL SDL_WM_GetCaption(char **title, char **icon); | 1536 /** |
829 | 1537 * \def SDL_RectEquals() |
830 /* | 1538 * |
831 * Sets the icon for the display window. | 1539 * \brief Returns true if the two rectangles are equal. |
832 * This function must be called before the first call to SDL_SetVideoMode(). | 1540 */ |
833 * It takes an icon surface, and a mask in MSB format. | 1541 #define SDL_RectEquals(A, B) (((A)->x == (B)->x) && ((A)->y == (B)->y) && \ |
834 * If 'mask' is NULL, the entire icon surface will be used as the icon. | 1542 ((A)->w == (B)->w) && ((A)->h == (B)->h)) |
835 */ | 1543 |
836 extern DECLSPEC void SDLCALL SDL_WM_SetIcon(SDL_Surface *icon, Uint8 *mask); | 1544 /** |
837 | 1545 * \fn SDL_bool SDL_HasIntersection(const SDL_Rect * A, const SDL_Rect * B); |
838 /* | 1546 * |
839 * This function iconifies the window, and returns 1 if it succeeded. | 1547 * \brief Determine whether two rectangles intersect. |
840 * If the function succeeds, it generates an SDL_APPACTIVE loss event. | 1548 * |
841 * This function is a noop and returns 0 in non-windowed environments. | 1549 * \return SDL_TRUE if there is an intersection, SDL_FALSE otherwise. |
842 */ | 1550 */ |
843 extern DECLSPEC int SDLCALL SDL_WM_IconifyWindow(void); | 1551 extern DECLSPEC SDL_bool SDLCALL SDL_HasIntersection(const SDL_Rect * A, |
844 | 1552 const SDL_Rect * B); |
845 /* | 1553 |
846 * Toggle fullscreen mode without changing the contents of the screen. | 1554 /** |
847 * If the display surface does not require locking before accessing | 1555 * \fn SDL_bool SDL_IntersectRect(const SDL_Rect * A, const SDL_Rect * B, SDL_Rect * result) |
848 * the pixel information, then the memory pointers will not change. | 1556 * |
849 * | 1557 * \brief Calculate the intersection of two rectangles. |
850 * If this function was able to toggle fullscreen mode (change from | 1558 * |
851 * running in a window to fullscreen, or vice-versa), it will return 1. | 1559 * \return SDL_TRUE if there is an intersection, SDL_FALSE otherwise. |
852 * If it is not implemented, or fails, it returns 0. | 1560 */ |
853 * | 1561 extern DECLSPEC SDL_bool SDLCALL SDL_IntersectRect(const SDL_Rect * A, |
854 * The next call to SDL_SetVideoMode() will set the mode fullscreen | 1562 const SDL_Rect * B, |
855 * attribute based on the flags parameter - if SDL_FULLSCREEN is not | 1563 SDL_Rect * result); |
856 * set, then the display will be windowed by default where supported. | 1564 |
857 * | 1565 /** |
858 * This is currently only implemented in the X11 video driver. | 1566 * \fn void SDL_UnionRect(const SDL_Rect * A, const SDL_Rect * B, SDL_Rect * result) |
859 */ | 1567 * |
860 extern DECLSPEC int SDLCALL SDL_WM_ToggleFullScreen(SDL_Surface *surface); | 1568 * \brief Calculate the union of two rectangles |
861 | 1569 */ |
862 /* | 1570 extern DECLSPEC void SDLCALL SDL_UnionRect(const SDL_Rect * A, |
863 * This function allows you to set and query the input grab state of | 1571 const SDL_Rect * B, |
864 * the application. It returns the new input grab state. | 1572 SDL_Rect * result); |
865 */ | 1573 |
866 typedef enum { | |
867 SDL_GRAB_QUERY = -1, | |
868 SDL_GRAB_OFF = 0, | |
869 SDL_GRAB_ON = 1, | |
870 SDL_GRAB_FULLSCREEN /* Used internally */ | |
871 } SDL_GrabMode; | |
872 /* | |
873 * Grabbing means that the mouse is confined to the application window, | |
874 * and nearly all keyboard input is passed directly to the application, | |
875 * and not interpreted by a window manager, if any. | |
876 */ | |
877 extern DECLSPEC SDL_GrabMode SDLCALL SDL_WM_GrabInput(SDL_GrabMode mode); | |
878 | |
879 /* Not in public API at the moment - do not use! */ | |
880 extern DECLSPEC int SDLCALL SDL_SoftStretch(SDL_Surface *src, SDL_Rect *srcrect, | |
881 SDL_Surface *dst, SDL_Rect *dstrect); | |
882 | |
883 /* Ends C function definitions when using C++ */ | 1574 /* Ends C function definitions when using C++ */ |
884 #ifdef __cplusplus | 1575 #ifdef __cplusplus |
1576 /* *INDENT-OFF* */ | |
885 } | 1577 } |
1578 /* *INDENT-ON* */ | |
886 #endif | 1579 #endif |
887 #include "close_code.h" | 1580 #include "close_code.h" |
888 | 1581 |
889 #endif /* _SDL_video_h */ | 1582 #endif /* _SDL_video_h */ |
1583 | |
1584 /* vi: set ts=4 sw=4 expandtab: */ |