/Users/hercules/trunk/SDL/include/SDL_video.h File Reference

#include "SDL_stdinc.h"
#include "SDL_pixels.h"
#include "SDL_rect.h"
#include "SDL_surface.h"
#include "begin_code.h"
#include "close_code.h"

Go to the source code of this file.

Data Structures

struct  SDL_DisplayMode
 The structure that defines a display mode. More...
struct  SDL_RendererInfo
 Information on the capabilities of a render driver or context. More...

Defines

#define SDL_WINDOWPOS_UNDEFINED   0x7FFFFFF
 Used to indicate that you don't care what the window position is.
#define SDL_WINDOWPOS_CENTERED   0x7FFFFFE
 Used to indicate that the window position should be centered.

Typedefs

typedef Uint32 SDL_WindowID
 The type used to identify a window.
typedef Uint32 SDL_TextureID
 An efficient driver-specific representation of pixel data.
typedef void * SDL_GLContext
 An opaque handle to an OpenGL context.

Enumerations

enum  SDL_WindowFlags {
  SDL_WINDOW_FULLSCREEN = 0x00000001, SDL_WINDOW_OPENGL = 0x00000002, SDL_WINDOW_SHOWN = 0x00000004, SDL_WINDOW_BORDERLESS = 0x00000008,
  SDL_WINDOW_RESIZABLE = 0x00000010, SDL_WINDOW_MINIMIZED = 0x00000020, SDL_WINDOW_MAXIMIZED = 0x00000040, SDL_WINDOW_INPUT_GRABBED = 0x00000100,
  SDL_WINDOW_INPUT_FOCUS = 0x00000200, SDL_WINDOW_MOUSE_FOCUS = 0x00000400, SDL_WINDOW_FOREIGN = 0x00000800
}
 The flags on a window. More...
enum  SDL_WindowEventID {
  SDL_WINDOWEVENT_NONE, SDL_WINDOWEVENT_SHOWN, SDL_WINDOWEVENT_HIDDEN, SDL_WINDOWEVENT_EXPOSED,
  SDL_WINDOWEVENT_MOVED, SDL_WINDOWEVENT_RESIZED, SDL_WINDOWEVENT_MINIMIZED, SDL_WINDOWEVENT_MAXIMIZED,
  SDL_WINDOWEVENT_RESTORED, SDL_WINDOWEVENT_ENTER, SDL_WINDOWEVENT_LEAVE, SDL_WINDOWEVENT_FOCUS_GAINED,
  SDL_WINDOWEVENT_FOCUS_LOST, SDL_WINDOWEVENT_CLOSE
}
 Event subtype for window events. More...
enum  SDL_RendererFlags {
  SDL_RENDERER_SINGLEBUFFER = 0x00000001, SDL_RENDERER_PRESENTCOPY = 0x00000002, SDL_RENDERER_PRESENTFLIP2 = 0x00000004, SDL_RENDERER_PRESENTFLIP3 = 0x00000008,
  SDL_RENDERER_PRESENTDISCARD = 0x00000010, SDL_RENDERER_PRESENTVSYNC = 0x00000020, SDL_RENDERER_ACCELERATED = 0x00000040
}
 Flags used when creating a rendering context. More...
enum  SDL_TextureAccess { SDL_TEXTUREACCESS_STATIC, SDL_TEXTUREACCESS_STREAMING }
 The access pattern allowed for a texture. More...
enum  SDL_TextureModulate { SDL_TEXTUREMODULATE_NONE = 0x00000000, SDL_TEXTUREMODULATE_COLOR = 0x00000001, SDL_TEXTUREMODULATE_ALPHA = 0x00000002 }
 The texture channel modulation used in SDL_RenderCopy(). More...
enum  SDL_BlendMode {
  SDL_BLENDMODE_NONE = 0x00000000, SDL_BLENDMODE_MASK = 0x00000001, SDL_BLENDMODE_BLEND = 0x00000002, SDL_BLENDMODE_ADD = 0x00000004,
  SDL_BLENDMODE_MOD = 0x00000008
}
 The blend mode used in SDL_RenderCopy() and drawing operations. More...
enum  SDL_TextureScaleMode { SDL_TEXTURESCALEMODE_NONE = 0x00000000, SDL_TEXTURESCALEMODE_FAST = 0x00000001, SDL_TEXTURESCALEMODE_SLOW = 0x00000002, SDL_TEXTURESCALEMODE_BEST = 0x00000004 }
 The texture scale mode used in SDL_RenderCopy(). More...
enum  SDL_GLattr {
  SDL_GL_RED_SIZE, SDL_GL_GREEN_SIZE, SDL_GL_BLUE_SIZE, SDL_GL_ALPHA_SIZE,
  SDL_GL_BUFFER_SIZE, SDL_GL_DOUBLEBUFFER, SDL_GL_DEPTH_SIZE, SDL_GL_STENCIL_SIZE,
  SDL_GL_ACCUM_RED_SIZE, SDL_GL_ACCUM_GREEN_SIZE, SDL_GL_ACCUM_BLUE_SIZE, SDL_GL_ACCUM_ALPHA_SIZE,
  SDL_GL_STEREO, SDL_GL_MULTISAMPLEBUFFERS, SDL_GL_MULTISAMPLESAMPLES, SDL_GL_ACCELERATED_VISUAL,
  SDL_GL_RETAINED_BACKING, SDL_GL_CONTEXT_MAJOR_VERSION, SDL_GL_CONTEXT_MINOR_VERSION
}
 OpenGL configuration attributes.

Functions

DECLSPEC int SDLCALL SDL_GetNumVideoDrivers (void)
 Get the number of video drivers compiled into SDL.
DECLSPEC const char *SDLCALL SDL_GetVideoDriver (int index)
 Get the name of a built in video driver.
DECLSPEC int SDLCALL SDL_VideoInit (const char *driver_name, Uint32 flags)
 Initialize the video subsystem, optionally specifying a video driver.
DECLSPEC void SDLCALL SDL_VideoQuit (void)
 Shuts down the video subsystem.
DECLSPEC const char *SDLCALL SDL_GetCurrentVideoDriver (void)
 Returns the name of the currently initialized video driver.
DECLSPEC int SDLCALL SDL_GetNumVideoDisplays (void)
 Returns the number of available video displays.
