SDL Library
Embed:
(wiki syntax)
Show/hide line numbers
SDL_video.h
Go to the documentation of this file.
00001 /* 00002 Simple DirectMedia Layer 00003 Copyright (C) 1997-2014 Sam Lantinga <slouken@libsdl.org> 00004 00005 This software is provided 'as-is', without any express or implied 00006 warranty. In no event will the authors be held liable for any damages 00007 arising from the use of this software. 00008 00009 Permission is granted to anyone to use this software for any purpose, 00010 including commercial applications, and to alter it and redistribute it 00011 freely, subject to the following restrictions: 00012 00013 1. The origin of this software must not be misrepresented; you must not 00014 claim that you wrote the original software. If you use this software 00015 in a product, an acknowledgment in the product documentation would be 00016 appreciated but is not required. 00017 2. Altered source versions must be plainly marked as such, and must not be 00018 misrepresented as being the original software. 00019 3. This notice may not be removed or altered from any source distribution. 00020 */ 00021 00022 /** 00023 * \file SDL_video.h 00024 * 00025 * Header file for SDL video functions. 00026 */ 00027 00028 #ifndef _SDL_video_h 00029 #define _SDL_video_h 00030 00031 #include "SDL_stdinc.h" 00032 #include "SDL_pixels.h" 00033 #include "SDL_rect.h" 00034 #include "SDL_surface.h" 00035 00036 #include "begin_code.h" 00037 /* Set up for C function definitions, even when using C++ */ 00038 #ifdef __cplusplus 00039 extern "C" { 00040 #endif 00041 00042 /** 00043 * \brief The structure that defines a display mode 00044 * 00045 * \sa SDL_GetNumDisplayModes() 00046 * \sa SDL_GetDisplayMode() 00047 * \sa SDL_GetDesktopDisplayMode() 00048 * \sa SDL_GetCurrentDisplayMode() 00049 * \sa SDL_GetClosestDisplayMode() 00050 * \sa SDL_SetWindowDisplayMode() 00051 * \sa SDL_GetWindowDisplayMode() 00052 */ 00053 typedef struct 00054 { 00055 Uint32 format; /**< pixel format */ 00056 int w; /**< width */ 00057 int h; /**< height */ 00058 int refresh_rate; /**< refresh rate (or zero for unspecified) */ 00059 void *driverdata; /**< driver-specific data, initialize to 0 */ 00060 } SDL_DisplayMode; 00061 00062 /** 00063 * \brief The type used to identify a window 00064 * 00065 * \sa SDL_CreateWindow() 00066 * \sa SDL_CreateWindowFrom() 00067 * \sa SDL_DestroyWindow() 00068 * \sa SDL_GetWindowData() 00069 * \sa SDL_GetWindowFlags() 00070 * \sa SDL_GetWindowGrab() 00071 * \sa SDL_GetWindowPosition() 00072 * \sa SDL_GetWindowSize() 00073 * \sa SDL_GetWindowTitle() 00074 * \sa SDL_HideWindow() 00075 * \sa SDL_MaximizeWindow() 00076 * \sa SDL_MinimizeWindow() 00077 * \sa SDL_RaiseWindow() 00078 * \sa SDL_RestoreWindow() 00079 * \sa SDL_SetWindowData() 00080 * \sa SDL_SetWindowFullscreen() 00081 * \sa SDL_SetWindowGrab() 00082 * \sa SDL_SetWindowIcon() 00083 * \sa SDL_SetWindowPosition() 00084 * \sa SDL_SetWindowSize() 00085 * \sa SDL_SetWindowBordered() 00086 * \sa SDL_SetWindowTitle() 00087 * \sa SDL_ShowWindow() 00088 */ 00089 typedef struct SDL_Window SDL_Window; 00090 00091 /** 00092 * \brief The flags on a window 00093 * 00094 * \sa SDL_GetWindowFlags() 00095 */ 00096 typedef enum 00097 { 00098 SDL_WINDOW_FULLSCREEN = 0x00000001, /**< fullscreen window */ 00099 SDL_WINDOW_OPENGL = 0x00000002, /**< window usable with OpenGL context */ 00100 SDL_WINDOW_SHOWN = 0x00000004, /**< window is visible */ 00101 SDL_WINDOW_HIDDEN = 0x00000008, /**< window is not visible */ 00102 SDL_WINDOW_BORDERLESS = 0x00000010, /**< no window decoration */ 00103 SDL_WINDOW_RESIZABLE = 0x00000020, /**< window can be resized */ 00104 SDL_WINDOW_MINIMIZED = 0x00000040, /**< window is minimized */ 00105 SDL_WINDOW_MAXIMIZED = 0x00000080, /**< window is maximized */ 00106 SDL_WINDOW_INPUT_GRABBED = 0x00000100, /**< window has grabbed input focus */ 00107 SDL_WINDOW_INPUT_FOCUS = 0x00000200, /**< window has input focus */ 00108 SDL_WINDOW_MOUSE_FOCUS = 0x00000400, /**< window has mouse focus */ 00109 SDL_WINDOW_FULLSCREEN_DESKTOP = ( SDL_WINDOW_FULLSCREEN | 0x00001000 ), 00110 SDL_WINDOW_FOREIGN = 0x00000800, /**< window not created by SDL */ 00111 SDL_WINDOW_ALLOW_HIGHDPI = 0x00002000 /**< window should be created in high-DPI mode if supported */ 00112 } SDL_WindowFlags; 00113 00114 /** 00115 * \brief Used to indicate that you don't care what the window position is. 00116 */ 00117 #define SDL_WINDOWPOS_UNDEFINED_MASK 0x1FFF0000 00118 #define SDL_WINDOWPOS_UNDEFINED_DISPLAY(X) (SDL_WINDOWPOS_UNDEFINED_MASK|(X)) 00119 #define SDL_WINDOWPOS_UNDEFINED SDL_WINDOWPOS_UNDEFINED_DISPLAY(0) 00120 #define SDL_WINDOWPOS_ISUNDEFINED(X) \ 00121 (((X)&0xFFFF0000) == SDL_WINDOWPOS_UNDEFINED_MASK) 00122 00123 /** 00124 * \brief Used to indicate that the window position should be centered. 00125 */ 00126 #define SDL_WINDOWPOS_CENTERED_MASK 0x2FFF0000 00127 #define SDL_WINDOWPOS_CENTERED_DISPLAY(X) (SDL_WINDOWPOS_CENTERED_MASK|(X)) 00128 #define SDL_WINDOWPOS_CENTERED SDL_WINDOWPOS_CENTERED_DISPLAY(0) 00129 #define SDL_WINDOWPOS_ISCENTERED(X) \ 00130 (((X)&0xFFFF0000) == SDL_WINDOWPOS_CENTERED_MASK) 00131 00132 /** 00133 * \brief Event subtype for window events 00134 */ 00135 typedef enum 00136 { 00137 SDL_WINDOWEVENT_NONE, /**< Never used */ 00138 SDL_WINDOWEVENT_SHOWN, /**< Window has been shown */ 00139 SDL_WINDOWEVENT_HIDDEN, /**< Window has been hidden */ 00140 SDL_WINDOWEVENT_EXPOSED, /**< Window has been exposed and should be 00141 redrawn */ 00142 SDL_WINDOWEVENT_MOVED, /**< Window has been moved to data1, data2 00143 */ 00144 SDL_WINDOWEVENT_RESIZED, /**< Window has been resized to data1xdata2 */ 00145 SDL_WINDOWEVENT_SIZE_CHANGED, /**< The window size has changed, either as a result of an API call or through the system or user changing the window size. */ 00146 SDL_WINDOWEVENT_MINIMIZED, /**< Window has been minimized */ 00147 SDL_WINDOWEVENT_MAXIMIZED, /**< Window has been maximized */ 00148 SDL_WINDOWEVENT_RESTORED, /**< Window has been restored to normal size 00149 and position */ 00150 SDL_WINDOWEVENT_ENTER, /**< Window has gained mouse focus */ 00151 SDL_WINDOWEVENT_LEAVE, /**< Window has lost mouse focus */ 00152 SDL_WINDOWEVENT_FOCUS_GAINED, /**< Window has gained keyboard focus */ 00153 SDL_WINDOWEVENT_FOCUS_LOST, /**< Window has lost keyboard focus */ 00154 SDL_WINDOWEVENT_CLOSE /**< The window manager requests that the 00155 window be closed */ 00156 } SDL_WindowEventID; 00157 00158 /** 00159 * \brief An opaque handle to an OpenGL context. 00160 */ 00161 typedef void *SDL_GLContext; 00162 00163 /** 00164 * \brief OpenGL configuration attributes 00165 */ 00166 typedef enum 00167 { 00168 SDL_GL_RED_SIZE, 00169 SDL_GL_GREEN_SIZE, 00170 SDL_GL_BLUE_SIZE, 00171 SDL_GL_ALPHA_SIZE, 00172 SDL_GL_BUFFER_SIZE, 00173 SDL_GL_DOUBLEBUFFER, 00174 SDL_GL_DEPTH_SIZE, 00175 SDL_GL_STENCIL_SIZE, 00176 SDL_GL_ACCUM_RED_SIZE, 00177 SDL_GL_ACCUM_GREEN_SIZE, 00178 SDL_GL_ACCUM_BLUE_SIZE, 00179 SDL_GL_ACCUM_ALPHA_SIZE, 00180 SDL_GL_STEREO, 00181 SDL_GL_MULTISAMPLEBUFFERS, 00182 SDL_GL_MULTISAMPLESAMPLES, 00183 SDL_GL_ACCELERATED_VISUAL, 00184 SDL_GL_RETAINED_BACKING, 00185 SDL_GL_CONTEXT_MAJOR_VERSION, 00186 SDL_GL_CONTEXT_MINOR_VERSION, 00187 SDL_GL_CONTEXT_EGL, 00188 SDL_GL_CONTEXT_FLAGS, 00189 SDL_GL_CONTEXT_PROFILE_MASK, 00190 SDL_GL_SHARE_WITH_CURRENT_CONTEXT, 00191 SDL_GL_FRAMEBUFFER_SRGB_CAPABLE 00192 } SDL_GLattr; 00193 00194 typedef enum 00195 { 00196 SDL_GL_CONTEXT_PROFILE_CORE = 0x0001, 00197 SDL_GL_CONTEXT_PROFILE_COMPATIBILITY = 0x0002, 00198 SDL_GL_CONTEXT_PROFILE_ES = 0x0004 /* GLX_CONTEXT_ES2_PROFILE_BIT_EXT */ 00199 } SDL_GLprofile; 00200 00201 typedef enum 00202 { 00203 SDL_GL_CONTEXT_DEBUG_FLAG = 0x0001, 00204 SDL_GL_CONTEXT_FORWARD_COMPATIBLE_FLAG = 0x0002, 00205 SDL_GL_CONTEXT_ROBUST_ACCESS_FLAG = 0x0004, 00206 SDL_GL_CONTEXT_RESET_ISOLATION_FLAG = 0x0008 00207 } SDL_GLcontextFlag; 00208 00209 00210 /* Function prototypes */ 00211 00212 /** 00213 * \brief Get the number of video drivers compiled into SDL 00214 * 00215 * \sa SDL_GetVideoDriver() 00216 */ 00217 extern DECLSPEC int SDLCALL SDL_GetNumVideoDrivers(void); 00218 00219 /** 00220 * \brief Get the name of a built in video driver. 00221 * 00222 * \note The video drivers are presented in the order in which they are 00223 * normally checked during initialization. 00224 * 00225 * \sa SDL_GetNumVideoDrivers() 00226 */ 00227 extern DECLSPEC const char *SDLCALL SDL_GetVideoDriver(int index); 00228 00229 /** 00230 * \brief Initialize the video subsystem, optionally specifying a video driver. 00231 * 00232 * \param driver_name Initialize a specific driver by name, or NULL for the 00233 * default video driver. 00234 * 00235 * \return 0 on success, -1 on error 00236 * 00237 * This function initializes the video subsystem; setting up a connection 00238 * to the window manager, etc, and determines the available display modes 00239 * and pixel formats, but does not initialize a window or graphics mode. 00240 * 00241 * \sa SDL_VideoQuit() 00242 */ 00243 extern DECLSPEC int SDLCALL SDL_VideoInit(const char *driver_name); 00244 00245 /** 00246 * \brief Shuts down the video subsystem. 00247 * 00248 * This function closes all windows, and restores the original video mode. 00249 * 00250 * \sa SDL_VideoInit() 00251 */ 00252 extern DECLSPEC void SDLCALL SDL_VideoQuit(void); 00253 00254 /** 00255 * \brief Returns the name of the currently initialized video driver. 00256 * 00257 * \return The name of the current video driver or NULL if no driver 00258 * has been initialized 00259 * 00260 * \sa SDL_GetNumVideoDrivers() 00261 * \sa SDL_GetVideoDriver() 00262 */ 00263 extern DECLSPEC const char *SDLCALL SDL_GetCurrentVideoDriver(void); 00264 00265 /** 00266 * \brief Returns the number of available video displays. 00267 * 00268 * \sa SDL_GetDisplayBounds() 00269 */ 00270 extern DECLSPEC int SDLCALL SDL_GetNumVideoDisplays(void); 00271 00272 /** 00273 * \brief Get the name of a display in UTF-8 encoding 00274 * 00275 * \return The name of a display, or NULL for an invalid display index. 00276 * 00277 * \sa SDL_GetNumVideoDisplays() 00278 */ 00279 extern DECLSPEC const char * SDLCALL SDL_GetDisplayName(int displayIndex); 00280 00281 /** 00282 * \brief Get the desktop area represented by a display, with the primary 00283 * display located at 0,0 00284 * 00285 * \return 0 on success, or -1 if the index is out of range. 00286 * 00287 * \sa SDL_GetNumVideoDisplays() 00288 */ 00289 extern DECLSPEC int SDLCALL SDL_GetDisplayBounds(int displayIndex, SDL_Rect * rect); 00290 00291 /** 00292 * \brief Returns the number of available display modes. 00293 * 00294 * \sa SDL_GetDisplayMode() 00295 */ 00296 extern DECLSPEC int SDLCALL SDL_GetNumDisplayModes(int displayIndex); 00297 00298 /** 00299 * \brief Fill in information about a specific display mode. 00300 * 00301 * \note The display modes are sorted in this priority: 00302 * \li bits per pixel -> more colors to fewer colors 00303 * \li width -> largest to smallest 00304 * \li height -> largest to smallest 00305 * \li refresh rate -> highest to lowest 00306 * 00307 * \sa SDL_GetNumDisplayModes() 00308 */ 00309 extern DECLSPEC int SDLCALL SDL_GetDisplayMode(int displayIndex, int modeIndex, 00310 SDL_DisplayMode * mode); 00311 00312 /** 00313 * \brief Fill in information about the desktop display mode. 00314 */ 00315 extern DECLSPEC int SDLCALL SDL_GetDesktopDisplayMode(int displayIndex, SDL_DisplayMode * mode); 00316 00317 /** 00318 * \brief Fill in information about the current display mode. 00319 */ 00320 extern DECLSPEC int SDLCALL SDL_GetCurrentDisplayMode(int displayIndex, SDL_DisplayMode * mode); 00321 00322 00323 /** 00324 * \brief Get the closest match to the requested display mode. 00325 * 00326 * \param displayIndex The index of display from which mode should be queried. 00327 * \param mode The desired display mode 00328 * \param closest A pointer to a display mode to be filled in with the closest 00329 * match of the available display modes. 00330 * 00331 * \return The passed in value \c closest, or NULL if no matching video mode 00332 * was available. 00333 * 00334 * The available display modes are scanned, and \c closest is filled in with the 00335 * closest mode matching the requested mode and returned. The mode format and 00336 * refresh_rate default to the desktop mode if they are 0. The modes are 00337 * scanned with size being first priority, format being second priority, and 00338 * finally checking the refresh_rate. If all the available modes are too 00339 * small, then NULL is returned. 00340 * 00341 * \sa SDL_GetNumDisplayModes() 00342 * \sa SDL_GetDisplayMode() 00343 */ 00344 extern DECLSPEC SDL_DisplayMode * SDLCALL SDL_GetClosestDisplayMode(int displayIndex, const SDL_DisplayMode * mode, SDL_DisplayMode * closest); 00345 00346 /** 00347 * \brief Get the display index associated with a window. 00348 * 00349 * \return the display index of the display containing the center of the 00350 * window, or -1 on error. 00351 */ 00352 extern DECLSPEC int SDLCALL SDL_GetWindowDisplayIndex(SDL_Window * window); 00353 00354 /** 00355 * \brief Set the display mode used when a fullscreen window is visible. 00356 * 00357 * By default the window's dimensions and the desktop format and refresh rate 00358 * are used. 00359 * 00360 * \param window The window for which the display mode should be set. 00361 * \param mode The mode to use, or NULL for the default mode. 00362 * 00363 * \return 0 on success, or -1 if setting the display mode failed. 00364 * 00365 * \sa SDL_GetWindowDisplayMode() 00366 * \sa SDL_SetWindowFullscreen() 00367 */ 00368 extern DECLSPEC int SDLCALL SDL_SetWindowDisplayMode(SDL_Window * window, 00369 const SDL_DisplayMode 00370 * mode); 00371 00372 /** 00373 * \brief Fill in information about the display mode used when a fullscreen 00374 * window is visible. 00375 * 00376 * \sa SDL_SetWindowDisplayMode() 00377 * \sa SDL_SetWindowFullscreen() 00378 */ 00379 extern DECLSPEC int SDLCALL SDL_GetWindowDisplayMode(SDL_Window * window, 00380 SDL_DisplayMode * mode); 00381 00382 /** 00383 * \brief Get the pixel format associated with the window. 00384 */ 00385 extern DECLSPEC Uint32 SDLCALL SDL_GetWindowPixelFormat(SDL_Window * window); 00386 00387 /** 00388 * \brief Create a window with the specified position, dimensions, and flags. 00389 * 00390 * \param title The title of the window, in UTF-8 encoding. 00391 * \param x The x position of the window, ::SDL_WINDOWPOS_CENTERED, or 00392 * ::SDL_WINDOWPOS_UNDEFINED. 00393 * \param y The y position of the window, ::SDL_WINDOWPOS_CENTERED, or 00394 * ::SDL_WINDOWPOS_UNDEFINED. 00395 * \param w The width of the window. 00396 * \param h The height of the window. 00397 * \param flags The flags for the window, a mask of any of the following: 00398 * ::SDL_WINDOW_FULLSCREEN, ::SDL_WINDOW_OPENGL, 00399 * ::SDL_WINDOW_HIDDEN, ::SDL_WINDOW_BORDERLESS, 00400 * ::SDL_WINDOW_RESIZABLE, ::SDL_WINDOW_MAXIMIZED, 00401 * ::SDL_WINDOW_MINIMIZED, ::SDL_WINDOW_INPUT_GRABBED, 00402 * ::SDL_WINDOW_ALLOW_HIGHDPI. 00403 * 00404 * \return The id of the window created, or zero if window creation failed. 00405 * 00406 * \sa SDL_DestroyWindow() 00407 */ 00408 extern DECLSPEC SDL_Window * SDLCALL SDL_CreateWindow(const char *title, 00409 int x, int y, int w, 00410 int h, Uint32 flags); 00411 00412 /** 00413 * \brief Create an SDL window from an existing native window. 00414 * 00415 * \param data A pointer to driver-dependent window creation data 00416 * 00417 * \return The id of the window created, or zero if window creation failed. 00418 * 00419 * \sa SDL_DestroyWindow() 00420 */ 00421 extern DECLSPEC SDL_Window * SDLCALL SDL_CreateWindowFrom(const void *data); 00422 00423 /** 00424 * \brief Get the numeric ID of a window, for logging purposes. 00425 */ 00426 extern DECLSPEC Uint32 SDLCALL SDL_GetWindowID(SDL_Window * window); 00427 00428 /** 00429 * \brief Get a window from a stored ID, or NULL if it doesn't exist. 00430 */ 00431 extern DECLSPEC SDL_Window * SDLCALL SDL_GetWindowFromID(Uint32 id); 00432 00433 /** 00434 * \brief Get the window flags. 00435 */ 00436 extern DECLSPEC Uint32 SDLCALL SDL_GetWindowFlags(SDL_Window * window); 00437 00438 /** 00439 * \brief Set the title of a window, in UTF-8 format. 00440 * 00441 * \sa SDL_GetWindowTitle() 00442 */ 00443 extern DECLSPEC void SDLCALL SDL_SetWindowTitle(SDL_Window * window, 00444 const char *title); 00445 00446 /** 00447 * \brief Get the title of a window, in UTF-8 format. 00448 * 00449 * \sa SDL_SetWindowTitle() 00450 */ 00451 extern DECLSPEC const char *SDLCALL SDL_GetWindowTitle(SDL_Window * window); 00452 00453 /** 00454 * \brief Set the icon for a window. 00455 * 00456 * \param window The window for which the icon should be set. 00457 * \param icon The icon for the window. 00458 */ 00459 extern DECLSPEC void SDLCALL SDL_SetWindowIcon(SDL_Window * window, 00460 SDL_Surface * icon); 00461 00462 /** 00463 * \brief Associate an arbitrary named pointer with a window. 00464 * 00465 * \param window The window to associate with the pointer. 00466 * \param name The name of the pointer. 00467 * \param userdata The associated pointer. 00468 * 00469 * \return The previous value associated with 'name' 00470 * 00471 * \note The name is case-sensitive. 00472 * 00473 * \sa SDL_GetWindowData() 00474 */ 00475 extern DECLSPEC void* SDLCALL SDL_SetWindowData(SDL_Window * window, 00476 const char *name, 00477 void *userdata); 00478 00479 /** 00480 * \brief Retrieve the data pointer associated with a window. 00481 * 00482 * \param window The window to query. 00483 * \param name The name of the pointer. 00484 * 00485 * \return The value associated with 'name' 00486 * 00487 * \sa SDL_SetWindowData() 00488 */ 00489 extern DECLSPEC void *SDLCALL SDL_GetWindowData(SDL_Window * window, 00490 const char *name); 00491 00492 /** 00493 * \brief Set the position of a window. 00494 * 00495 * \param window The window to reposition. 00496 * \param x The x coordinate of the window, ::SDL_WINDOWPOS_CENTERED, or 00497 ::SDL_WINDOWPOS_UNDEFINED. 00498 * \param y The y coordinate of the window, ::SDL_WINDOWPOS_CENTERED, or 00499 ::SDL_WINDOWPOS_UNDEFINED. 00500 * 00501 * \note The window coordinate origin is the upper left of the display. 00502 * 00503 * \sa SDL_GetWindowPosition() 00504 */ 00505 extern DECLSPEC void SDLCALL SDL_SetWindowPosition(SDL_Window * window, 00506 int x, int y); 00507 00508 /** 00509 * \brief Get the position of a window. 00510 * 00511 * \param window The window to query. 00512 * \param x Pointer to variable for storing the x position, may be NULL 00513 * \param y Pointer to variable for storing the y position, may be NULL 00514 * 00515 * \sa SDL_SetWindowPosition() 00516 */ 00517 extern DECLSPEC void SDLCALL SDL_GetWindowPosition(SDL_Window * window, 00518 int *x, int *y); 00519 00520 /** 00521 * \brief Set the size of a window's client area. 00522 * 00523 * \param window The window to resize. 00524 * \param w The width of the window, must be >0 00525 * \param h The height of the window, must be >0 00526 * 00527 * \note You can't change the size of a fullscreen window, it automatically 00528 * matches the size of the display mode. 00529 * 00530 * \sa SDL_GetWindowSize() 00531 */ 00532 extern DECLSPEC void SDLCALL SDL_SetWindowSize(SDL_Window * window, int w, 00533 int h); 00534 00535 /** 00536 * \brief Get the size of a window's client area. 00537 * 00538 * \param window The window to query. 00539 * \param w Pointer to variable for storing the width, may be NULL 00540 * \param h Pointer to variable for storing the height, may be NULL 00541 * 00542 * \sa SDL_SetWindowSize() 00543 */ 00544 extern DECLSPEC void SDLCALL SDL_GetWindowSize(SDL_Window * window, int *w, 00545 int *h); 00546 00547 /** 00548 * \brief Set the minimum size of a window's client area. 00549 * 00550 * \param window The window to set a new minimum size. 00551 * \param min_w The minimum width of the window, must be >0 00552 * \param min_h The minimum height of the window, must be >0 00553 * 00554 * \note You can't change the minimum size of a fullscreen window, it 00555 * automatically matches the size of the display mode. 00556 * 00557 * \sa SDL_GetWindowMinimumSize() 00558 * \sa SDL_SetWindowMaximumSize() 00559 */ 00560 extern DECLSPEC void SDLCALL SDL_SetWindowMinimumSize(SDL_Window * window, 00561 int min_w, int min_h); 00562 00563 /** 00564 * \brief Get the minimum size of a window's client area. 00565 * 00566 * \param window The window to query. 00567 * \param w Pointer to variable for storing the minimum width, may be NULL 00568 * \param h Pointer to variable for storing the minimum height, may be NULL 00569 * 00570 * \sa SDL_GetWindowMaximumSize() 00571 * \sa SDL_SetWindowMinimumSize() 00572 */ 00573 extern DECLSPEC void SDLCALL SDL_GetWindowMinimumSize(SDL_Window * window, 00574 int *w, int *h); 00575 00576 /** 00577 * \brief Set the maximum size of a window's client area. 00578 * 00579 * \param window The window to set a new maximum size. 00580 * \param max_w The maximum width of the window, must be >0 00581 * \param max_h The maximum height of the window, must be >0 00582 * 00583 * \note You can't change the maximum size of a fullscreen window, it 00584 * automatically matches the size of the display mode. 00585 * 00586 * \sa SDL_GetWindowMaximumSize() 00587 * \sa SDL_SetWindowMinimumSize() 00588 */ 00589 extern DECLSPEC void SDLCALL SDL_SetWindowMaximumSize(SDL_Window * window, 00590 int max_w, int max_h); 00591 00592 /** 00593 * \brief Get the maximum size of a window's client area. 00594 * 00595 * \param window The window to query. 00596 * \param w Pointer to variable for storing the maximum width, may be NULL 00597 * \param h Pointer to variable for storing the maximum height, may be NULL 00598 * 00599 * \sa SDL_GetWindowMinimumSize() 00600 * \sa SDL_SetWindowMaximumSize() 00601 */ 00602 extern DECLSPEC void SDLCALL SDL_GetWindowMaximumSize(SDL_Window * window, 00603 int *w, int *h); 00604 00605 /** 00606 * \brief Set the border state of a window. 00607 * 00608 * This will add or remove the window's SDL_WINDOW_BORDERLESS flag and 00609 * add or remove the border from the actual window. This is a no-op if the 00610 * window's border already matches the requested state. 00611 * 00612 * \param window The window of which to change the border state. 00613 * \param bordered SDL_FALSE to remove border, SDL_TRUE to add border. 00614 * 00615 * \note You can't change the border state of a fullscreen window. 00616 * 00617 * \sa SDL_GetWindowFlags() 00618 */ 00619 extern DECLSPEC void SDLCALL SDL_SetWindowBordered(SDL_Window * window, 00620 SDL_bool bordered); 00621 00622 /** 00623 * \brief Show a window. 00624 * 00625 * \sa SDL_HideWindow() 00626 */ 00627 extern DECLSPEC void SDLCALL SDL_ShowWindow(SDL_Window * window); 00628 00629 /** 00630 * \brief Hide a window. 00631 * 00632 * \sa SDL_ShowWindow() 00633 */ 00634 extern DECLSPEC void SDLCALL SDL_HideWindow(SDL_Window * window); 00635 00636 /** 00637 * \brief Raise a window above other windows and set the input focus. 00638 */ 00639 extern DECLSPEC void SDLCALL SDL_RaiseWindow(SDL_Window * window); 00640 00641 /** 00642 * \brief Make a window as large as possible. 00643 * 00644 * \sa SDL_RestoreWindow() 00645 */ 00646 extern DECLSPEC void SDLCALL SDL_MaximizeWindow(SDL_Window * window); 00647 00648 /** 00649 * \brief Minimize a window to an iconic representation. 00650 * 00651 * \sa SDL_RestoreWindow() 00652 */ 00653 extern DECLSPEC void SDLCALL SDL_MinimizeWindow(SDL_Window * window); 00654 00655 /** 00656 * \brief Restore the size and position of a minimized or maximized window. 00657 * 00658 * \sa SDL_MaximizeWindow() 00659 * \sa SDL_MinimizeWindow() 00660 */ 00661 extern DECLSPEC void SDLCALL SDL_RestoreWindow(SDL_Window * window); 00662 00663 /** 00664 * \brief Set a window's fullscreen state. 00665 * 00666 * \return 0 on success, or -1 if setting the display mode failed. 00667 * 00668 * \sa SDL_SetWindowDisplayMode() 00669 * \sa SDL_GetWindowDisplayMode() 00670 */ 00671 extern DECLSPEC int SDLCALL SDL_SetWindowFullscreen(SDL_Window * window, 00672 Uint32 flags); 00673 00674 /** 00675 * \brief Get the SDL surface associated with the window. 00676 * 00677 * \return The window's framebuffer surface, or NULL on error. 00678 * 00679 * A new surface will be created with the optimal format for the window, 00680 * if necessary. This surface will be freed when the window is destroyed. 00681 * 00682 * \note You may not combine this with 3D or the rendering API on this window. 00683 * 00684 * \sa SDL_UpdateWindowSurface() 00685 * \sa SDL_UpdateWindowSurfaceRects() 00686 */ 00687 extern DECLSPEC SDL_Surface * SDLCALL SDL_GetWindowSurface(SDL_Window * window); 00688 00689 /** 00690 * \brief Copy the window surface to the screen. 00691 * 00692 * \return 0 on success, or -1 on error. 00693 * 00694 * \sa SDL_GetWindowSurface() 00695 * \sa SDL_UpdateWindowSurfaceRects() 00696 */ 00697 extern DECLSPEC int SDLCALL SDL_UpdateWindowSurface(SDL_Window * window); 00698 00699 /** 00700 * \brief Copy a number of rectangles on the window surface to the screen. 00701 * 00702 * \return 0 on success, or -1 on error. 00703 * 00704 * \sa SDL_GetWindowSurface() 00705 * \sa SDL_UpdateWindowSurfaceRect() 00706 */ 00707 extern DECLSPEC int SDLCALL SDL_UpdateWindowSurfaceRects(SDL_Window * window, 00708 const SDL_Rect * rects, 00709 int numrects); 00710 00711 /** 00712 * \brief Set a window's input grab mode. 00713 * 00714 * \param window The window for which the input grab mode should be set. 00715 * \param grabbed This is SDL_TRUE to grab input, and SDL_FALSE to release input. 00716 * 00717 * \sa SDL_GetWindowGrab() 00718 */ 00719 extern DECLSPEC void SDLCALL SDL_SetWindowGrab(SDL_Window * window, 00720 SDL_bool grabbed); 00721 00722 /** 00723 * \brief Get a window's input grab mode. 00724 * 00725 * \return This returns SDL_TRUE if input is grabbed, and SDL_FALSE otherwise. 00726 * 00727 * \sa SDL_SetWindowGrab() 00728 */ 00729 extern DECLSPEC SDL_bool SDLCALL SDL_GetWindowGrab(SDL_Window * window); 00730 00731 /** 00732 * \brief Set the brightness (gamma correction) for a window. 00733 * 00734 * \return 0 on success, or -1 if setting the brightness isn't supported. 00735 * 00736 * \sa SDL_GetWindowBrightness() 00737 * \sa SDL_SetWindowGammaRamp() 00738 */ 00739 extern DECLSPEC int SDLCALL SDL_SetWindowBrightness(SDL_Window * window, float brightness); 00740 00741 /** 00742 * \brief Get the brightness (gamma correction) for a window. 00743 * 00744 * \return The last brightness value passed to SDL_SetWindowBrightness() 00745 * 00746 * \sa SDL_SetWindowBrightness() 00747 */ 00748 extern DECLSPEC float SDLCALL SDL_GetWindowBrightness(SDL_Window * window); 00749 00750 /** 00751 * \brief Set the gamma ramp for a window. 00752 * 00753 * \param window The window for which the gamma ramp should be set. 00754 * \param red The translation table for the red channel, or NULL. 00755 * \param green The translation table for the green channel, or NULL. 00756 * \param blue The translation table for the blue channel, or NULL. 00757 * 00758 * \return 0 on success, or -1 if gamma ramps are unsupported. 00759 * 00760 * Set the gamma translation table for the red, green, and blue channels 00761 * of the video hardware. Each table is an array of 256 16-bit quantities, 00762 * representing a mapping between the input and output for that channel. 00763 * The input is the index into the array, and the output is the 16-bit 00764 * gamma value at that index, scaled to the output color precision. 00765 * 00766 * \sa SDL_GetWindowGammaRamp() 00767 */ 00768 extern DECLSPEC int SDLCALL SDL_SetWindowGammaRamp(SDL_Window * window, 00769 const Uint16 * red, 00770 const Uint16 * green, 00771 const Uint16 * blue); 00772 00773 /** 00774 * \brief Get the gamma ramp for a window. 00775 * 00776 * \param window The window from which the gamma ramp should be queried. 00777 * \param red A pointer to a 256 element array of 16-bit quantities to hold 00778 * the translation table for the red channel, or NULL. 00779 * \param green A pointer to a 256 element array of 16-bit quantities to hold 00780 * the translation table for the green channel, or NULL. 00781 * \param blue A pointer to a 256 element array of 16-bit quantities to hold 00782 * the translation table for the blue channel, or NULL. 00783 * 00784 * \return 0 on success, or -1 if gamma ramps are unsupported. 00785 * 00786 * \sa SDL_SetWindowGammaRamp() 00787 */ 00788 extern DECLSPEC int SDLCALL SDL_GetWindowGammaRamp(SDL_Window * window, 00789 Uint16 * red, 00790 Uint16 * green, 00791 Uint16 * blue); 00792 00793 /** 00794 * \brief Destroy a window. 00795 */ 00796 extern DECLSPEC void SDLCALL SDL_DestroyWindow(SDL_Window * window); 00797 00798 00799 /** 00800 * \brief Returns whether the screensaver is currently enabled (default on). 00801 * 00802 * \sa SDL_EnableScreenSaver() 00803 * \sa SDL_DisableScreenSaver() 00804 */ 00805 extern DECLSPEC SDL_bool SDLCALL SDL_IsScreenSaverEnabled(void); 00806 00807 /** 00808 * \brief Allow the screen to be blanked by a screensaver 00809 * 00810 * \sa SDL_IsScreenSaverEnabled() 00811 * \sa SDL_DisableScreenSaver() 00812 */ 00813 extern DECLSPEC void SDLCALL SDL_EnableScreenSaver(void); 00814 00815 /** 00816 * \brief Prevent the screen from being blanked by a screensaver 00817 * 00818 * \sa SDL_IsScreenSaverEnabled() 00819 * \sa SDL_EnableScreenSaver() 00820 */ 00821 extern DECLSPEC void SDLCALL SDL_DisableScreenSaver(void); 00822 00823 00824 /** 00825 * \name OpenGL support functions 00826 */ 00827 /* @{ */ 00828 00829 /** 00830 * \brief Dynamically load an OpenGL library. 00831 * 00832 * \param path The platform dependent OpenGL library name, or NULL to open the 00833 * default OpenGL library. 00834 * 00835 * \return 0 on success, or -1 if the library couldn't be loaded. 00836 * 00837 * This should be done after initializing the video driver, but before 00838 * creating any OpenGL windows. If no OpenGL library is loaded, the default 00839 * library will be loaded upon creation of the first OpenGL window. 00840 * 00841 * \note If you do this, you need to retrieve all of the GL functions used in 00842 * your program from the dynamic library using SDL_GL_GetProcAddress(). 00843 * 00844 * \sa SDL_GL_GetProcAddress() 00845 * \sa SDL_GL_UnloadLibrary() 00846 */ 00847 extern DECLSPEC int SDLCALL SDL_GL_LoadLibrary(const char *path); 00848 00849 /** 00850 * \brief Get the address of an OpenGL function. 00851 */ 00852 extern DECLSPEC void *SDLCALL SDL_GL_GetProcAddress(const char *proc); 00853 00854 /** 00855 * \brief Unload the OpenGL library previously loaded by SDL_GL_LoadLibrary(). 00856 * 00857 * \sa SDL_GL_LoadLibrary() 00858 */ 00859 extern DECLSPEC void SDLCALL SDL_GL_UnloadLibrary(void); 00860 00861 /** 00862 * \brief Return true if an OpenGL extension is supported for the current 00863 * context. 00864 */ 00865 extern DECLSPEC SDL_bool SDLCALL SDL_GL_ExtensionSupported(const char 00866 *extension); 00867 00868 /** 00869 * \brief Reset all previously set OpenGL context attributes to their default values 00870 */ 00871 extern DECLSPEC void SDLCALL SDL_GL_ResetAttributes(void); 00872 00873 /** 00874 * \brief Set an OpenGL window attribute before window creation. 00875 */ 00876 extern DECLSPEC int SDLCALL SDL_GL_SetAttribute(SDL_GLattr attr, int value); 00877 00878 /** 00879 * \brief Get the actual value for an attribute from the current context. 00880 */ 00881 extern DECLSPEC int SDLCALL SDL_GL_GetAttribute(SDL_GLattr attr, int *value); 00882 00883 /** 00884 * \brief Create an OpenGL context for use with an OpenGL window, and make it 00885 * current. 00886 * 00887 * \sa SDL_GL_DeleteContext() 00888 */ 00889 extern DECLSPEC SDL_GLContext SDLCALL SDL_GL_CreateContext(SDL_Window * 00890 window); 00891 00892 /** 00893 * \brief Set up an OpenGL context for rendering into an OpenGL window. 00894 * 00895 * \note The context must have been created with a compatible window. 00896 */ 00897 extern DECLSPEC int SDLCALL SDL_GL_MakeCurrent(SDL_Window * window, 00898 SDL_GLContext context); 00899 00900 /** 00901 * \brief Get the currently active OpenGL window. 00902 */ 00903 extern DECLSPEC SDL_Window* SDLCALL SDL_GL_GetCurrentWindow(void); 00904 00905 /** 00906 * \brief Get the currently active OpenGL context. 00907 */ 00908 extern DECLSPEC SDL_GLContext SDLCALL SDL_GL_GetCurrentContext(void); 00909 00910 /** 00911 * \brief Get the size of a window's underlying drawable (for use with glViewport). 00912 * 00913 * \param window Window from which the drawable size should be queried 00914 * \param w Pointer to variable for storing the width, may be NULL 00915 * \param h Pointer to variable for storing the height, may be NULL 00916 * 00917 * This may differ from SDL_GetWindowSize if we're rendering to a high-DPI 00918 * drawable, i.e. the window was created with SDL_WINDOW_ALLOW_HIGHDPI on a 00919 * platform with high-DPI support (Apple calls this "Retina"), and not disabled 00920 * by the SDL_HINT_VIDEO_HIGHDPI_DISABLED hint. 00921 * 00922 * \sa SDL_GetWindowSize() 00923 * \sa SDL_CreateWindow() 00924 */ 00925 extern DECLSPEC void SDLCALL SDL_GL_GetDrawableSize(SDL_Window * window, int *w, 00926 int *h); 00927 00928 /** 00929 * \brief Set the swap interval for the current OpenGL context. 00930 * 00931 * \param interval 0 for immediate updates, 1 for updates synchronized with the 00932 * vertical retrace. If the system supports it, you may 00933 * specify -1 to allow late swaps to happen immediately 00934 * instead of waiting for the next retrace. 00935 * 00936 * \return 0 on success, or -1 if setting the swap interval is not supported. 00937 * 00938 * \sa SDL_GL_GetSwapInterval() 00939 */ 00940 extern DECLSPEC int SDLCALL SDL_GL_SetSwapInterval(int interval); 00941 00942 /** 00943 * \brief Get the swap interval for the current OpenGL context. 00944 * 00945 * \return 0 if there is no vertical retrace synchronization, 1 if the buffer 00946 * swap is synchronized with the vertical retrace, and -1 if late 00947 * swaps happen immediately instead of waiting for the next retrace. 00948 * If the system can't determine the swap interval, or there isn't a 00949 * valid current context, this will return 0 as a safe default. 00950 * 00951 * \sa SDL_GL_SetSwapInterval() 00952 */ 00953 extern DECLSPEC int SDLCALL SDL_GL_GetSwapInterval(void); 00954 00955 /** 00956 * \brief Swap the OpenGL buffers for a window, if double-buffering is 00957 * supported. 00958 */ 00959 extern DECLSPEC void SDLCALL SDL_GL_SwapWindow(SDL_Window * window); 00960 00961 /** 00962 * \brief Delete an OpenGL context. 00963 * 00964 * \sa SDL_GL_CreateContext() 00965 */ 00966 extern DECLSPEC void SDLCALL SDL_GL_DeleteContext(SDL_GLContext context); 00967 00968 /* @} *//* OpenGL support functions */ 00969 00970 00971 /* Ends C function definitions when using C++ */ 00972 #ifdef __cplusplus 00973 } 00974 #endif 00975 #include "close_code.h" 00976 00977 #endif /* _SDL_video_h */ 00978 00979 /* vi: set ts=4 sw=4 expandtab: */
Generated on Tue Jul 12 2022 15:10:21 by 1.7.2