slouken@0: /* slouken@0: SDL - Simple DirectMedia Layer slouken@2859: Copyright (C) 1997-2009 Sam Lantinga slouken@0: slouken@0: This library is free software; you can redistribute it and/or slouken@1312: modify it under the terms of the GNU Lesser General Public slouken@0: License as published by the Free Software Foundation; either slouken@1312: version 2.1 of the License, or (at your option) any later version. slouken@0: slouken@0: This library is distributed in the hope that it will be useful, slouken@0: but WITHOUT ANY WARRANTY; without even the implied warranty of slouken@0: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU slouken@1312: Lesser General Public License for more details. slouken@0: slouken@1312: You should have received a copy of the GNU Lesser General Public slouken@1312: License along with this library; if not, write to the Free Software slouken@1312: Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA slouken@0: slouken@0: Sam Lantinga slouken@251: slouken@libsdl.org slouken@0: */ slouken@0: slouken@1895: /** slouken@3407: * \file SDL_video.h slouken@3407: * slouken@3407: * Header file for SDL video functions. slouken@1895: */ slouken@0: slouken@0: #ifndef _SDL_video_h slouken@0: #define _SDL_video_h slouken@0: slouken@1356: #include "SDL_stdinc.h" slouken@1895: #include "SDL_pixels.h" slouken@2275: #include "SDL_rect.h" slouken@2275: #include "SDL_surface.h" slouken@0: slouken@0: #include "begin_code.h" slouken@0: /* Set up for C function definitions, even when using C++ */ slouken@0: #ifdef __cplusplus slouken@1895: /* *INDENT-OFF* */ slouken@0: extern "C" { slouken@1895: /* *INDENT-ON* */ slouken@0: #endif slouken@0: slouken@1895: /** slouken@3407: * \brief The structure that defines a display mode slouken@3407: * slouken@3407: * \sa SDL_GetNumDisplayModes() slouken@3407: * \sa SDL_GetDisplayMode() slouken@3407: * \sa SDL_GetDesktopDisplayMode() slouken@3407: * \sa SDL_GetCurrentDisplayMode() slouken@3407: * \sa SDL_GetClosestDisplayMode() slouken@3500: * \sa SDL_SetWindowDisplayMode() slouken@3500: * \sa SDL_GetWindowDisplayMode() slouken@1895: */ slouken@1895: typedef struct slouken@1895: { slouken@1895: Uint32 format; /**< pixel format */ slouken@1895: int w; /**< width */ slouken@1895: int h; /**< height */ slouken@1895: int refresh_rate; /**< refresh rate (or zero for unspecified) */ slouken@1895: void *driverdata; /**< driver-specific data, initialize to 0 */ slouken@1895: } SDL_DisplayMode; slouken@0: slouken@1895: /** slouken@3407: * \brief The type used to identify a window slouken@3407: * slouken@3407: * \sa SDL_CreateWindow() slouken@3407: * \sa SDL_CreateWindowFrom() slouken@3407: * \sa SDL_DestroyWindow() slouken@3407: * \sa SDL_GetWindowData() slouken@3407: * \sa SDL_GetWindowFlags() slouken@3407: * \sa SDL_GetWindowGrab() slouken@3407: * \sa SDL_GetWindowPosition() slouken@3407: * \sa SDL_GetWindowSize() slouken@3407: * \sa SDL_GetWindowTitle() slouken@3407: * \sa SDL_HideWindow() slouken@3407: * \sa SDL_MaximizeWindow() slouken@3407: * \sa SDL_MinimizeWindow() slouken@3407: * \sa SDL_RaiseWindow() slouken@3407: * \sa SDL_RestoreWindow() slouken@3407: * \sa SDL_SetWindowData() slouken@3407: * \sa SDL_SetWindowFullscreen() slouken@3407: * \sa SDL_SetWindowGrab() slouken@3407: * \sa SDL_SetWindowIcon() slouken@3407: * \sa SDL_SetWindowPosition() slouken@3407: * \sa SDL_SetWindowSize() slouken@3407: * \sa SDL_SetWindowTitle() slouken@3407: * \sa SDL_ShowWindow() slouken@1895: */ slouken@1895: typedef Uint32 SDL_WindowID; slouken@0: slouken@1895: /** slouken@3407: * \brief The flags on a window slouken@3407: * slouken@3407: * \sa SDL_GetWindowFlags() slouken@1895: */ slouken@1895: typedef enum slouken@1895: { slouken@1895: SDL_WINDOW_FULLSCREEN = 0x00000001, /**< fullscreen window, implies borderless */ slouken@1895: SDL_WINDOW_OPENGL = 0x00000002, /**< window usable with OpenGL context */ slouken@1895: SDL_WINDOW_SHOWN = 0x00000004, /**< window is visible */ slouken@1895: SDL_WINDOW_BORDERLESS = 0x00000008, /**< no window decoration */ slouken@1895: SDL_WINDOW_RESIZABLE = 0x00000010, /**< window can be resized */ slouken@3523: SDL_WINDOW_MINIMIZED = 0x00000020, /**< window is minimized */ slouken@3523: SDL_WINDOW_MAXIMIZED = 0x00000040, /**< window is maximized */ slouken@1895: SDL_WINDOW_INPUT_GRABBED = 0x00000100, /**< window has grabbed input focus */ slouken@1895: SDL_WINDOW_INPUT_FOCUS = 0x00000200, /**< window has input focus */ slouken@3057: SDL_WINDOW_MOUSE_FOCUS = 0x00000400, /**< window has mouse focus */ slouken@3057: SDL_WINDOW_FOREIGN = 0x00000800 /**< window not created by SDL */ slouken@1895: } SDL_WindowFlags; slouken@0: slouken@1895: /** slouken@3407: * \brief Used to indicate that you don't care what the window position is. slouken@1895: */ slouken@1895: #define SDL_WINDOWPOS_UNDEFINED 0x7FFFFFF slouken@3407: slouken@1895: /** slouken@3407: * \brief Used to indicate that the window position should be centered. slouken@1895: */ slouken@1895: #define SDL_WINDOWPOS_CENTERED 0x7FFFFFE slouken@1895: slouken@1895: /** slouken@3407: * \brief Event subtype for window events slouken@1895: */ slouken@1895: typedef enum slouken@1895: { slouken@3407: SDL_WINDOWEVENT_NONE, /**< Never used */ slouken@3407: SDL_WINDOWEVENT_SHOWN, /**< Window has been shown */ slouken@3407: SDL_WINDOWEVENT_HIDDEN, /**< Window has been hidden */ slouken@3407: SDL_WINDOWEVENT_EXPOSED, /**< Window has been exposed and should be slouken@3407: redrawn */ slouken@3407: SDL_WINDOWEVENT_MOVED, /**< Window has been moved to data1, data2 slouken@3407: */ slouken@3407: SDL_WINDOWEVENT_RESIZED, /**< Window size changed to data1xdata2 */ slouken@3407: SDL_WINDOWEVENT_MINIMIZED, /**< Window has been minimized */ slouken@3407: SDL_WINDOWEVENT_MAXIMIZED, /**< Window has been maximized */ slouken@3407: SDL_WINDOWEVENT_RESTORED, /**< Window has been restored to normal size slouken@3407: and position */ slouken@3407: SDL_WINDOWEVENT_ENTER, /**< The window has gained mouse focus */ slouken@3407: SDL_WINDOWEVENT_LEAVE, /**< The window has lost mouse focus */ slouken@3407: SDL_WINDOWEVENT_FOCUS_GAINED, /**< The window has gained keyboard focus */ slouken@3407: SDL_WINDOWEVENT_FOCUS_LOST, /**< The window has lost keyboard focus */ slouken@3407: SDL_WINDOWEVENT_CLOSE /**< The window manager requests that the slouken@3407: window be closed */ slouken@1895: } SDL_WindowEventID; slouken@1895: slouken@1895: /** slouken@3407: * \brief Flags used when creating a rendering context slouken@1895: */ slouken@1895: typedef enum slouken@1895: { slouken@3407: SDL_RENDERER_SINGLEBUFFER = 0x00000001, /**< Render directly to the slouken@3407: window, if possible */ slouken@3407: slouken@3407: SDL_RENDERER_PRESENTCOPY = 0x00000002, /**< Present uses a copy from slouken@3407: back buffer to the front slouken@3407: buffer */ slouken@3407: slouken@3407: SDL_RENDERER_PRESENTFLIP2 = 0x00000004, /**< Present uses a flip, slouken@3407: swapping back buffer and slouken@3407: front buffer */ slouken@3407: slouken@3407: SDL_RENDERER_PRESENTFLIP3 = 0x00000008, /**< Present uses a flip, slouken@3407: rotating between two back slouken@3407: buffers and a front buffer slouken@3407: */ slouken@3407: slouken@3407: SDL_RENDERER_PRESENTDISCARD = 0x00000010, /**< Present leaves the contents slouken@3407: of the backbuffer undefined slouken@3407: */ slouken@3407: slouken@3407: SDL_RENDERER_PRESENTVSYNC = 0x00000020, /**< Present is synchronized slouken@3407: with the refresh rate */ slouken@3407: slouken@3407: SDL_RENDERER_ACCELERATED = 0x00000040 /**< The renderer uses hardware slouken@3407: acceleration */ slouken@3407: slouken@3407: } SDL_RendererFlags; slouken@1895: slouken@1895: /** slouken@3407: * \brief Information on the capabilities of a render driver or context. slouken@1895: */ slouken@1895: typedef struct SDL_RendererInfo slouken@1895: { slouken@1895: const char *name; /**< The name of the renderer */ slouken@3407: Uint32 flags; /**< Supported ::SDL_RendererFlags */ slouken@1985: Uint32 mod_modes; /**< A mask of supported channel modulation */ slouken@1895: Uint32 blend_modes; /**< A mask of supported blend modes */ slouken@1895: Uint32 scale_modes; /**< A mask of supported scale modes */ slouken@1895: Uint32 num_texture_formats; /**< The number of available texture formats */ slouken@1920: Uint32 texture_formats[20]; /**< The available texture formats */ slouken@1895: int max_texture_width; /**< The maximimum texture width */ slouken@1895: int max_texture_height; /**< The maximimum texture height */ slouken@1895: } SDL_RendererInfo; slouken@1895: slouken@1895: /** slouken@3407: * \brief The access pattern allowed for a texture. slouken@1895: */ slouken@1895: typedef enum slouken@1895: { slouken@2222: SDL_TEXTUREACCESS_STATIC, /**< Changes rarely, not lockable */ slouken@2222: SDL_TEXTUREACCESS_STREAMING /**< Changes frequently, lockable */ slouken@1895: } SDL_TextureAccess; slouken@1895: slouken@1895: /** slouken@3407: * \brief The texture channel modulation used in SDL_RenderCopy(). slouken@1985: */ slouken@1985: typedef enum slouken@1985: { slouken@1985: SDL_TEXTUREMODULATE_NONE = 0x00000000, /**< No modulation */ slouken@1985: SDL_TEXTUREMODULATE_COLOR = 0x00000001, /**< srcC = srcC * color */ slouken@2208: SDL_TEXTUREMODULATE_ALPHA = 0x00000002 /**< srcA = srcA * alpha */ slouken@1985: } SDL_TextureModulate; slouken@1985: slouken@1985: /** slouken@3407: * \brief The blend mode used in SDL_RenderCopy() and drawing operations. slouken@1895: */ slouken@1895: typedef enum slouken@1895: { slouken@2884: SDL_BLENDMODE_NONE = 0x00000000, /**< No blending */ slouken@3407: SDL_BLENDMODE_MASK = 0x00000001, /**< dst = A ? src : dst slouken@3407: (alpha is mask) */ slouken@3407: slouken@2884: SDL_BLENDMODE_BLEND = 0x00000002, /**< dst = (src * A) + (dst * (1-A)) */ slouken@2884: SDL_BLENDMODE_ADD = 0x00000004, /**< dst = (src * A) + dst */ slouken@2884: SDL_BLENDMODE_MOD = 0x00000008 /**< dst = src * dst */ slouken@2884: } SDL_BlendMode; slouken@1895: slouken@1895: /** slouken@3407: * \brief The texture scale mode used in SDL_RenderCopy(). slouken@1895: */ slouken@1895: typedef enum slouken@1895: { slouken@3407: SDL_TEXTURESCALEMODE_NONE = 0x00000000, /**< No scaling, rectangles must slouken@3407: match dimensions */ slouken@3407: slouken@3407: SDL_TEXTURESCALEMODE_FAST = 0x00000001, /**< Point sampling or slouken@3407: equivalent algorithm */ slouken@3407: slouken@3407: SDL_TEXTURESCALEMODE_SLOW = 0x00000002, /**< Linear filtering or slouken@3407: equivalent algorithm */ slouken@3407: slouken@3407: SDL_TEXTURESCALEMODE_BEST = 0x00000004 /**< Bicubic filtering or slouken@3407: equivalent algorithm */ slouken@1895: } SDL_TextureScaleMode; slouken@1895: slouken@1895: /** slouken@3407: * \brief An efficient driver-specific representation of pixel data slouken@1895: */ slouken@1895: typedef Uint32 SDL_TextureID; slouken@1895: slouken@1895: /** slouken@3407: * \brief An opaque handle to an OpenGL context. slouken@1895: */ slouken@1895: typedef void *SDL_GLContext; slouken@1895: slouken@1895: /** slouken@3407: * \brief OpenGL configuration attributes slouken@0: */ slouken@1895: typedef enum slouken@1895: { slouken@0: SDL_GL_RED_SIZE, slouken@0: SDL_GL_GREEN_SIZE, slouken@0: SDL_GL_BLUE_SIZE, slouken@0: SDL_GL_ALPHA_SIZE, slouken@0: SDL_GL_BUFFER_SIZE, slouken@0: SDL_GL_DOUBLEBUFFER, slouken@0: SDL_GL_DEPTH_SIZE, slouken@0: SDL_GL_STENCIL_SIZE, slouken@0: SDL_GL_ACCUM_RED_SIZE, slouken@0: SDL_GL_ACCUM_GREEN_SIZE, slouken@0: SDL_GL_ACCUM_BLUE_SIZE, slouken@450: SDL_GL_ACCUM_ALPHA_SIZE, slouken@655: SDL_GL_STEREO, slouken@656: SDL_GL_MULTISAMPLEBUFFERS, slouken@1736: SDL_GL_MULTISAMPLESAMPLES, hfutrell@2747: SDL_GL_ACCELERATED_VISUAL, slouken@3100: SDL_GL_RETAINED_BACKING, slouken@3139: SDL_GL_CONTEXT_MAJOR_VERSION, slouken@3139: SDL_GL_CONTEXT_MINOR_VERSION slouken@0: } SDL_GLattr; slouken@0: slouken@0: slouken@0: /* Function prototypes */ slouken@0: slouken@1895: /** slouken@3407: * \brief Get the number of video drivers compiled into SDL slouken@3407: * slouken@3407: * \sa SDL_GetVideoDriver() slouken@0: */ slouken@1895: extern DECLSPEC int SDLCALL SDL_GetNumVideoDrivers(void); slouken@1895: slouken@1895: /** slouken@3407: * \brief Get the name of a built in video driver. slouken@3407: * slouken@3407: * \note The video drivers are presented in the order in which they are slouken@3407: * normally checked during initialization. slouken@3407: * slouken@3407: * \sa SDL_GetNumVideoDrivers() slouken@1895: */ slouken@1895: extern DECLSPEC const char *SDLCALL SDL_GetVideoDriver(int index); slouken@1895: slouken@1895: /** slouken@3407: * \brief Initialize the video subsystem, optionally specifying a video driver. slouken@3407: * slouken@3407: * \param driver_name Initialize a specific driver by name, or NULL for the slouken@3407: * default video driver. slouken@3407: * slouken@3407: * \param flags FIXME: Still needed? slouken@3407: * slouken@3407: * \return 0 on success, -1 on error slouken@3407: * slouken@3407: * This function initializes the video subsystem; setting up a connection slouken@3407: * to the window manager, etc, and determines the available display modes slouken@3407: * and pixel formats, but does not initialize a window or graphics mode. slouken@3407: * slouken@3407: * \sa SDL_VideoQuit() slouken@1895: */ slouken@1895: extern DECLSPEC int SDLCALL SDL_VideoInit(const char *driver_name, slouken@1895: Uint32 flags); slouken@1895: slouken@1895: /** slouken@3407: * \brief Shuts down the video subsystem. slouken@3407: * slouken@3407: * This function closes all windows, and restores the original video mode. slouken@3407: * slouken@3407: * \sa SDL_VideoInit() slouken@1895: */ slouken@337: extern DECLSPEC void SDLCALL SDL_VideoQuit(void); slouken@0: slouken@1895: /** slouken@3407: * \brief Returns the name of the currently initialized video driver. slouken@3407: * slouken@3407: * \return The name of the current video driver or NULL if no driver slouken@3407: * has been initialized slouken@3407: * slouken@3407: * \sa SDL_GetNumVideoDrivers() slouken@3407: * \sa SDL_GetVideoDriver() slouken@0: */ slouken@1895: extern DECLSPEC const char *SDLCALL SDL_GetCurrentVideoDriver(void); slouken@0: slouken@1895: /** slouken@3407: * \brief Returns the number of available video displays. slouken@3407: * slouken@3528: * \sa SDL_GetDisplayBounds() slouken@3407: * \sa SDL_SelectVideoDisplay() slouken@0: */ slouken@1895: extern DECLSPEC int SDLCALL SDL_GetNumVideoDisplays(void); slouken@0: slouken@1895: /** slouken@3528: * \brief Get the desktop area represented by a display, with the primary slouken@3528: * display located at 0,0 slouken@3528: * slouken@3528: * \return 0 on success, or -1 if the index is out of range. slouken@3528: * slouken@3528: * \sa SDL_GetNumVideoDisplays() slouken@3528: */ slouken@3528: extern DECLSPEC int SDLCALL SDL_GetDisplayBounds(int index, SDL_Rect * rect); slouken@3528: slouken@3528: /** slouken@3407: * \brief Set the index of the currently selected display. slouken@3407: * slouken@3407: * \return 0 on success, or -1 if the index is out of range. slouken@3407: * slouken@3407: * \sa SDL_GetNumVideoDisplays() slouken@3407: * \sa SDL_GetCurrentVideoDisplay() slouken@1963: */ slouken@1963: extern DECLSPEC int SDLCALL SDL_SelectVideoDisplay(int index); slouken@1963: slouken@1963: /** slouken@3407: * \brief Get the index of the currently selected display. slouken@3407: * slouken@3407: * \return The index of the currently selected display. slouken@3407: * slouken@3407: * \sa SDL_GetNumVideoDisplays() slouken@3407: * \sa SDL_SelectVideoDisplay() slouken@0: */ slouken@1963: extern DECLSPEC int SDLCALL SDL_GetCurrentVideoDisplay(void); slouken@0: slouken@1895: /** slouken@3407: * \brief Returns the number of available display modes for the current display. slouken@3407: * slouken@3407: * \sa SDL_GetDisplayMode() slouken@0: */ slouken@1895: extern DECLSPEC int SDLCALL SDL_GetNumDisplayModes(void); slouken@0: slouken@1895: /** slouken@3407: * \brief Fill in information about a specific display mode. slouken@3407: * slouken@3407: * \note The display modes are sorted in this priority: slouken@3407: * \li bits per pixel -> more colors to fewer colors slouken@3407: * \li width -> largest to smallest slouken@3407: * \li height -> largest to smallest slouken@3407: * \li refresh rate -> highest to lowest slouken@3407: * slouken@3407: * \sa SDL_GetNumDisplayModes() slouken@0: */ slouken@1967: extern DECLSPEC int SDLCALL SDL_GetDisplayMode(int index, slouken@1967: SDL_DisplayMode * mode); slouken@0: slouken@1895: /** slouken@3407: * \brief Fill in information about the desktop display mode for the current slouken@3407: * display. slouken@1895: */ slouken@1967: extern DECLSPEC int SDLCALL SDL_GetDesktopDisplayMode(SDL_DisplayMode * mode); slouken@1895: slouken@1895: /** slouken@3407: * \brief Fill in information about the current display mode. slouken@1895: */ slouken@1967: extern DECLSPEC int SDLCALL SDL_GetCurrentDisplayMode(SDL_DisplayMode * mode); slouken@1895: slouken@3400: slouken@1895: /** slouken@3407: * \brief Get the closest match to the requested display mode. slouken@3407: * slouken@3407: * \param mode The desired display mode slouken@3407: * \param closest A pointer to a display mode to be filled in with the closest slouken@3407: * match of the available display modes. slouken@3407: * slouken@3407: * \return The passed in value \c closest, or NULL if no matching video mode slouken@3407: * was available. slouken@3407: * slouken@3407: * The available display modes are scanned, and \c closest is filled in with the slouken@3407: * closest mode matching the requested mode and returned. The mode format and slouken@3407: * refresh_rate default to the desktop mode if they are 0. The modes are slouken@3407: * scanned with size being first priority, format being second priority, and slouken@3407: * finally checking the refresh_rate. If all the available modes are too slouken@3407: * small, then NULL is returned. slouken@3407: * slouken@3407: * \sa SDL_GetNumDisplayModes() slouken@3407: * \sa SDL_GetDisplayMode() slouken@1895: */ slouken@1895: extern DECLSPEC SDL_DisplayMode *SDLCALL SDL_GetClosestDisplayMode(const slouken@1895: SDL_DisplayMode slouken@1895: * mode, slouken@1895: SDL_DisplayMode slouken@1895: * closest); slouken@1895: slouken@1895: /** slouken@3407: * \brief Set the display mode used when a fullscreen window is visible slouken@3500: * on the currently selected display. By default the window's slouken@3500: * dimensions and the desktop format and refresh rate are used. slouken@3407: * slouken@3500: * \param mode The mode to use, or NULL for the default mode. slouken@3407: * slouken@3407: * \return 0 on success, or -1 if setting the display mode failed. slouken@3407: * slouken@3522: * \sa SDL_GetWindowDisplayMode() slouken@3407: * \sa SDL_SetWindowFullscreen() slouken@0: */ slouken@3500: extern DECLSPEC int SDLCALL SDL_SetWindowDisplayMode(SDL_WindowID windowID, slouken@3500: const SDL_DisplayMode slouken@1895: * mode); slouken@0: slouken@1895: /** slouken@3407: * \brief Fill in information about the display mode used when a fullscreen slouken@3407: * window is visible on the currently selected display. slouken@3522: * slouken@3522: * \sa SDL_SetWindowDisplayMode() slouken@3522: * \sa SDL_SetWindowFullscreen() slouken@0: */ slouken@3500: extern DECLSPEC int SDLCALL SDL_GetWindowDisplayMode(SDL_WindowID windowID, slouken@3500: SDL_DisplayMode * mode); slouken@0: slouken@1895: /** slouken@3407: * \brief Set the palette entries for indexed display modes. slouken@3407: * slouken@3407: * \return 0 on success, or -1 if the display mode isn't palettized or the slouken@3407: * colors couldn't be set. slouken@0: */ slouken@1895: extern DECLSPEC int SDLCALL SDL_SetDisplayPalette(const SDL_Color * colors, slouken@1895: int firstcolor, slouken@1895: int ncolors); slouken@0: slouken@1895: /** slouken@3407: * \brief Gets the palette entries for indexed display modes. slouken@3407: * slouken@3407: * \return 0 on success, or -1 if the display mode isn't palettized slouken@1895: */ slouken@1895: extern DECLSPEC int SDLCALL SDL_GetDisplayPalette(SDL_Color * colors, slouken@1895: int firstcolor, slouken@1895: int ncolors); slouken@1895: slouken@1895: /** slouken@3407: * \brief Set the gamma correction for each of the color channels on the slouken@3407: * currently selected display. slouken@3407: * slouken@3407: * \return 0 on success, or -1 if setting the gamma isn't supported. slouken@3407: * slouken@3407: * \sa SDL_SetGammaRamp() slouken@0: */ slouken@337: extern DECLSPEC int SDLCALL SDL_SetGamma(float red, float green, float blue); slouken@0: slouken@1895: /** slouken@3407: * \brief Set the gamma ramp for the currently selected display. slouken@3407: * slouken@3407: * \param red The translation table for the red channel, or NULL. slouken@3407: * \param green The translation table for the green channel, or NULL. slouken@3407: * \param blue The translation table for the blue channel, or NULL. slouken@3407: * slouken@3407: * \return 0 on success, or -1 if gamma ramps are unsupported. slouken@3407: * slouken@3407: * Set the gamma translation table for the red, green, and blue channels slouken@3407: * of the video hardware. Each table is an array of 256 16-bit quantities, slouken@3407: * representing a mapping between the input and output for that channel. slouken@3407: * The input is the index into the array, and the output is the 16-bit slouken@3407: * gamma value at that index, scaled to the output color precision. slouken@3407: * slouken@3407: * \sa SDL_GetGammaRamp() slouken@0: */ slouken@1895: extern DECLSPEC int SDLCALL SDL_SetGammaRamp(const Uint16 * red, slouken@1895: const Uint16 * green, slouken@1895: const Uint16 * blue); slouken@0: slouken@1895: /** slouken@3407: * \brief Get the gamma ramp for the currently selected display. slouken@3407: * slouken@3407: * \param red A pointer to a 256 element array of 16-bit quantities to hold slouken@3407: * the translation table for the red channel, or NULL. slouken@3407: * \param green A pointer to a 256 element array of 16-bit quantities to hold slouken@3407: * the translation table for the green channel, or NULL. slouken@3407: * \param blue A pointer to a 256 element array of 16-bit quantities to hold slouken@3407: * the translation table for the blue channel, or NULL. slouken@3407: * slouken@3407: * \return 0 on success, or -1 if gamma ramps are unsupported. slouken@3407: * slouken@3407: * \sa SDL_SetGammaRamp() slouken@0: */ slouken@1895: extern DECLSPEC int SDLCALL SDL_GetGammaRamp(Uint16 * red, Uint16 * green, slouken@1895: Uint16 * blue); slouken@0: slouken@1895: slouken@1895: /** slouken@3407: * \brief Create a window with the specified position, dimensions, and flags. slouken@3407: * slouken@3407: * \param title The title of the window, in UTF-8 encoding. slouken@3407: * \param x The x position of the window, ::SDL_WINDOWPOS_CENTERED, or slouken@3407: * ::SDL_WINDOWPOS_UNDEFINED. slouken@3407: * \param y The y position of the window, ::SDL_WINDOWPOS_CENTERED, or slouken@3407: * ::SDL_WINDOWPOS_UNDEFINED. slouken@3407: * \param w The width of the window. slouken@3407: * \param h The height of the window. slouken@3407: * \param flags The flags for the window, a mask of any of the following: slouken@3407: * ::SDL_WINDOW_FULLSCREEN, ::SDL_WINDOW_OPENGL, slouken@3407: * ::SDL_WINDOW_SHOWN, ::SDL_WINDOW_BORDERLESS, slouken@3407: * ::SDL_WINDOW_RESIZABLE, ::SDL_WINDOW_MAXIMIZED, slouken@3407: * ::SDL_WINDOW_MINIMIZED, ::SDL_WINDOW_INPUT_GRABBED. slouken@3407: * slouken@3407: * \return The id of the window created, or zero if window creation failed. slouken@3407: * slouken@3407: * \sa SDL_DestroyWindow() slouken@0: */ slouken@1895: extern DECLSPEC SDL_WindowID SDLCALL SDL_CreateWindow(const char *title, slouken@1895: int x, int y, int w, slouken@1895: int h, Uint32 flags); slouken@0: slouken@1895: /** slouken@3493: * \brief Create an SDL window from an existing native window. slouken@3407: * slouken@3407: * \param data A pointer to driver-dependent window creation data slouken@3407: * slouken@3407: * \return The id of the window created, or zero if window creation failed. slouken@3407: * slouken@3407: * \sa SDL_DestroyWindow() slouken@0: */ slouken@1895: extern DECLSPEC SDL_WindowID SDLCALL SDL_CreateWindowFrom(const void *data); slouken@1895: slouken@1895: /** slouken@3407: * \brief Get the window flags. slouken@1895: */ slouken@1895: extern DECLSPEC Uint32 SDLCALL SDL_GetWindowFlags(SDL_WindowID windowID); slouken@1895: slouken@1895: /** slouken@3407: * \brief Set the title of the window, in UTF-8 format. slouken@3407: * slouken@3407: * \sa SDL_GetWindowTitle() slouken@1895: */ slouken@1895: extern DECLSPEC void SDLCALL SDL_SetWindowTitle(SDL_WindowID windowID, slouken@1895: const char *title); slouken@1895: slouken@1895: /** slouken@3407: * \brief Get the title of the window, in UTF-8 format. slouken@3407: * slouken@3407: * \sa SDL_SetWindowTitle() slouken@1895: */ slouken@1895: extern DECLSPEC const char *SDLCALL SDL_GetWindowTitle(SDL_WindowID windowID); slouken@1895: slouken@1895: /** slouken@3407: * \brief Set the icon of the window. slouken@3407: * slouken@3407: * \param icon The icon for the window. slouken@1895: */ slouken@2990: extern DECLSPEC void SDLCALL SDL_SetWindowIcon(SDL_WindowID windowID, slouken@2990: SDL_Surface * icon); slouken@1895: slouken@1895: /** slouken@3407: * \brief Associate an arbitrary pointer with the window. slouken@3407: * slouken@3407: * \sa SDL_GetWindowData() slouken@1895: */ slouken@1895: extern DECLSPEC void SDLCALL SDL_SetWindowData(SDL_WindowID windowID, slouken@1895: void *userdata); slouken@1895: slouken@1895: /** slouken@3407: * \brief Retrieve the data pointer associated with the window. slouken@3407: * slouken@3407: * \sa SDL_SetWindowData() slouken@1895: */ slouken@1895: extern DECLSPEC void *SDLCALL SDL_GetWindowData(SDL_WindowID windowID); slouken@1895: slouken@1895: /** slouken@3407: * \brief Set the position of the window. slouken@3407: * slouken@3407: * \param windowID The window to reposition. slouken@3407: * \param x The x coordinate of the window, ::SDL_WINDOWPOS_CENTERED, or slouken@3407: ::SDL_WINDOWPOS_UNDEFINED. slouken@3407: * \param y The y coordinate of the window, ::SDL_WINDOWPOS_CENTERED, or slouken@3407: ::SDL_WINDOWPOS_UNDEFINED. slouken@3407: * slouken@3407: * \note The window coordinate origin is the upper left of the display. slouken@3407: * slouken@3407: * \sa SDL_GetWindowPosition() slouken@1895: */ slouken@1895: extern DECLSPEC void SDLCALL SDL_SetWindowPosition(SDL_WindowID windowID, slouken@1895: int x, int y); slouken@1895: slouken@1895: /** slouken@3407: * \brief Get the position of the window. slouken@3407: * slouken@3407: * \sa SDL_SetWindowPosition() slouken@1895: */ slouken@1895: extern DECLSPEC void SDLCALL SDL_GetWindowPosition(SDL_WindowID windowID, slouken@1895: int *x, int *y); slouken@1895: slouken@1895: /** slouken@3407: * \brief Set the size of the window's client area. slouken@3407: * slouken@3407: * \note You can't change the size of a fullscreen window, it automatically slouken@3407: * matches the size of the display mode. slouken@3407: * slouken@3407: * \sa SDL_GetWindowSize() slouken@1895: */ slouken@1895: extern DECLSPEC void SDLCALL SDL_SetWindowSize(SDL_WindowID windowID, int w, slouken@1895: int h); slouken@1895: slouken@1895: /** slouken@3407: * \brief Get the size of the window's client area. slouken@3407: * slouken@3407: * \sa SDL_SetWindowSize() slouken@1895: */ slouken@1895: extern DECLSPEC void SDLCALL SDL_GetWindowSize(SDL_WindowID windowID, int *w, slouken@1895: int *h); slouken@1895: slouken@1895: /** slouken@3407: * \brief Show the window. slouken@3407: * slouken@3407: * \sa SDL_HideWindow() slouken@1895: */ slouken@1895: extern DECLSPEC void SDLCALL SDL_ShowWindow(SDL_WindowID windowID); slouken@1895: slouken@1895: /** slouken@3407: * \brief Hide the window. slouken@3407: * slouken@3407: * \sa SDL_ShowWindow() slouken@1895: */ slouken@1895: extern DECLSPEC void SDLCALL SDL_HideWindow(SDL_WindowID windowID); slouken@1895: slouken@1895: /** slouken@3407: * \brief Raise the window above other windows and set the input focus. slouken@1895: */ slouken@1895: extern DECLSPEC void SDLCALL SDL_RaiseWindow(SDL_WindowID windowID); slouken@1895: slouken@1895: /** slouken@3407: * \brief Make the window as large as possible. slouken@3407: * slouken@3407: * \sa SDL_RestoreWindow() slouken@1895: */ slouken@1895: extern DECLSPEC void SDLCALL SDL_MaximizeWindow(SDL_WindowID windowID); slouken@1895: slouken@1895: /** slouken@3407: * \brief Minimize the window to an iconic representation. slouken@3407: * slouken@3407: * \sa SDL_RestoreWindow() slouken@1895: */ slouken@1895: extern DECLSPEC void SDLCALL SDL_MinimizeWindow(SDL_WindowID windowID); slouken@1895: slouken@1895: /** slouken@3407: * \brief Restore the size and position of a minimized or maximized window. slouken@3407: * slouken@3407: * \sa SDL_MaximizeWindow() slouken@3407: * \sa SDL_MinimizeWindow() slouken@1895: */ slouken@1895: extern DECLSPEC void SDLCALL SDL_RestoreWindow(SDL_WindowID windowID); slouken@1895: slouken@1895: /** slouken@3407: * \brief Set the window's fullscreen state. slouken@3407: * slouken@3407: * \return 0 on success, or -1 if setting the display mode failed. slouken@3407: * slouken@3522: * \sa SDL_SetWindowDisplayMode() slouken@3522: * \sa SDL_GetWindowDisplayMode() slouken@1895: */ slouken@1895: extern DECLSPEC int SDLCALL SDL_SetWindowFullscreen(SDL_WindowID windowID, slouken@1895: int fullscreen); slouken@1895: slouken@1895: /** slouken@3407: * \brief Set the window's input grab mode. slouken@3407: * slouken@3407: * \param mode This is 1 to grab input, and 0 to release input. slouken@3407: * slouken@3407: * \sa SDL_GetWindowGrab() slouken@1895: */ slouken@1895: extern DECLSPEC void SDLCALL SDL_SetWindowGrab(SDL_WindowID windowID, slouken@1895: int mode); slouken@1895: slouken@1895: /** slouken@3407: * \brief Get the window's input grab mode. slouken@3407: * slouken@3407: * \return This returns 1 if input is grabbed, and 0 otherwise. slouken@3407: * slouken@3407: * \sa SDL_SetWindowGrab() slouken@1895: */ slouken@1895: extern DECLSPEC int SDLCALL SDL_GetWindowGrab(SDL_WindowID windowID); slouken@1895: slouken@1895: /** slouken@3407: * \brief Get driver specific information about a window. slouken@3407: * slouken@3407: * \note Include SDL_syswm.h for the declaration of SDL_SysWMinfo. slouken@1895: */ slouken@1895: struct SDL_SysWMinfo; slouken@1895: extern DECLSPEC SDL_bool SDLCALL SDL_GetWindowWMInfo(SDL_WindowID windowID, slouken@1895: struct SDL_SysWMinfo slouken@1895: *info); slouken@1895: slouken@1895: /** slouken@3407: * \brief Destroy a window. slouken@1895: */ slouken@1895: extern DECLSPEC void SDLCALL SDL_DestroyWindow(SDL_WindowID windowID); slouken@1895: slouken@1895: /** slouken@3407: * \brief Get the number of 2D rendering drivers available for the current slouken@3407: * display. slouken@3407: * slouken@3407: * A render driver is a set of code that handles rendering and texture slouken@3407: * management on a particular display. Normally there is only one, but slouken@3407: * some drivers may have several available with different capabilities. slouken@3407: * slouken@3407: * \sa SDL_GetRenderDriverInfo() slouken@3407: * \sa SDL_CreateRenderer() slouken@1895: */ slouken@1969: extern DECLSPEC int SDLCALL SDL_GetNumRenderDrivers(void); slouken@1895: slouken@1895: /** slouken@3407: * \brief Get information about a specific 2D rendering driver for the current slouken@3407: * display. slouken@3407: * slouken@3407: * \param index The index of the driver to query information about. slouken@3407: * \param info A pointer to an SDL_RendererInfo struct to be filled with slouken@3407: * information on the rendering driver. slouken@3407: * slouken@3407: * \return 0 on success, -1 if the index was out of range. slouken@3407: * slouken@3407: * \sa SDL_CreateRenderer() slouken@1895: */ slouken@1969: extern DECLSPEC int SDLCALL SDL_GetRenderDriverInfo(int index, slouken@1969: SDL_RendererInfo * info); slouken@1895: slouken@1895: /** slouken@3407: * \brief Create and make active a 2D rendering context for a window. slouken@3407: * slouken@3492: * \param windowID The window where rendering is displayed. slouken@3407: * \param index The index of the rendering driver to initialize, or -1 to slouken@3407: * initialize the first one supporting the requested flags. slouken@3407: * \param flags ::SDL_RendererFlags. slouken@3407: * slouken@3407: * \return 0 on success, -1 if there was an error creating the renderer. slouken@3407: * slouken@3407: * \sa SDL_SelectRenderer() slouken@3407: * \sa SDL_GetRendererInfo() slouken@3407: * \sa SDL_DestroyRenderer() slouken@1895: */ slouken@1895: extern DECLSPEC int SDLCALL SDL_CreateRenderer(SDL_WindowID windowID, slouken@1895: int index, Uint32 flags); slouken@1895: slouken@1895: /** slouken@3407: * \brief Select the rendering context for a particular window. slouken@3407: * slouken@3407: * \return 0 on success, -1 if the selected window doesn't have a slouken@3407: * rendering context. slouken@1895: */ slouken@1895: extern DECLSPEC int SDLCALL SDL_SelectRenderer(SDL_WindowID windowID); slouken@1895: slouken@1895: /** slouken@3407: * \brief Get information about the current rendering context. slouken@1969: */ slouken@1969: extern DECLSPEC int SDLCALL SDL_GetRendererInfo(SDL_RendererInfo * info); slouken@1969: slouken@1969: /** slouken@3407: * \brief Create a texture for the current rendering context. slouken@3407: * slouken@3407: * \param format The format of the texture. slouken@3407: * \param access One of the enumerated values in ::SDL_TextureAccess. slouken@3407: * \param w The width of the texture in pixels. slouken@3407: * \param h The height of the texture in pixels. slouken@3407: * slouken@3407: * \return The created texture is returned, or 0 if no rendering context was slouken@3407: * active, the format was unsupported, or the width or height were out slouken@3407: * of range. slouken@3407: * slouken@3407: * \sa SDL_QueryTexture() slouken@3407: * \sa SDL_DestroyTexture() slouken@1895: */ slouken@1895: extern DECLSPEC SDL_TextureID SDLCALL SDL_CreateTexture(Uint32 format, slouken@1895: int access, int w, slouken@1895: int h); slouken@1895: slouken@1895: /** slouken@3407: * \brief Create a texture from an existing surface. slouken@3407: * slouken@3407: * \param format The format of the texture, or 0 to pick an appropriate format. slouken@3407: * \param surface The surface containing pixel data used to fill the texture. slouken@3407: * slouken@3407: * \return The created texture is returned, or 0 if no rendering context was slouken@3407: * active, the format was unsupported, or the surface width or height slouken@3407: * were out of range. slouken@3407: * slouken@3407: * \note The surface is not modified or freed by this function. slouken@3407: * slouken@3407: * \sa SDL_QueryTexture() slouken@3407: * \sa SDL_DestroyTexture() slouken@1895: */ slouken@1895: extern DECLSPEC SDL_TextureID SDLCALL SDL_CreateTextureFromSurface(Uint32 slouken@1895: format, slouken@1895: SDL_Surface slouken@1895: * surface); slouken@1895: slouken@1895: /** slouken@3407: * \brief Query the attributes of a texture slouken@3407: * slouken@3407: * \param textureID A texture to be queried. slouken@3407: * \param format A pointer filled in with the raw format of the texture. The slouken@3407: * actual format may differ, but pixel transfers will use this slouken@3407: * format. slouken@3407: * \param access A pointer filled in with the actual access to the texture. slouken@3407: * \param w A pointer filled in with the width of the texture in pixels. slouken@3407: * \param h A pointer filled in with the height of the texture in pixels. slouken@3407: * slouken@3407: * \return 0 on success, or -1 if the texture is not valid. slouken@1895: */ slouken@1895: extern DECLSPEC int SDLCALL SDL_QueryTexture(SDL_TextureID textureID, slouken@1895: Uint32 * format, int *access, slouken@1895: int *w, int *h); slouken@1895: slouken@1895: /** slouken@3407: * \brief Query the pixels of a texture, if the texture does not need to be slouken@3407: * locked for pixel access. slouken@3407: * slouken@3407: * \param textureID A texture to be queried, which was created with slouken@3407: * ::SDL_TEXTUREACCESS_STREAMING. slouken@3407: * \param pixels A pointer filled with a pointer to the pixels for the slouken@3407: * texture. slouken@3407: * \param pitch A pointer filled in with the pitch of the pixel data. slouken@3407: * slouken@3407: * \return 0 on success, or -1 if the texture is not valid, or must be locked slouken@3407: * for pixel access. slouken@1895: */ slouken@1895: extern DECLSPEC int SDLCALL SDL_QueryTexturePixels(SDL_TextureID textureID, slouken@1895: void **pixels, int *pitch); slouken@1895: slouken@1895: /** slouken@3407: * \brief Set the color palette of an indexed texture. slouken@3407: * slouken@3407: * \param textureID The texture to update. slouken@3407: * \param colors The array of RGB color data. slouken@3407: * \param firstcolor The first index to update. slouken@3407: * \param ncolors The number of palette entries to fill with the color data. slouken@3407: * slouken@3407: * \return 0 on success, or -1 if the texture is not valid or not an indexed slouken@3407: * texture. slouken@1895: */ slouken@1895: extern DECLSPEC int SDLCALL SDL_SetTexturePalette(SDL_TextureID textureID, slouken@1895: const SDL_Color * colors, slouken@1895: int firstcolor, slouken@1895: int ncolors); slouken@1895: slouken@1895: /** slouken@3407: * \brief Get the color palette from an indexed texture if it has one. slouken@3407: * slouken@3407: * \param textureID The texture to update. slouken@3407: * \param colors The array to fill with RGB color data. slouken@3407: * \param firstcolor The first index to retrieve. slouken@3407: * \param ncolors The number of palette entries to retrieve. slouken@3407: * slouken@3407: * \return 0 on success, or -1 if the texture is not valid or not an indexed slouken@3407: * texture. slouken@1895: */ slouken@1895: extern DECLSPEC int SDLCALL SDL_GetTexturePalette(SDL_TextureID textureID, slouken@1895: SDL_Color * colors, slouken@1895: int firstcolor, slouken@1895: int ncolors); slouken@1895: slouken@1895: /** slouken@3407: * \brief Set an additional color value used in render copy operations. slouken@3407: * slouken@3407: * \param textureID The texture to update. slouken@3407: * \param r The red source color value multiplied into copy operations. slouken@3407: * \param g The green source color value multiplied into copy operations. slouken@3407: * \param b The blue source color value multiplied into copy operations. slouken@3407: * slouken@3407: * \return 0 on success, or -1 if the texture is not valid or color modulation slouken@3407: * is not supported. slouken@3407: * slouken@3407: * \sa SDL_GetTextureColorMod() slouken@1985: */ slouken@1985: extern DECLSPEC int SDLCALL SDL_SetTextureColorMod(SDL_TextureID textureID, slouken@1985: Uint8 r, Uint8 g, Uint8 b); slouken@1985: slouken@1985: slouken@1985: /** slouken@3407: * \brief Get the additional color value used in render copy operations. slouken@3407: * slouken@3407: * \param textureID The texture to query. slouken@3407: * \param r A pointer filled in with the source red color value. slouken@3407: * \param g A pointer filled in with the source green color value. slouken@3407: * \param b A pointer filled in with the source blue color value. slouken@3407: * slouken@3407: * \return 0 on success, or -1 if the texture is not valid. slouken@3407: * slouken@3407: * \sa SDL_SetTextureColorMod() slouken@1985: */ slouken@1985: extern DECLSPEC int SDLCALL SDL_GetTextureColorMod(SDL_TextureID textureID, slouken@1985: Uint8 * r, Uint8 * g, slouken@1985: Uint8 * b); slouken@1985: slouken@1985: /** slouken@3407: * \brief Set an additional alpha value used in render copy operations. slouken@3407: * slouken@3407: * \param textureID The texture to update. slouken@3407: * \param alpha The source alpha value multiplied into copy operations. slouken@3407: * slouken@3407: * \return 0 on success, or -1 if the texture is not valid or alpha modulation slouken@3407: * is not supported. slouken@3407: * slouken@3407: * \sa SDL_GetTextureAlphaMod() slouken@1985: */ slouken@1985: extern DECLSPEC int SDLCALL SDL_SetTextureAlphaMod(SDL_TextureID textureID, slouken@1985: Uint8 alpha); slouken@1985: slouken@1985: /** slouken@3407: * \brief Get the additional alpha value used in render copy operations. slouken@3407: * slouken@3407: * \param textureID The texture to query. slouken@3407: * \param alpha A pointer filled in with the source alpha value. slouken@3407: * slouken@3407: * \return 0 on success, or -1 if the texture is not valid. slouken@3407: * slouken@3407: * \sa SDL_SetTextureAlphaMod() slouken@1985: */ slouken@1985: extern DECLSPEC int SDLCALL SDL_GetTextureAlphaMod(SDL_TextureID textureID, slouken@1985: Uint8 * alpha); slouken@1985: slouken@1985: /** slouken@3407: * \brief Set the blend mode used for texture copy operations. slouken@3407: * slouken@3407: * \param textureID The texture to update. slouken@3407: * \param blendMode ::SDL_BlendMode to use for texture blending. slouken@3407: * slouken@3407: * \return 0 on success, or -1 if the texture is not valid or the blend mode is slouken@3407: * not supported. slouken@3407: * slouken@3407: * \note If the blend mode is not supported, the closest supported mode is slouken@3407: * chosen. slouken@3407: * slouken@3407: * \sa SDL_GetTextureBlendMode() slouken@1985: */ slouken@1985: extern DECLSPEC int SDLCALL SDL_SetTextureBlendMode(SDL_TextureID textureID, slouken@1985: int blendMode); slouken@1985: slouken@1985: /** slouken@3407: * \brief Get the blend mode used for texture copy operations. slouken@3407: * slouken@3407: * \param textureID The texture to query. slouken@3407: * \param blendMode A pointer filled in with the current blend mode. slouken@3407: * slouken@3407: * \return 0 on success, or -1 if the texture is not valid. slouken@3407: * slouken@3407: * \sa SDL_SetTextureBlendMode() slouken@1985: */ slouken@1985: extern DECLSPEC int SDLCALL SDL_GetTextureBlendMode(SDL_TextureID textureID, slouken@1985: int *blendMode); slouken@1985: slouken@1985: /** slouken@3407: * \brief Set the scale mode used for texture copy operations. slouken@3407: * slouken@3407: * \param textureID The texture to update. slouken@3407: * \param scaleMode ::SDL_TextureScaleMode to use for texture scaling. slouken@3407: * slouken@3407: * \return 0 on success, or -1 if the texture is not valid or the scale mode is slouken@3407: * not supported. slouken@3407: * slouken@3407: * \note If the scale mode is not supported, the closest supported mode is slouken@3407: * chosen. slouken@3407: * slouken@3407: * \sa SDL_GetTextureScaleMode() slouken@1985: */ slouken@1985: extern DECLSPEC int SDLCALL SDL_SetTextureScaleMode(SDL_TextureID textureID, slouken@1985: int scaleMode); slouken@1985: slouken@1985: /** slouken@3407: * \brief Get the scale mode used for texture copy operations. slouken@3407: * slouken@3407: * \param textureID The texture to query. slouken@3407: * \param scaleMode A pointer filled in with the current scale mode. slouken@3407: * slouken@3407: * \return 0 on success, or -1 if the texture is not valid. slouken@3407: * slouken@3407: * \sa SDL_SetTextureScaleMode() slouken@1985: */ slouken@1985: extern DECLSPEC int SDLCALL SDL_GetTextureScaleMode(SDL_TextureID textureID, slouken@1985: int *scaleMode); slouken@1985: slouken@1985: /** slouken@3407: * \brief Update the given texture rectangle with new pixel data. slouken@3407: * slouken@3407: * \param textureID The texture to update slouken@3407: * \param rect A pointer to the rectangle of pixels to update, or NULL to slouken@3407: * update the entire texture. slouken@3407: * \param pixels The raw pixel data. slouken@3407: * \param pitch The number of bytes between rows of pixel data. slouken@3407: * slouken@3407: * \return 0 on success, or -1 if the texture is not valid. slouken@3407: * slouken@3407: * \note This is a fairly slow function. slouken@1895: */ slouken@1895: extern DECLSPEC int SDLCALL SDL_UpdateTexture(SDL_TextureID textureID, slouken@1895: const SDL_Rect * rect, slouken@1895: const void *pixels, int pitch); slouken@1895: slouken@1895: /** slouken@3407: * \brief Lock a portion of the texture for pixel access. slouken@3407: * slouken@3407: * \param textureID The texture to lock for access, which was created with slouken@3407: * ::SDL_TEXTUREACCESS_STREAMING. slouken@3407: * \param rect A pointer to the rectangle to lock for access. If the rect slouken@3407: * is NULL, the entire texture will be locked. slouken@3407: * \param markDirty If this is nonzero, the locked area will be marked dirty slouken@3407: * when the texture is unlocked. slouken@3407: * \param pixels This is filled in with a pointer to the locked pixels, slouken@3407: * appropriately offset by the locked area. slouken@3407: * \param pitch This is filled in with the pitch of the locked pixels. slouken@3407: * slouken@3407: * \return 0 on success, or -1 if the texture is not valid or was created with slouken@3407: * ::SDL_TEXTUREACCESS_STATIC. slouken@3407: * slouken@3407: * \sa SDL_DirtyTexture() slouken@3407: * \sa SDL_UnlockTexture() slouken@1895: */ slouken@1895: extern DECLSPEC int SDLCALL SDL_LockTexture(SDL_TextureID textureID, slouken@1895: const SDL_Rect * rect, slouken@1895: int markDirty, void **pixels, slouken@1895: int *pitch); slouken@1895: slouken@1895: /** slouken@3407: * \brief Unlock a texture, uploading the changes to video memory, if needed. slouken@3407: * slouken@3407: * \sa SDL_LockTexture() slouken@3407: * \sa SDL_DirtyTexture() slouken@1895: */ slouken@1895: extern DECLSPEC void SDLCALL SDL_UnlockTexture(SDL_TextureID textureID); slouken@1895: slouken@1895: /** slouken@3407: * \brief Mark the specified rectangles of the texture as dirty. slouken@3407: * slouken@3407: * \param textureID The texture to mark dirty, which was created with slouken@3407: * ::SDL_TEXTUREACCESS_STREAMING. slouken@3407: * \param numrects The number of rectangles pointed to by rects. slouken@3407: * \param rects The pointer to an array of dirty rectangles. slouken@3407: * slouken@3407: * \sa SDL_LockTexture() slouken@3407: * \sa SDL_UnlockTexture() slouken@1895: */ slouken@1895: extern DECLSPEC void SDLCALL SDL_DirtyTexture(SDL_TextureID textureID, slouken@1895: int numrects, slouken@1895: const SDL_Rect * rects); slouken@1895: slouken@1895: /** slouken@3407: * \brief Set the color used for drawing operations (Fill and Line). slouken@3407: * slouken@3407: * \param r The red value used to draw on the rendering target. slouken@3407: * \param g The green value used to draw on the rendering target. slouken@3407: * \param b The blue value used to draw on the rendering target. slouken@3407: * \param a The alpha value used to draw on the rendering target, usually slouken@3407: * ::SDL_ALPHA_OPAQUE (255). slouken@3407: * slouken@3407: * \return 0 on success, or -1 if there is no rendering context current. slouken@2884: */ slouken@2884: extern DECLSPEC int SDL_SetRenderDrawColor(Uint8 r, Uint8 g, Uint8 b, slouken@2884: Uint8 a); slouken@2884: slouken@2884: /** slouken@3407: * \brief Get the color used for drawing operations (Fill and Line). slouken@3407: * slouken@3407: * \param r A pointer to the red value used to draw on the rendering target. slouken@3407: * \param g A pointer to the green value used to draw on the rendering target. slouken@3407: * \param b A pointer to the blue value used to draw on the rendering target. slouken@3407: * \param a A pointer to the alpha value used to draw on the rendering target, slouken@3407: * usually ::SDL_ALPHA_OPAQUE (255). slouken@3407: * slouken@3407: * \return 0 on success, or -1 if there is no rendering context current. slouken@2884: */ slouken@2884: extern DECLSPEC int SDL_GetRenderDrawColor(Uint8 * r, Uint8 * g, Uint8 * b, slouken@2884: Uint8 * a); slouken@2884: slouken@2884: /** slouken@3407: * \brief Set the blend mode used for drawing operations (Fill and Line). slouken@3407: * slouken@3407: * \param blendMode ::SDL_BlendMode to use for blending. slouken@3407: * slouken@3407: * \return 0 on success, or -1 if there is no rendering context current. slouken@3407: * slouken@3407: * \note If the blend mode is not supported, the closest supported mode is slouken@3407: * chosen. slouken@3407: * slouken@3407: * \sa SDL_GetRenderDrawBlendMode() slouken@2884: */ slouken@2884: extern DECLSPEC int SDLCALL SDL_SetRenderDrawBlendMode(int blendMode); slouken@2884: slouken@2884: /** slouken@3407: * \brief Get the blend mode used for drawing operations. slouken@3407: * slouken@3407: * \param blendMode A pointer filled in with the current blend mode. slouken@3407: * slouken@3407: * \return 0 on success, or -1 if there is no rendering context current. slouken@3407: * slouken@3407: * \sa SDL_SetRenderDrawBlendMode() slouken@2884: */ slouken@2884: extern DECLSPEC int SDLCALL SDL_GetRenderDrawBlendMode(int *blendMode); slouken@2884: slouken@2884: /** slouken@3407: * \brief Draw a point on the current rendering target. slouken@3407: * slouken@3407: * \param x The x coordinate of the point. slouken@3407: * \param y The y coordinate of the point. slouken@3407: * slouken@3407: * \return 0 on success, or -1 if there is no rendering context current. slouken@2901: */ slouken@2901: extern DECLSPEC int SDLCALL SDL_RenderPoint(int x, int y); slouken@2901: slouken@2901: /** slouken@3536: * \brief Draw some number of points on the current rendering target. slouken@3536: * slouken@3536: * \param points The points to draw slouken@3536: * \param count The number of points to draw slouken@3536: * slouken@3536: * \return 0 on success, or -1 if there is no rendering context current. slouken@3536: */ slouken@3536: extern DECLSPEC int SDLCALL SDL_RenderPoints(const SDL_Point * points, slouken@3536: int count); slouken@3536: slouken@3536: /** slouken@3407: * \brief Draw a line on the current rendering target. slouken@3407: * slouken@3407: * \param x1 The x coordinate of the start point. slouken@3407: * \param y1 The y coordinate of the start point. slouken@3407: * \param x2 The x coordinate of the end point. slouken@3407: * \param y2 The y coordinate of the end point. slouken@3407: * slouken@3407: * \return 0 on success, or -1 if there is no rendering context current. slouken@2884: */ slouken@2884: extern DECLSPEC int SDLCALL SDL_RenderLine(int x1, int y1, int x2, int y2); slouken@2884: slouken@2884: /** slouken@3536: * \brief Draw a series of connected lines on the current rendering target. slouken@3536: * slouken@3536: * \param points The points along the lines slouken@3536: * \param count The number of points, drawing count-1 lines slouken@3536: * slouken@3536: * \return 0 on success, or -1 if there is no rendering context current. slouken@3536: */ slouken@3536: extern DECLSPEC int SDLCALL SDL_RenderLines(const SDL_Point * points, slouken@3536: int count); slouken@3536: slouken@3536: /** slouken@3407: * \brief Fill the current rendering target with the drawing color. slouken@3407: * slouken@3407: * \param rect A pointer to the destination rectangle, or NULL for the entire slouken@3407: * rendering target. slouken@3407: * slouken@3407: * \return 0 on success, or -1 if there is no rendering context current. slouken@1895: */ slouken@3536: extern DECLSPEC int SDLCALL SDL_RenderRect(const SDL_Rect * rect); slouken@3536: slouken@3536: /** slouken@3536: * \brief Fill some number of rectangles in the current rendering target with the drawing color. slouken@3536: * slouken@3536: * \param rects A pointer to an array of destination rectangles. slouken@3536: * \param count The number of rectangles. slouken@3536: * slouken@3536: * \return 0 on success, or -1 if there is no rendering context current. slouken@3536: */ slouken@3536: extern DECLSPEC int SDLCALL SDL_RenderRects(const SDL_Rect ** rect, int count); slouken@1895: slouken@1895: /** slouken@3407: * \brief Copy a portion of the texture to the current rendering target. slouken@3407: * slouken@3407: * \param textureID The source texture. slouken@3407: * \param srcrect A pointer to the source rectangle, or NULL for the entire slouken@3407: * texture. slouken@3407: * \param dstrect A pointer to the destination rectangle, or NULL for the slouken@3407: * entire rendering target. slouken@3407: * slouken@3407: * \return 0 on success, or -1 if there is no rendering context current, or the slouken@3407: * driver doesn't support the requested operation. slouken@1895: */ slouken@1895: extern DECLSPEC int SDLCALL SDL_RenderCopy(SDL_TextureID textureID, slouken@1895: const SDL_Rect * srcrect, slouken@1985: const SDL_Rect * dstrect); slouken@1895: slouken@1895: /** slouken@3407: * \brief Read pixels from the current rendering target. slouken@3407: * slouken@3407: * \param rect A pointer to the rectangle to read, or NULL for the entire slouken@3407: * render target. slouken@3435: * \param format The desired format of the pixel data, or 0 to use the format slouken@3435: * of the rendering target slouken@3435: * \param pixels A pointer to be filled in with the pixel data slouken@3407: * \param pitch The pitch of the pixels parameter. slouken@3407: * slouken@3407: * \return 0 on success, or -1 if pixel reading is not supported. slouken@3407: * slouken@3407: * \warning This is a very slow operation, and should not be used frequently. slouken@1895: */ slouken@1895: extern DECLSPEC int SDLCALL SDL_RenderReadPixels(const SDL_Rect * rect, slouken@3435: Uint32 format, slouken@1895: void *pixels, int pitch); slouken@1895: slouken@1895: /** slouken@3407: * \brief Write pixels to the current rendering target. slouken@3407: * slouken@3407: * \param rect A pointer to the rectangle to write, or NULL for the entire slouken@3407: * render target. slouken@3435: * \param format The format of the pixel data, or 0 to use the format slouken@3435: * of the rendering target slouken@3407: * \param pixels A pointer to the pixel data to write. slouken@3407: * \param pitch The pitch of the pixels parameter. slouken@3407: * slouken@3407: * \return 0 on success, or -1 if pixel writing is not supported. slouken@3407: * slouken@3407: * \warning This is a very slow operation, and should not be used frequently. slouken@1895: */ slouken@1895: extern DECLSPEC int SDLCALL SDL_RenderWritePixels(const SDL_Rect * rect, slouken@3435: Uint32 format, slouken@1895: const void *pixels, slouken@1895: int pitch); slouken@1895: slouken@1895: /** slouken@3407: * \brief Update the screen with rendering performed. slouken@1895: */ slouken@1895: extern DECLSPEC void SDLCALL SDL_RenderPresent(void); slouken@1895: slouken@1895: /** slouken@3407: * \brief Destroy the specified texture. slouken@3407: * slouken@3407: * \sa SDL_CreateTexture() slouken@3407: * \sa SDL_CreateTextureFromSurface() slouken@1895: */ slouken@1895: extern DECLSPEC void SDLCALL SDL_DestroyTexture(SDL_TextureID textureID); slouken@1895: slouken@1895: /** slouken@3407: * \brief Destroy the rendering context for a window and free associated slouken@3407: * textures. slouken@3407: * slouken@3407: * \sa SDL_CreateRenderer() slouken@1895: */ slouken@1895: extern DECLSPEC void SDLCALL SDL_DestroyRenderer(SDL_WindowID windowID); slouken@0: slouken@3025: /** slouken@3407: * \brief Returns whether the screensaver is currently enabled (default off). slouken@3407: * slouken@3407: * \sa SDL_EnableScreenSaver() slouken@3407: * \sa SDL_DisableScreenSaver() slouken@3025: */ couriersud@3033: extern DECLSPEC SDL_bool SDLCALL SDL_IsScreenSaverEnabled(void); slouken@3025: slouken@3025: /** slouken@3407: * \brief Allow the screen to be blanked by a screensaver slouken@3407: * slouken@3407: * \sa SDL_IsScreenSaverEnabled() slouken@3407: * \sa SDL_DisableScreenSaver() slouken@3025: */ couriersud@3033: extern DECLSPEC void SDLCALL SDL_EnableScreenSaver(void); slouken@3025: slouken@3025: /** slouken@3407: * \brief Prevent the screen from being blanked by a screensaver slouken@3407: * slouken@3407: * \sa SDL_IsScreenSaverEnabled() slouken@3407: * \sa SDL_EnableScreenSaver() slouken@3025: */ couriersud@3033: extern DECLSPEC void SDLCALL SDL_DisableScreenSaver(void); slouken@3025: slouken@0: slouken@3407: /** slouken@3407: * \name OpenGL support functions slouken@3407: */ slouken@3407: /*@{*/ slouken@0: slouken@1895: /** slouken@3407: * \brief Dynamically load an OpenGL library. slouken@3407: * slouken@3407: * \param path The platform dependent OpenGL library name, or NULL to open the slouken@3407: * default OpenGL library. slouken@3407: * slouken@3407: * \return 0 on success, or -1 if the library couldn't be loaded. slouken@3407: * slouken@3407: * This should be done after initializing the video driver, but before slouken@3407: * creating any OpenGL windows. If no OpenGL library is loaded, the default slouken@3407: * library will be loaded upon creation of the first OpenGL window. slouken@3407: * slouken@3407: * \note If you do this, you need to retrieve all of the GL functions used in slouken@3407: * your program from the dynamic library using SDL_GL_GetProcAddress(). slouken@3407: * slouken@3407: * \sa SDL_GL_GetProcAddress() slouken@3407: * \sa SDL_GL_UnloadLibrary() slouken@0: */ slouken@337: extern DECLSPEC int SDLCALL SDL_GL_LoadLibrary(const char *path); slouken@0: slouken@1895: /** slouken@3407: * \brief Get the address of an OpenGL function. slouken@0: */ slouken@1895: extern DECLSPEC void *SDLCALL SDL_GL_GetProcAddress(const char *proc); slouken@0: slouken@1895: /** slouken@3407: * \brief Unload the OpenGL library previously loaded by SDL_GL_LoadLibrary(). slouken@3407: * slouken@3407: * \sa SDL_GL_LoadLibrary() slouken@3057: */ slouken@3057: extern DECLSPEC void SDLCALL SDL_GL_UnloadLibrary(void); slouken@3057: slouken@3057: /** slouken@3407: * \brief Return true if an OpenGL extension is supported for the current slouken@3407: * context. slouken@1926: */ slouken@1926: extern DECLSPEC SDL_bool SDLCALL SDL_GL_ExtensionSupported(const char slouken@1926: *extension); slouken@1926: slouken@1926: /** slouken@3407: * \brief Set an OpenGL window attribute before window creation. slouken@0: */ slouken@337: extern DECLSPEC int SDLCALL SDL_GL_SetAttribute(SDL_GLattr attr, int value); slouken@0: slouken@1895: /** slouken@3407: * \brief Get the actual value for an attribute from the current context. slouken@0: */ slouken@1936: extern DECLSPEC int SDLCALL SDL_GL_GetAttribute(SDL_GLattr attr, int *value); slouken@0: slouken@1895: /** slouken@3407: * \brief Create an OpenGL context for use with an OpenGL window, and make it slouken@3407: * current. slouken@3407: * slouken@3407: * \sa SDL_GL_DeleteContext() slouken@1895: */ slouken@1895: extern DECLSPEC SDL_GLContext SDLCALL SDL_GL_CreateContext(SDL_WindowID slouken@1895: windowID); slouken@1895: slouken@1895: /** slouken@3407: * \brief Set up an OpenGL context for rendering into an OpenGL window. slouken@3407: * slouken@3407: * \note The context must have been created with a compatible window. slouken@1895: */ slouken@1895: extern DECLSPEC int SDLCALL SDL_GL_MakeCurrent(SDL_WindowID windowID, slouken@1895: SDL_GLContext context); slouken@1895: slouken@1895: /** slouken@3407: * \brief Set the swap interval for the current OpenGL context. slouken@3407: * slouken@3407: * \param interval 0 for immediate updates, 1 for updates synchronized with the slouken@3407: * vertical retrace. slouken@3407: * slouken@3407: * \return 0 on success, or -1 if setting the swap interval is not supported. slouken@3407: * slouken@3407: * \sa SDL_GL_GetSwapInterval() slouken@1895: */ slouken@1895: extern DECLSPEC int SDLCALL SDL_GL_SetSwapInterval(int interval); slouken@1895: slouken@1895: /** slouken@3407: * \brief Get the swap interval for the current OpenGL context. slouken@3407: * slouken@3407: * \return 0 if there is no vertical retrace synchronization, 1 if the buffer slouken@3407: * swap is synchronized with the vertical retrace, and -1 if getting slouken@3407: * the swap interval is not supported. slouken@3407: * slouken@3407: * \sa SDL_GL_SetSwapInterval() slouken@1895: */ slouken@1895: extern DECLSPEC int SDLCALL SDL_GL_GetSwapInterval(void); slouken@1895: slouken@1895: /** slouken@3407: * \brief Swap the OpenGL buffers for the window, if double-buffering is slouken@3407: * supported. slouken@0: */ slouken@1912: extern DECLSPEC void SDLCALL SDL_GL_SwapWindow(SDL_WindowID windowID); slouken@0: slouken@1895: /** slouken@3407: * \brief Delete an OpenGL context. slouken@3407: * slouken@3407: * \sa SDL_GL_CreateContext() slouken@0: */ slouken@1895: extern DECLSPEC void SDLCALL SDL_GL_DeleteContext(SDL_GLContext context); slouken@0: slouken@3407: /*@}*//*OpenGL support functions*/ slouken@3407: slouken@0: slouken@0: /* Ends C function definitions when using C++ */ slouken@0: #ifdef __cplusplus slouken@1895: /* *INDENT-OFF* */ slouken@0: } slouken@1895: /* *INDENT-ON* */ slouken@0: #endif slouken@0: #include "close_code.h" slouken@0: slouken@0: #endif /* _SDL_video_h */ slouken@1895: slouken@1895: /* vi: set ts=4 sw=4 expandtab: */