DECLSPEC int SDLCALL SDL_SelectVideoDisplay (int index)
 Set the index of the currently selected display.
DECLSPEC int SDLCALL SDL_GetCurrentVideoDisplay (void)
 Get the index of the currently selected display.
DECLSPEC int SDLCALL SDL_GetNumDisplayModes (void)
 Returns the number of available display modes for the current display.
DECLSPEC int SDLCALL SDL_GetDisplayMode (int index, SDL_DisplayMode *mode)
 Fill in information about a specific display mode.
DECLSPEC int SDLCALL SDL_GetDesktopDisplayMode (SDL_DisplayMode *mode)
 Fill in information about the desktop display mode for the current display.
DECLSPEC int SDLCALL SDL_GetCurrentDisplayMode (SDL_DisplayMode *mode)
 Fill in information about the current display mode.
DECLSPEC SDL_DisplayMode *SDLCALL SDL_GetClosestDisplayMode (const SDL_DisplayMode *mode, SDL_DisplayMode *closest)
 Get the closest match to the requested display mode.
DECLSPEC int SDLCALL SDL_SetFullscreenDisplayMode (const SDL_DisplayMode *mode)
 Set the display mode used when a fullscreen window is visible on the currently selected display.
DECLSPEC int SDLCALL SDL_GetFullscreenDisplayMode (SDL_DisplayMode *mode)
 Fill in information about the display mode used when a fullscreen window is visible on the currently selected display.
DECLSPEC int SDLCALL SDL_SetDisplayPalette (const SDL_Color *colors, int firstcolor, int ncolors)
 Set the palette entries for indexed display modes.
DECLSPEC int SDLCALL SDL_GetDisplayPalette (SDL_Color *colors, int firstcolor, int ncolors)
 Gets the palette entries for indexed display modes.
DECLSPEC int SDLCALL SDL_SetGamma (float red, float green, float blue)
 Set the gamma correction for each of the color channels on the currently selected display.
DECLSPEC int SDLCALL SDL_SetGammaRamp (const Uint16 *red, const Uint16 *green, const Uint16 *blue)
 Set the gamma ramp for the currently selected display.
DECLSPEC int SDLCALL SDL_GetGammaRamp (Uint16 *red, Uint16 *green, Uint16 *blue)
 Get the gamma ramp for the currently selected display.
DECLSPEC SDL_WindowID SDLCALL SDL_CreateWindow (const char *title, int x, int y, int w, int h, Uint32 flags)
 Create a window with the specified position, dimensions, and flags.
DECLSPEC SDL_WindowID SDLCALL SDL_CreateWindowFrom (const void *data)
DECLSPEC Uint32 SDLCALL SDL_GetWindowFlags (SDL_WindowID windowID)
 Get the window flags.
DECLSPEC void SDLCALL SDL_SetWindowTitle (SDL_WindowID windowID, const char *title)
 Set the title of the window, in UTF-8 format.
DECLSPEC const char *SDLCALL SDL_GetWindowTitle (SDL_WindowID windowID)
 Get the title of the window, in UTF-8 format.
DECLSPEC void SDLCALL SDL_SetWindowIcon (SDL_WindowID windowID, SDL_Surface *icon)
 Set the icon of the window.
DECLSPEC void SDLCALL SDL_SetWindowData (SDL_WindowID windowID, void *userdata)
 Associate an arbitrary pointer with the window.
DECLSPEC void *SDLCALL SDL_GetWindowData (SDL_WindowID windowID)
 Retrieve the data pointer associated with the window.
DECLSPEC void SDLCALL SDL_SetWindowPosition (SDL_WindowID windowID, int x, int y)
 Set the position of the window.
DECLSPEC void SDLCALL SDL_GetWindowPosition (SDL_WindowID windowID, int *x, int *y)
 Get the position of the window.
DECLSPEC void SDLCALL SDL_SetWindowSize (SDL_WindowID windowID, int w, int h)
 Set the size of the window's client area.
DECLSPEC void SDLCALL SDL_GetWindowSize (SDL_WindowID windowID, int *w, int *h)
 Get the size of the window's client area.
DECLSPEC void SDLCALL SDL_ShowWindow (SDL_WindowID windowID)
 Show the window.
DECLSPEC void SDLCALL SDL_HideWindow (SDL_WindowID windowID)
 Hide the window.
DECLSPEC void SDLCALL SDL_RaiseWindow (SDL_WindowID windowID)
 Raise the window above other windows and set the input focus.
DECLSPEC void SDLCALL SDL_MaximizeWindow (SDL_WindowID windowID)
 Make the window as large as possible.
DECLSPEC void SDLCALL SDL_MinimizeWindow (SDL_WindowID windowID)
 Minimize the window to an iconic representation.
DECLSPEC void SDLCALL SDL_RestoreWindow (SDL_WindowID windowID)
 Restore the size and position of a minimized or maximized window.
DECLSPEC int SDLCALL SDL_SetWindowFullscreen (SDL_WindowID windowID, int fullscreen)
 Set the window's fullscreen state.
DECLSPEC void SDLCALL SDL_SetWindowGrab (SDL_WindowID windowID, int mode)
 Set the window's input grab mode.
DECLSPEC int SDLCALL SDL_GetWindowGrab (SDL_WindowID windowID)
 Get the window's input grab mode.
DECLSPEC SDL_bool SDLCALL SDL_GetWindowWMInfo (SDL_WindowID windowID, struct SDL_SysWMinfo *info)
DECLSPEC void SDLCALL SDL_DestroyWindow (SDL_WindowID windowID)
 Destroy a window.
DECLSPEC int SDLCALL SDL_GetNumRenderDrivers (void)
 Get the number of 2D rendering drivers available for the current display.
DECLSPEC int SDLCALL SDL_GetRenderDriverInfo (int index, SDL_RendererInfo *info)
 Get information about a specific 2D rendering driver for the current display.
DECLSPEC int SDLCALL SDL_CreateRenderer (SDL_WindowID windowID, int index, Uint32 flags)
 Create and make active a 2D rendering context for a window.
DECLSPEC int SDLCALL SDL_SelectRenderer (SDL_WindowID windowID)
 Select the rendering context for a particular window.
DECLSPEC int SDLCALL SDL_GetRendererInfo (SDL_RendererInfo *info)
 Get information about the current rendering context.
DECLSPEC SDL_TextureID SDLCALL SDL_CreateTexture (Uint32 format, int access, int w, int h)
 Create a texture for the current rendering context.
DECLSPEC SDL_TextureID SDLCALL SDL_CreateTextureFromSurface (Uint32 format, SDL_Surface *surface)
 Create a texture from an existing surface.
DECLSPEC int SDLCALL SDL_QueryTexture (SDL_TextureID textureID, Uint32 *format, int *access, int *w, int *h)
 Query the attributes of a texture.
DECLSPEC int SDLCALL SDL_QueryTexturePixels (SDL_TextureID textureID, void **pixels, int *pitch)
DECLSPEC int SDLCALL SDL_SetTexturePalette (SDL_TextureID textureID, const SDL_Color *colors, int firstcolor, int ncolors)
 Set the color palette of an indexed texture.
DECLSPEC int SDLCALL SDL_GetTexturePalette (SDL_TextureID textureID, SDL_Color *colors, int firstcolor, int ncolors)
 Get the color palette from an indexed texture if it has one.
DECLSPEC int SDLCALL SDL_SetTextureColorMod (SDL_TextureID textureID, Uint8 r, Uint8 g, Uint8 b)
 Set an additional color value used in render copy operations.
DECLSPEC int SDLCALL SDL_GetTextureColorMod (SDL_TextureID textureID, Uint8 *r, Uint8 *g, Uint8 *b)
 Get the additional color value used in render copy operations.
DECLSPEC int SDLCALL SDL_SetTextureAlphaMod (SDL_TextureID textureID, Uint8 alpha)
 Set an additional alpha value used in render copy operations.
DECLSPEC int SDLCALL SDL_GetTextureAlphaMod (SDL_TextureID textureID, Uint8 *alpha)
 Get the additional alpha value used in render copy operations.
DECLSPEC int SDLCALL SDL_SetTextureBlendMode (SDL_TextureID textureID, int blendMode)
 Set the blend mode used for texture copy operations.
DECLSPEC int SDLCALL SDL_GetTextureBlendMode (SDL_TextureID textureID, int *blendMode)
 Get the blend mode used for texture copy operations.
DECLSPEC int SDLCALL SDL_SetTextureScaleMode (SDL_TextureID textureID, int scaleMode)
 Set the scale mode used for texture copy operations.
DECLSPEC int SDLCALL SDL_GetTextureScaleMode (SDL_TextureID textureID, int *scaleMode)
 Get the scale mode used for texture copy operations.
DECLSPEC int SDLCALL SDL_UpdateTexture (SDL_TextureID textureID, const SDL_Rect *rect, const void *pixels, int pitch)
 Update the given texture rectangle with new pixel data.
DECLSPEC int SDLCALL SDL_LockTexture (SDL_TextureID textureID, const SDL_Rect *rect, int markDirty, void **pixels, int *pitch)
 Lock a portion of the texture for pixel access.
DECLSPEC void SDLCALL SDL_UnlockTexture (SDL_TextureID textureID)
 Unlock a texture, uploading the changes to video memory, if needed.
DECLSPEC void SDLCALL SDL_DirtyTexture (SDL_TextureID textureID, int numrects, const SDL_Rect *rects)
 Mark the specified rectangles of the texture as dirty.
DECLSPEC int SDL_SetRenderDrawColor (Uint8 r, Uint8 g, Uint8 b, Uint8 a)
 Set the color used for drawing operations (Fill and Line).
DECLSPEC int SDL_GetRenderDrawColor (Uint8 *r, Uint8 *g, Uint8 *b, Uint8 *a)
 Get the color used for drawing operations (Fill and Line).
DECLSPEC int SDLCALL SDL_SetRenderDrawBlendMode (int blendMode)
 Set the blend mode used for drawing operations (Fill and Line).
DECLSPEC int SDLCALL SDL_GetRenderDrawBlendMode (int *blendMode)
 Get the blend mode used for drawing operations.
DECLSPEC int SDLCALL SDL_RenderPoint (int x, int y)
 Draw a point on the current rendering target.
DECLSPEC int SDLCALL SDL_RenderLine (int x1, int y1, int x2, int y2)
 Draw a line on the current rendering target.
DECLSPEC int SDLCALL SDL_RenderFill (const SDL_Rect *rect)
 Fill the current rendering target with the drawing color.
DECLSPEC int SDLCALL SDL_RenderCopy (SDL_TextureID textureID, const SDL_Rect *srcrect, const SDL_Rect *dstrect)
 Copy a portion of the texture to the current rendering target.
DECLSPEC int SDLCALL SDL_RenderReadPixels (const SDL_Rect *rect, void *pixels, int pitch)
 Read pixels from the current rendering target.
DECLSPEC int SDLCALL SDL_RenderWritePixels (const SDL_Rect *rect, const void *pixels, int pitch)
 Write pixels to the current rendering target.
DECLSPEC void SDLCALL SDL_RenderPresent (void)
 Update the screen with rendering performed.
DECLSPEC void SDLCALL SDL_DestroyTexture (SDL_TextureID textureID)
 Destroy the specified texture.
DECLSPEC void SDLCALL SDL_DestroyRenderer (SDL_WindowID windowID)
 Destroy the rendering context for a window and free associated textures.
DECLSPEC SDL_bool SDLCALL SDL_IsScreenSaverEnabled (void)
 Returns whether the screensaver is currently enabled (default off).
DECLSPEC void SDLCALL SDL_EnableScreenSaver (void)
 Allow the screen to be blanked by a screensaver.
DECLSPEC void SDLCALL SDL_DisableScreenSaver (void)
 Prevent the screen from being blanked by a screensaver.
DECLSPEC int SDLCALL SDL_GL_LoadLibrary (const char *path)
 Dynamically load an OpenGL library.
DECLSPEC void *SDLCALL SDL_GL_GetProcAddress (const char *proc)
 Get the address of an OpenGL function.
DECLSPEC void SDLCALL SDL_GL_UnloadLibrary (void)
 Unload the OpenGL library previously loaded by SDL_GL_LoadLibrary().
DECLSPEC SDL_bool SDLCALL SDL_GL_ExtensionSupported (const char *extension)
 Return true if an OpenGL extension is supported for the current context.
DECLSPEC int SDLCALL SDL_GL_SetAttribute (SDL_GLattr attr, int value)
 Set an OpenGL window attribute before window creation.
DECLSPEC int SDLCALL SDL_GL_GetAttribute (SDL_GLattr attr, int *value)
DECLSPEC SDL_GLContext SDLCALL SDL_GL_CreateContext (SDL_WindowID windowID)
 Create an OpenGL context for use with an OpenGL window, and make it current.
DECLSPEC int SDLCALL SDL_GL_MakeCurrent (SDL_WindowID windowID, SDL_GLContext context)
 Set up an OpenGL context for rendering into an OpenGL window.
DECLSPEC int SDLCALL SDL_GL_SetSwapInterval (int interval)
 Set the swap interval for the current OpenGL context.
DECLSPEC int SDLCALL SDL_GL_GetSwapInterval (void)
 Get the swap interval for the current OpenGL context.
DECLSPEC void SDLCALL SDL_GL_SwapWindow (SDL_WindowID windowID)
 Swap the OpenGL buffers for the window, if double-buffering is supported.
DECLSPEC void SDLCALL SDL_GL_DeleteContext (SDL_GLContext context)
 Delete an OpenGL context.


Detailed Description

Header file for SDL video functions.

Typedef Documentation


Enumeration Type Documentation

The blend mode used in SDL_RenderCopy() and drawing operations.

Enumerator:
SDL_BLENDMODE_NONE  No blending
SDL_BLENDMODE_MASK  dst = A ? src : dst (alpha is mask)
SDL_BLENDMODE_BLEND  dst = (src * A) + (dst * (1-A))
SDL_BLENDMODE_ADD  dst = (src * A) + dst
SDL_BLENDMODE_MOD  dst = src * dst

Flags used when creating a rendering context.

Enumerator:
SDL_RENDERER_SINGLEBUFFER  Render directly to the window, if possible
SDL_RENDERER_PRESENTCOPY  Present uses a copy from back buffer to the front buffer
SDL_RENDERER_PRESENTFLIP2  Present uses a flip, swapping back buffer and front buffer
SDL_RENDERER_PRESENTFLIP3  Present uses a flip, rotating between two back buffers and a front buffer
SDL_RENDERER_PRESENTDISCARD  Present leaves the contents of the backbuffer undefined
SDL_RENDERER_PRESENTVSYNC  Present is synchronized with the refresh rate
SDL_RENDERER_ACCELERATED  The renderer uses hardware acceleration

The access pattern allowed for a texture.

Enumerator:
SDL_TEXTUREACCESS_STATIC  Changes rarely, not lockable
SDL_TEXTUREACCESS_STREAMING  Changes frequently, lockable

The texture channel modulation used in SDL_RenderCopy().

Enumerator:
SDL_TEXTUREMODULATE_NONE  No modulation
SDL_TEXTUREMODULATE_COLOR  srcC = srcC * color
SDL_TEXTUREMODULATE_ALPHA  srcA = srcA * alpha

The texture scale mode used in SDL_RenderCopy().

Enumerator:
SDL_TEXTURESCALEMODE_NONE  No scaling, rectangles must match dimensions
SDL_TEXTURESCALEMODE_FAST  Point sampling or equivalent algorithm
SDL_TEXTURESCALEMODE_SLOW  Linear filtering or equivalent algorithm
SDL_TEXTURESCALEMODE_BEST  Bicubic filtering or equivalent algorithm

Event subtype for window events.

Enumerator:
SDL_WINDOWEVENT_NONE  Never used
SDL_WINDOWEVENT_SHOWN  Window has been shown
SDL_WINDOWEVENT_HIDDEN  Window has been hidden
SDL_WINDOWEVENT_EXPOSED  Window has been exposed and should be redrawn
SDL_WINDOWEVENT_MOVED  Window has been moved to data1,data2
SDL_WINDOWEVENT_RESIZED  Window size changed to data1xdata2
SDL_WINDOWEVENT_MINIMIZED  Window has been minimized
SDL_WINDOWEVENT_MAXIMIZED  Window has been maximized
SDL_WINDOWEVENT_RESTORED  Window has been restored to normal size and position
SDL_WINDOWEVENT_ENTER  The window has gained mouse focus
SDL_WINDOWEVENT_LEAVE  The window has lost mouse focus
SDL_WINDOWEVENT_FOCUS_GAINED  The window has gained keyboard focus
SDL_WINDOWEVENT_FOCUS_LOST  The window has lost keyboard focus
SDL_WINDOWEVENT_CLOSE  The window manager requests that the window be closed

The flags on a window.

See also:
SDL_GetWindowFlags()
Enumerator:
SDL_WINDOW_FULLSCREEN  fullscreen window, implies borderless
SDL_WINDOW_OPENGL  window usable with OpenGL context
SDL_WINDOW_SHOWN  window is visible
SDL_WINDOW_BORDERLESS  no window decoration
SDL_WINDOW_RESIZABLE  window can be resized
SDL_WINDOW_MINIMIZED  minimized
SDL_WINDOW_MAXIMIZED  maximized
SDL_WINDOW_INPUT_GRABBED  window has grabbed input focus
SDL_WINDOW_INPUT_FOCUS  window has input focus
SDL_WINDOW_MOUSE_FOCUS  window has mouse focus
SDL_WINDOW_FOREIGN  window not created by SDL


Function Documentation

int SDL_CreateRenderer ( SDL_WindowID  window,
int  index,
Uint32  flags 
)

Create and make active a 2D rendering context for a window.

Parameters:
windowID The window used for rendering
index The index of the rendering driver to initialize, or -1 to initialize the first one supporting the requested flags.
flags SDL_RendererFlags
Returns:
0 on success, -1 if there was an error creating the renderer.
See also:
SDL_SelectRenderer()

SDL_GetRendererInfo()

SDL_DestroyRenderer()

SDL_TextureID SDL_CreateTexture ( Uint32  format,
int  access,
int  w,
int  h 
)

Create a texture for the current rendering context.

Parameters:
format The format of the texture
access One of the enumerated values in SDL_TextureAccess
w The width of the texture in pixels
h The height of the texture in pixels
Returns:
The created texture is returned, or 0 if no rendering context was active, the format was unsupported, or the width or height were out of range.
See also:
SDL_QueryTexture()

SDL_DestroyTexture()

SDL_TextureID SDL_CreateTextureFromSurface ( Uint32  format,
SDL_Surface surface 
)

Create a texture from an existing surface.

Parameters:
format The format of the texture, or 0 to pick an appropriate format
surface The surface containing pixel data used to fill the texture
Returns:
The created texture is returned, or 0 if no rendering context was active, the format was unsupported, or the surface width or height were out of range.
Note:
The surface is not modified or freed by this function.
See also:
SDL_QueryTexture()

SDL_DestroyTexture()

SDL_WindowID SDL_CreateWindow ( const char *  title,
int  x,
int  y,
int  w,
int  h,
Uint32  flags 
)

Create a window with the specified position, dimensions, and flags.

Parameters:
title The title of the window, in UTF-8 encoding
x The x position of the window, SDL_WINDOWPOS_CENTERED, or SDL_WINDOWPOS_UNDEFINED
y The y position of the window, SDL_WINDOWPOS_CENTERED, or SDL_WINDOWPOS_UNDEFINED
w The width of the window
h The height of the window
flags The flags for the window, a mask of any of the following: SDL_WINDOW_FULLSCREEN, SDL_WINDOW_OPENGL, SDL_WINDOW_SHOWN, SDL_WINDOW_BORDERLESS, SDL_WINDOW_RESIZABLE, SDL_WINDOW_MAXIMIZED, SDL_WINDOW_MINIMIZED, SDL_WINDOW_INPUT_GRABBED
Returns:
The id of the window created, or zero if window creation failed.
See also:
SDL_DestroyWindow()

void SDL_DestroyRenderer ( SDL_WindowID  windowID  ) 

Destroy the rendering context for a window and free associated textures.

See also:
SDL_CreateRenderer()

void SDL_DestroyTexture ( SDL_TextureID  textureID  ) 

Destroy the specified texture.

See also:
SDL_CreateTexture()

SDL_CreateTextureFromSurface()

void SDL_DirtyTexture ( SDL_TextureID  textureID,
int  numrects,
const SDL_Rect rects 
)

Mark the specified rectangles of the texture as dirty.

Parameters:
textureID The texture to mark dirty, which was created with SDL_TEXTUREACCESS_STREAMING.
numrects The number of rectangles pointed to by rects.
rects The pointer to an array of dirty rectangles.
See also:
SDL_LockTexture()

SDL_UnlockTexture()

void SDL_DisableScreenSaver ( void   ) 

Prevent the screen from being blanked by a screensaver.

See also:
SDL_IsScreenSaverEnabled()

SDL_EnableScreenSaver()

void SDL_EnableScreenSaver ( void   ) 

Allow the screen to be blanked by a screensaver.

See also:
SDL_IsScreenSaverEnabled()

SDL_DisableScreenSaver()

SDL_DisplayMode * SDL_GetClosestDisplayMode ( const SDL_DisplayMode mode,
SDL_DisplayMode closest 
)

Get the closest match to the requested display mode.

Parameters:
mode The desired display mode
closest A pointer to a display mode to be filled in with the closest match of the available display modes.
Returns:
The passed in value 'closest', or NULL if no matching video mode was available.
The available display modes are scanned, and 'closest' is filled in with the closest mode matching the requested mode and returned. The mode format and refresh_rate default to the desktop mode if they are 0. The modes are scanned with size being first priority, format being second priority, and finally checking the refresh_rate. If all the available modes are too small, then NULL is returned.

See also:
SDL_GetNumDisplayModes()

SDL_GetDisplayMode()

int SDL_GetCurrentVideoDisplay ( void   ) 

Get the index of the currently selected display.

Returns:
The index of the currently selected display.
See also:
SDL_GetNumVideoDisplays()

SDL_SelectVideoDisplay()

const char * SDL_GetCurrentVideoDriver ( void   ) 

Returns the name of the currently initialized video driver.

Returns:
The name of the current video driver or NULL if no driver has been initialized
See also:
SDL_GetNumVideoDrivers()

SDL_GetVideoDriver()

int SDL_GetDisplayMode ( int  index,
SDL_DisplayMode mode 
)

Fill in information about a specific display mode.

Note:
The display modes are sorted in this priority:
  • bits per pixel -> more colors to fewer colors
  • width -> largest to smallest
  • height -> largest to smallest
  • refresh rate -> highest to lowest
See also:
SDL_GetNumDisplayModes()

int SDL_GetDisplayPalette ( SDL_Color *  colors,
int  firstcolor,
int  ncolors 
)

Gets the palette entries for indexed display modes.

Returns:
0 on success, or -1 if the display mode isn't palettized

int SDL_GetGammaRamp ( Uint16 red,
Uint16 green,
Uint16 blue 
)

Get the gamma ramp for the currently selected display.

Parameters:
red A pointer to a 256 element array of 16-bit quantities to hold the translation table for the red channel, or NULL.
green A pointer to a 256 element array of 16-bit quantities to hold the translation table for the green channel, or NULL.
blue A pointer to a 256 element array of 16-bit quantities to hold the translation table for the blue channel, or NULL.
Returns:
0 on success, or -1 if gamma ramps are unsupported.
See also:
SDL_SetGammaRamp()

int SDL_GetNumDisplayModes ( void   ) 

Returns the number of available display modes for the current display.

See also:
SDL_GetDisplayMode()

int SDL_GetNumRenderDrivers ( void   ) 

Get the number of 2D rendering drivers available for the current display.

A render driver is a set of code that handles rendering and texture management on a particular display. Normally there is only one, but some drivers may have several available with different capabilities.

See also:
SDL_GetRenderDriverInfo()

SDL_CreateRenderer()

int SDL_GetNumVideoDisplays ( void   ) 

Returns the number of available video displays.

See also:
SDL_SelectVideoDisplay()

int SDL_GetNumVideoDrivers ( void   ) 

Get the number of video drivers compiled into SDL.

See also:
SDL_GetVideoDriver()

int SDL_GetRenderDrawBlendMode ( int *  blendMode  ) 

Get the blend mode used for drawing operations.

Parameters:
blendMode A pointer filled in with the current blend mode
Returns:
0 on success, or -1 if there is no rendering context current
See also:
SDL_SetRenderDrawBlendMode()

int SDL_GetRenderDrawColor ( Uint8 r,
Uint8 g,
Uint8 b,
Uint8 a 
)

Get the color used for drawing operations (Fill and Line).

Parameters:
r A pointer to the red value used to draw on the rendering target
g A pointer to the green value used to draw on the rendering target
b A pointer to the blue value used to draw on the rendering target
a A pointer to the alpha value used to draw on the rendering target, usually SDL_ALPHA_OPAQUE (255)
Returns:
0 on success, or -1 if there is no rendering context current

int SDL_GetRenderDriverInfo ( int  index,
SDL_RendererInfo info 
)

Get information about a specific 2D rendering driver for the current display.

Parameters:
index The index of the driver to query information about.
info A pointer to an SDL_RendererInfo struct to be filled with information on the rendering driver.
Returns:
0 on success, -1 if the index was out of range
See also:
SDL_CreateRenderer()

int SDL_GetTextureAlphaMod ( SDL_TextureID  textureID,
Uint8 alpha 
)

Get the additional alpha value used in render copy operations.

Parameters:
texture The texture to query
alpha A pointer filled in with the source alpha value
Returns:
0 on success, or -1 if the texture is not valid
See also:
SDL_SetTextureAlphaMod()

int SDL_GetTextureBlendMode ( SDL_TextureID  textureID,
int *  blendMode 
)

Get the blend mode used for texture copy operations.

Parameters:
texture The texture to query
blendMode A pointer filled in with the current blend mode
Returns:
0 on success, or -1 if the texture is not valid
See also:
SDL_SetTextureBlendMode()

int SDL_GetTextureColorMod ( SDL_TextureID  textureID,
Uint8 r,
Uint8 g,
Uint8 b 
)

Get the additional color value used in render copy operations.

Parameters:
texture The texture to query
r A pointer filled in with the source red color value
g A pointer filled in with the source green color value
b A pointer filled in with the source blue color value
Returns:
0 on success, or -1 if the texture is not valid
See also:
SDL_SetTextureColorMod()

int SDL_GetTexturePalette ( SDL_TextureID  textureID,
SDL_Color *  colors,
int  firstcolor,
int  ncolors 
)

Get the color palette from an indexed texture if it has one.

Parameters:
texture The texture to update
colors The array to fill with RGB color data
firstcolor The first index to retrieve
ncolors The number of palette entries to retrieve
Returns:
0 on success, or -1 if the texture is not valid or not an indexed texture

int SDL_GetTextureScaleMode ( SDL_TextureID  textureID,
int *  scaleMode 
)

Get the scale mode used for texture copy operations.

Parameters:
texture The texture to query
scaleMode A pointer filled in with the current scale mode
Returns:
0 on success, or -1 if the texture is not valid
See also:
SDL_SetTextureScaleMode()

const char * SDL_GetVideoDriver ( int  index  ) 

Get the name of a built in video driver.

Note:
The video drivers are presented in the order in which they are normally checked during initialization.
See also:
SDL_GetNumVideoDrivers()

void * SDL_GetWindowData ( SDL_WindowID  windowID  ) 

Retrieve the data pointer associated with the window.

See also:
SDL_SetWindowData()

int SDL_GetWindowGrab ( SDL_WindowID  windowID  ) 

Get the window's input grab mode.

Returns:
This returns 1 if input is grabbed, and 0 otherwise.
See also:
SDL_SetWindowGrab()

void SDL_GetWindowPosition ( SDL_WindowID  windowID,
int *  x,
int *  y 
)

Get the position of the window.

See also:
SDL_SetWindowPosition()

void SDL_GetWindowSize ( SDL_WindowID  windowID,
int *  w,
int *  h 
)

Get the size of the window's client area.

See also:
SDL_SetWindowSize()

const char * SDL_GetWindowTitle ( SDL_WindowID  windowID  ) 

Get the title of the window, in UTF-8 format.

See also:
SDL_SetWindowTitle()

SDL_GLContext SDL_GL_CreateContext ( SDL_WindowID  windowID  ) 

Create an OpenGL context for use with an OpenGL window, and make it current.

See also:
SDL_GL_DeleteContext()

void SDL_GL_DeleteContext ( SDL_GLContext  context  ) 

Delete an OpenGL context.

See also:
SDL_GL_CreateContext()

int SDL_GL_GetSwapInterval ( void   ) 

Get the swap interval for the current OpenGL context.

Returns:
0 if there is no vertical retrace synchronization, 1 if the buffer swap is synchronized with the vertical retrace, and -1 if getting the swap interval is not supported.
See also:
SDL_GL_SetSwapInterval()

int SDL_GL_LoadLibrary ( const char *  path  ) 

Dynamically load an OpenGL library.

Parameters:
path The platform dependent OpenGL library name, or NULL to open the default OpenGL library
Returns:
0 on success, or -1 if the library couldn't be loaded
This should be done after initializing the video driver, but before creating any OpenGL windows. If no OpenGL library is loaded, the default library will be loaded upon creation of the first OpenGL window.

Note:
If you do this, you need to retrieve all of the GL functions used in your program from the dynamic library using SDL_GL_GetProcAddress().
See also:
SDL_GL_GetProcAddress()

SDL_GL_UnloadLibrary()

int SDL_GL_MakeCurrent ( SDL_WindowID  windowID,
SDL_GLContext  context 
)

Set up an OpenGL context for rendering into an OpenGL window.

Note:
The context must have been created with a compatible window.

int SDL_GL_SetSwapInterval ( int  interval  ) 

Set the swap interval for the current OpenGL context.

Parameters:
interval 0 for immediate updates, 1 for updates synchronized with the vertical retrace
Returns:
0 on success, or -1 if setting the swap interval is not supported.
See also:
SDL_GL_GetSwapInterval()

void SDL_GL_UnloadLibrary ( void   ) 

Unload the OpenGL library previously loaded by SDL_GL_LoadLibrary().

See also:
SDL_GL_LoadLibrary()

void SDL_HideWindow ( SDL_WindowID  windowID  ) 

Hide the window.

See also:
SDL_ShowWindow()

SDL_bool SDL_IsScreenSaverEnabled ( void   ) 

Returns whether the screensaver is currently enabled (default off).

See also:
SDL_EnableScreenSaver()

SDL_DisableScreenSaver()

void SDL_LockTexture ( SDL_TextureID  textureID,
const SDL_Rect rect,
int  markDirty,
void **  pixels,
int *  pitch 
)

Lock a portion of the texture for pixel access.

Parameters:
textureID The texture to lock for access, which was created with SDL_TEXTUREACCESS_STREAMING.
rect A pointer to the rectangle to lock for access. If the rect is NULL, the entire texture will be locked.
markDirty If this is nonzero, the locked area will be marked dirty when the texture is unlocked.
pixels This is filled in with a pointer to the locked pixels, appropriately offset by the locked area.
pitch This is filled in with the pitch of the locked pixels.
Returns:
0 on success, or -1 if the texture is not valid or was created with SDL_TEXTUREACCESS_STATIC
See also:
SDL_DirtyTexture()

SDL_UnlockTexture()

void SDL_MaximizeWindow ( SDL_WindowID  windowID  ) 

Make the window as large as possible.

See also:
SDL_RestoreWindow()

void SDL_MinimizeWindow ( SDL_WindowID  windowID  ) 

Minimize the window to an iconic representation.

See also:
SDL_RestoreWindow()

int SDL_QueryTexture ( SDL_TextureID  textureID,
Uint32 format,
int *  access,
int *  w,
int *  h 
)

Query the attributes of a texture.

Parameters:
texture A texture to be queried
format A pointer filled in with the raw format of the texture. The actual format may differ, but pixel transfers will use this format.
access A pointer filled in with the actual access to the texture.
w A pointer filled in with the width of the texture in pixels
h A pointer filled in with the height of the texture in pixels
Returns:
0 on success, or -1 if the texture is not valid

int SDL_RenderCopy ( SDL_TextureID  textureID,
const SDL_Rect srcrect,
const SDL_Rect dstrect 
)

Copy a portion of the texture to the current rendering target.

Parameters:
texture The source texture.
srcrect A pointer to the source rectangle, or NULL for the entire texture.
dstrect A pointer to the destination rectangle, or NULL for the entire rendering target.
Returns:
0 on success, or -1 if there is no rendering context current, or the driver doesn't support the requested operation.

void SDL_RenderFill ( const SDL_Rect rect  ) 

Fill the current rendering target with the drawing color.

Parameters:
rect A pointer to the destination rectangle, or NULL for the entire rendering target.
Returns:
0 on success, or -1 if there is no rendering context current

int SDL_RenderLine ( int  x1,
int  y1,
int  x2,
int  y2 
)

Draw a line on the current rendering target.

Parameters:
x1 The x coordinate of the start point
y1 The y coordinate of the start point
x2 The x coordinate of the end point
y2 The y coordinate of the end point
Returns:
0 on success, or -1 if there is no rendering context current

int SDL_RenderPoint ( int  x,
int  y 
)

Draw a point on the current rendering target.

Parameters:
x The x coordinate of the point
y The y coordinate of the point
Returns:
0 on success, or -1 if there is no rendering context current

int SDL_RenderReadPixels ( const SDL_Rect rect,
void *  pixels,
int  pitch 
)

Read pixels from the current rendering target.

Parameters:
rect A pointer to the rectangle to read, or NULL for the entire render target
pixels A pointer to be filled in with the pixel data in the rendering target format
pitch The pitch of the pixels parameter
Returns:
0 on success, or -1 if pixel reading is not supported.
Warning:
This is a very slow operation, and should not be used frequently.

int SDL_RenderWritePixels ( const SDL_Rect rect,
const void *  pixels,
int  pitch 
)

Write pixels to the current rendering target.

Parameters:
rect A pointer to the rectangle to write, or NULL for the entire render target
pixels A pointer to the pixel data to write
pitch The pitch of the pixels parameter
Returns:
0 on success, or -1 if pixel writing is not supported.
Warning:
This is a very slow operation, and should not be used frequently.

void SDL_RestoreWindow ( SDL_WindowID  windowID  ) 

Restore the size and position of a minimized or maximized window.

See also:
SDL_MaximizeWindow()

SDL_MinimizeWindow()

int SDL_SelectRenderer ( SDL_WindowID  windowID  ) 

Select the rendering context for a particular window.

Returns:
0 on success, -1 if the selected window doesn't have a rendering context.

int SDL_SelectVideoDisplay ( int  index  ) 

Set the index of the currently selected display.

Returns:
0 on success, or -1 if the index is out of range.
See also:
SDL_GetNumVideoDisplays()

SDL_GetCurrentVideoDisplay()

int SDL_SetDisplayPalette ( const SDL_Color *  colors,
int  firstcolor,
int  ncolors 
)

Set the palette entries for indexed display modes.

Returns:
0 on success, or -1 if the display mode isn't palettized or the colors couldn't be set.

int SDL_SetFullscreenDisplayMode ( const SDL_DisplayMode mode  ) 

Set the display mode used when a fullscreen window is visible on the currently selected display.

Parameters:
mode The mode to use, or NULL for the desktop mode.
Returns:
0 on success, or -1 if setting the display mode failed.
See also:
SDL_SetWindowFullscreen()

int SDL_SetGamma ( float  red,
float  green,
float  blue 
)

Set the gamma correction for each of the color channels on the currently selected display.

Returns:
0 on success, or -1 if setting the gamma isn't supported.
See also:
SDL_SetGammaRamp()

int SDL_SetGammaRamp ( const Uint16 red,
const Uint16 green,
const Uint16 blue 
)

Set the gamma ramp for the currently selected display.

Parameters:
red The translation table for the red channel, or NULL
green The translation table for the green channel, or NULL
blue The translation table for the blue channel, or NULL
Returns:
0 on success, or -1 if gamma ramps are unsupported.
Set the gamma translation table for the red, green, and blue channels of the video hardware. Each table is an array of 256 16-bit quantities, representing a mapping between the input and output for that channel. The input is the index into the array, and the output is the 16-bit gamma value at that index, scaled to the output color precision.

See also:
SDL_GetGammaRamp()

int SDL_SetRenderDrawBlendMode ( int  blendMode  ) 

Set the blend mode used for drawing operations (Fill and Line).

Parameters:
blendMode SDL_BlendMode to use for blending
Returns:
0 on success, or -1 if there is no rendering context current
Note:
If the blend mode is not supported, the closest supported mode is chosen.
See also:
SDL_SetRenderDrawBlendMode()

int SDL_SetRenderDrawColor ( Uint8  r,
Uint8  g,
Uint8  b,
Uint8  a 
)

Set the color used for drawing operations (Fill and Line).

Parameters:
r The red value used to draw on the rendering target
g The green value used to draw on the rendering target
b The blue value used to draw on the rendering target
a The alpha value used to draw on the rendering target, usually SDL_ALPHA_OPAQUE (255)
Returns:
0 on success, or -1 if there is no rendering context current

int SDL_SetTextureAlphaMod ( SDL_TextureID  textureID,
Uint8  alpha 
)

Set an additional alpha value used in render copy operations.

Parameters:
texture The texture to update
alpha The source alpha value multiplied into copy operations.
Returns:
0 on success, or -1 if the texture is not valid or alpha modulation is not supported
See also:
SDL_GetTextureAlphaMod()

int SDL_SetTextureBlendMode ( SDL_TextureID  textureID,
int  blendMode 
)

Set the blend mode used for texture copy operations.

Parameters:
texture The texture to update
blendMode SDL_TextureBlendMode to use for texture blending
Returns:
0 on success, or -1 if the texture is not valid or the blend mode is not supported
Note:
If the blend mode is not supported, the closest supported mode is chosen.
See also:
SDL_GetTextureBlendMode()

int SDL_SetTextureColorMod ( SDL_TextureID  textureID,
Uint8  r,
Uint8  g,
Uint8  b 
)

Set an additional color value used in render copy operations.

Parameters:
texture The texture to update
r The red source color value multiplied into copy operations
g The green source color value multiplied into copy operations
b The blue source color value multiplied into copy operations
Returns:
0 on success, or -1 if the texture is not valid or color modulation is not supported
See also:
SDL_GetTextureColorMod()

int SDL_SetTexturePalette ( SDL_TextureID  textureID,
const SDL_Color *  colors,
int  firstcolor,
int  ncolors 
)

Set the color palette of an indexed texture.

Parameters:
texture The texture to update
colors The array of RGB color data
firstcolor The first index to update
ncolors The number of palette entries to fill with the color data
Returns:
0 on success, or -1 if the texture is not valid or not an indexed texture

int SDL_SetTextureScaleMode ( SDL_TextureID  textureID,
int  scaleMode 
)

Set the scale mode used for texture copy operations.

Parameters:
texture The texture to update
scaleMode SDL_TextureScaleMode to use for texture scaling
Returns:
0 on success, or -1 if the texture is not valid or the scale mode is not supported
Note:
If the scale mode is not supported, the closest supported mode is chosen.
See also:
SDL_GetTextureScaleMode()

void SDL_SetWindowData ( SDL_WindowID  windowID,
void *  userdata 
)

Associate an arbitrary pointer with the window.

See also:
SDL_GetWindowData()

int SDL_SetWindowFullscreen ( SDL_WindowID  windowID,
int  fullscreen 
)

Set the window's fullscreen state.

Returns:
0 on success, or -1 if setting the display mode failed.
See also:
SDL_SetFullscreenDisplayMode()

void SDL_SetWindowGrab ( SDL_WindowID  windowID,
int  mode 
)

Set the window's input grab mode.

Parameters:
mode This is 1 to grab input, and 0 to release input.
See also:
SDL_GetWindowGrab()

void SDL_SetWindowIcon ( SDL_WindowID  windowID,
SDL_Surface icon 
)

Set the icon of the window.

Parameters:
icon The icon for the window

void SDL_SetWindowPosition ( SDL_WindowID  windowID,
int  x,
int  y 
)

Set the position of the window.

Parameters:
windowID The window to reposition
x The x coordinate of the window, SDL_WINDOWPOS_CENTERED, or SDL_WINDOWPOS_UNDEFINED
y The y coordinate of the window, SDL_WINDOWPOS_CENTERED, or SDL_WINDOWPOS_UNDEFINED
Note:
The window coordinate origin is the upper left of the display.
See also:
SDL_GetWindowPosition()

void SDL_SetWindowSize ( SDL_WindowID  windowID,
int  w,
int  w 
)

Set the size of the window's client area.

Note:
You can't change the size of a fullscreen window, it automatically matches the size of the display mode.
See also:
SDL_GetWindowSize()

void SDL_SetWindowTitle ( SDL_WindowID  windowID,
const char *  title 
)

Set the title of the window, in UTF-8 format.

See also:
SDL_GetWindowTitle()

void SDL_ShowWindow ( SDL_WindowID  windowID  ) 

Show the window.

See also:
SDL_HideWindow()

void SDL_UnlockTexture ( SDL_TextureID  textureID  ) 

Unlock a texture, uploading the changes to video memory, if needed.

See also:
SDL_LockTexture()

SDL_DirtyTexture()

int SDL_UpdateTexture ( SDL_TextureID  textureID,
const SDL_Rect rect,
const void *  pixels,
int  pitch 
)

Update the given texture rectangle with new pixel data.

Parameters:
texture The texture to update
rect A pointer to the rectangle of pixels to update, or NULL to update the entire texture.
pixels The raw pixel data
pitch The number of bytes between rows of pixel data
Returns:
0 on success, or -1 if the texture is not valid
Note:
This is a fairly slow function.

int SDL_VideoInit ( const char *  driver_name,
Uint32  flags 
)

Initialize the video subsystem, optionally specifying a video driver.

Parameters:
driver_name Initialize a specific driver by name, or NULL for the default video driver.
flags FIXME: Still needed?
Returns:
0 on success, -1 on error
This function initializes the video subsystem; setting up a connection to the window manager, etc, and determines the available display modes and pixel formats, but does not initialize a window or graphics mode.

See also:
SDL_VideoQuit()

void SDL_VideoQuit ( void   ) 

Shuts down the video subsystem.

This function closes all windows, and restores the original video mode.

See also:
SDL_VideoInit()


Generated on Mon Sep 21 21:32:25 2009 for Simple DirectMedia Layer by  doxygen 1.5.8