SDL Library

Dependents:   H261_decoder

Embed: (wiki syntax)

« Back to documentation index

SDL_video.h File Reference

SDL_video.h File Reference

Header file for SDL video functions. More...

Go to the source code of this file.

Data Structures

struct  SDL_DisplayMode
 The structure that defines a display mode. More...

Typedefs

typedef struct SDL_Window SDL_Window
 The type used to identify a window.
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_HIDDEN = 0x00000008,
  SDL_WINDOW_BORDERLESS = 0x00000010, SDL_WINDOW_RESIZABLE = 0x00000020, SDL_WINDOW_MINIMIZED = 0x00000040, SDL_WINDOW_MAXIMIZED = 0x00000080,
  SDL_WINDOW_INPUT_GRABBED = 0x00000100, SDL_WINDOW_INPUT_FOCUS = 0x00000200, SDL_WINDOW_MOUSE_FOCUS = 0x00000400 , SDL_WINDOW_FOREIGN = 0x00000800,
  SDL_WINDOW_ALLOW_HIGHDPI = 0x00002000
}
 

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_SIZE_CHANGED, 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_GLattr
 

OpenGL configuration attributes.

More...

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)
 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 const char *SDLCALL SDL_GetDisplayName (int displayIndex)
 Get the name of a display in UTF-8 encoding.
DECLSPEC int SDLCALL SDL_GetDisplayBounds (int displayIndex, SDL_Rect *rect)
 Get the desktop area represented by a display, with the primary display located at 0,0.
DECLSPEC int SDLCALL SDL_GetNumDisplayModes (int displayIndex)
 Returns the number of available display modes.
DECLSPEC int SDLCALL SDL_GetDisplayMode (int displayIndex, int modeIndex, SDL_DisplayMode *mode)
 Fill in information about a specific display mode.
DECLSPEC int SDLCALL SDL_GetDesktopDisplayMode (int displayIndex, SDL_DisplayMode *mode)
 Fill in information about the desktop display mode.
DECLSPEC int SDLCALL SDL_GetCurrentDisplayMode (int displayIndex, SDL_DisplayMode *mode)
 Fill in information about the current display mode.
DECLSPEC SDL_DisplayMode *SDLCALL SDL_GetClosestDisplayMode (int displayIndex, const SDL_DisplayMode *mode, SDL_DisplayMode *closest)
 Get the closest match to the requested display mode.
DECLSPEC int SDLCALL SDL_GetWindowDisplayIndex (SDL_Window *window)
 Get the display index associated with a window.
DECLSPEC int SDLCALL SDL_SetWindowDisplayMode (SDL_Window *window, const SDL_DisplayMode *mode)
 Set the display mode used when a fullscreen window is visible.
DECLSPEC int SDLCALL SDL_GetWindowDisplayMode (SDL_Window *window, SDL_DisplayMode *mode)
 Fill in information about the display mode used when a fullscreen window is visible.
DECLSPEC Uint32 SDLCALL SDL_GetWindowPixelFormat (SDL_Window *window)
 Get the pixel format associated with the window.
DECLSPEC SDL_Window *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_Window *SDLCALL SDL_CreateWindowFrom (const void *data)
 Create an SDL window from an existing native window.
DECLSPEC Uint32 SDLCALL SDL_GetWindowID (SDL_Window *window)
 Get the numeric ID of a window, for logging purposes.
DECLSPEC SDL_Window *SDLCALL SDL_GetWindowFromID (Uint32 id)
 Get a window from a stored ID, or NULL if it doesn't exist.
DECLSPEC Uint32 SDLCALL SDL_GetWindowFlags (SDL_Window *window)
 Get the window flags.
DECLSPEC void SDLCALL SDL_SetWindowTitle (SDL_Window *window, const char *title)
 Set the title of a window, in UTF-8 format.
DECLSPEC const char *SDLCALL SDL_GetWindowTitle (SDL_Window *window)
 Get the title of a window, in UTF-8 format.
DECLSPEC void SDLCALL SDL_SetWindowIcon (SDL_Window *window, SDL_Surface *icon)
 Set the icon for a window.
DECLSPEC void *SDLCALL SDL_SetWindowData (SDL_Window *window, const char *name, void *userdata)
 Associate an arbitrary named pointer with a window.
DECLSPEC void *SDLCALL SDL_GetWindowData (SDL_Window *window, const char *name)
 Retrieve the data pointer associated with a window.
DECLSPEC void SDLCALL SDL_SetWindowPosition (SDL_Window *window, int x, int y)
 Set the position of a window.
DECLSPEC void SDLCALL SDL_GetWindowPosition (SDL_Window *window, int *x, int *y)
 Get the position of a window.
DECLSPEC void SDLCALL SDL_SetWindowSize (SDL_Window *window, int w, int h)
 Set the size of a window's client area.
DECLSPEC void SDLCALL SDL_GetWindowSize (SDL_Window *window, int *w, int *h)
 Get the size of a window's client area.
DECLSPEC void SDLCALL SDL_SetWindowMinimumSize (SDL_Window *window, int min_w, int min_h)
 Set the minimum size of a window's client area.
DECLSPEC void SDLCALL SDL_GetWindowMinimumSize (SDL_Window *window, int *w, int *h)
 Get the minimum size of a window's client area.
DECLSPEC void SDLCALL SDL_SetWindowMaximumSize (SDL_Window *window, int max_w, int max_h)
 Set the maximum size of a window's client area.
DECLSPEC void SDLCALL SDL_GetWindowMaximumSize (SDL_Window *window, int *w, int *h)
 Get the maximum size of a window's client area.
DECLSPEC void SDLCALL SDL_SetWindowBordered (SDL_Window *window, SDL_bool bordered)
 Set the border state of a window.
DECLSPEC void SDLCALL SDL_ShowWindow (SDL_Window *window)
 Show a window.
DECLSPEC void SDLCALL SDL_HideWindow (SDL_Window *window)
 Hide a window.
DECLSPEC void SDLCALL SDL_RaiseWindow (SDL_Window *window)
 Raise a window above other windows and set the input focus.
DECLSPEC void SDLCALL SDL_MaximizeWindow (SDL_Window *window)
 Make a window as large as possible.
DECLSPEC void SDLCALL SDL_MinimizeWindow (SDL_Window *window)
 Minimize a window to an iconic representation.
DECLSPEC void SDLCALL SDL_RestoreWindow (SDL_Window *window)
 Restore the size and position of a minimized or maximized window.
DECLSPEC int SDLCALL SDL_SetWindowFullscreen (SDL_Window *window, Uint32 flags)
 Set a window's fullscreen state.
DECLSPEC SDL_Surface *SDLCALL SDL_GetWindowSurface (SDL_Window *window)
 Get the SDL surface associated with the window.
DECLSPEC int SDLCALL SDL_UpdateWindowSurface (SDL_Window *window)
 Copy the window surface to the screen.
DECLSPEC int SDLCALL SDL_UpdateWindowSurfaceRects (SDL_Window *window, const SDL_Rect *rects, int numrects)
 Copy a number of rectangles on the window surface to the screen.
DECLSPEC void SDLCALL SDL_SetWindowGrab (SDL_Window *window, SDL_bool grabbed)
 Set a window's input grab mode.
DECLSPEC SDL_bool SDLCALL SDL_GetWindowGrab (SDL_Window *window)
 Get a window's input grab mode.
DECLSPEC int SDLCALL SDL_SetWindowBrightness (SDL_Window *window, float brightness)
 Set the brightness (gamma correction) for a window.
DECLSPEC float SDLCALL SDL_GetWindowBrightness (SDL_Window *window)
 Get the brightness (gamma correction) for a window.
DECLSPEC int SDLCALL SDL_SetWindowGammaRamp (SDL_Window *window, const Uint16 *red, const Uint16 *green, const Uint16 *blue)
 Set the gamma ramp for a window.
DECLSPEC int SDLCALL SDL_GetWindowGammaRamp (SDL_Window *window, Uint16 *red, Uint16 *green, Uint16 *blue)
 Get the gamma ramp for a window.
DECLSPEC void SDLCALL SDL_DestroyWindow (SDL_Window *window)
 Destroy a window.
DECLSPEC SDL_bool SDLCALL SDL_IsScreenSaverEnabled (void)
 Returns whether the screensaver is currently enabled (default on).
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.
OpenGL support functions
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 void SDLCALL SDL_GL_ResetAttributes (void)
 Reset all previously set OpenGL context attributes to their default values.
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)
 Get the actual value for an attribute from the current context.
DECLSPEC SDL_GLContext SDLCALL SDL_GL_CreateContext (SDL_Window *window)
 Create an OpenGL context for use with an OpenGL window, and make it current.
DECLSPEC int SDLCALL SDL_GL_MakeCurrent (SDL_Window *window, SDL_GLContext context)
 Set up an OpenGL context for rendering into an OpenGL window.
DECLSPEC SDL_Window *SDLCALL SDL_GL_GetCurrentWindow (void)
 Get the currently active OpenGL window.
DECLSPEC SDL_GLContext SDLCALL SDL_GL_GetCurrentContext (void)
 Get the currently active OpenGL context.
DECLSPEC void SDLCALL SDL_GL_GetDrawableSize (SDL_Window *window, int *w, int *h)
 Get the size of a window's underlying drawable (for use with glViewport).
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_Window *window)
 Swap the OpenGL buffers for a 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.

Definition in file SDL_video.h.


Typedef Documentation

typedef void* SDL_GLContext

An opaque handle to an OpenGL context.

Definition at line 161 of file SDL_video.h.


Enumeration Type Documentation

enum SDL_GLattr

OpenGL configuration attributes.

Definition at line 166 of file SDL_video.h.

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 has been resized to data1xdata2.

SDL_WINDOWEVENT_SIZE_CHANGED 

The window size has changed, either as a result of an API call or through the system or user changing the window size.

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 

Window has gained mouse focus.

SDL_WINDOWEVENT_LEAVE 

Window has lost mouse focus.

SDL_WINDOWEVENT_FOCUS_GAINED 

Window has gained keyboard focus.

SDL_WINDOWEVENT_FOCUS_LOST 

Window has lost keyboard focus.

SDL_WINDOWEVENT_CLOSE 

The window manager requests that the window be closed.

Definition at line 135 of file SDL_video.h.

The flags on a window.

See also:
SDL_GetWindowFlags()
Enumerator:
SDL_WINDOW_FULLSCREEN 

fullscreen window

SDL_WINDOW_OPENGL 

window usable with OpenGL context

SDL_WINDOW_SHOWN 

window is visible

SDL_WINDOW_HIDDEN 

window is not visible

SDL_WINDOW_BORDERLESS 

no window decoration

SDL_WINDOW_RESIZABLE 

window can be resized

SDL_WINDOW_MINIMIZED 

window is minimized

SDL_WINDOW_MAXIMIZED 

window is 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

SDL_WINDOW_ALLOW_HIGHDPI 

window should be created in high-DPI mode if supported

Definition at line 96 of file SDL_video.h.


Function Documentation

DECLSPEC SDL_Window* 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.

Parameters:
titleThe title of the window, in UTF-8 encoding.
xThe x position of the window, SDL_WINDOWPOS_CENTERED, or SDL_WINDOWPOS_UNDEFINED.
yThe y position of the window, SDL_WINDOWPOS_CENTERED, or SDL_WINDOWPOS_UNDEFINED.
wThe width of the window.
hThe height of the window.
flagsThe flags for the window, a mask of any of the following: SDL_WINDOW_FULLSCREEN, SDL_WINDOW_OPENGL, SDL_WINDOW_HIDDEN, SDL_WINDOW_BORDERLESS, SDL_WINDOW_RESIZABLE, SDL_WINDOW_MAXIMIZED, SDL_WINDOW_MINIMIZED, SDL_WINDOW_INPUT_GRABBED, SDL_WINDOW_ALLOW_HIGHDPI.
Returns:
The id of the window created, or zero if window creation failed.
See also:
SDL_DestroyWindow()
DECLSPEC SDL_Window* SDLCALL SDL_CreateWindowFrom ( const void *  data )

Create an SDL window from an existing native window.

Parameters:
dataA pointer to driver-dependent window creation data
Returns:
The id of the window created, or zero if window creation failed.
See also:
SDL_DestroyWindow()
DECLSPEC void SDLCALL SDL_DestroyWindow ( SDL_Window window )

Destroy a window.

DECLSPEC void SDLCALL SDL_DisableScreenSaver ( void   )

Prevent the screen from being blanked by a screensaver.

See also:
SDL_IsScreenSaverEnabled()
SDL_EnableScreenSaver()
DECLSPEC void SDLCALL SDL_EnableScreenSaver ( void   )

Allow the screen to be blanked by a screensaver.

See also:
SDL_IsScreenSaverEnabled()
SDL_DisableScreenSaver()
DECLSPEC SDL_DisplayMode* SDLCALL SDL_GetClosestDisplayMode ( int  displayIndex,
const SDL_DisplayMode mode,
SDL_DisplayMode closest 
)

Get the closest match to the requested display mode.

Parameters:
displayIndexThe index of display from which mode should be queried.
modeThe desired display mode
closestA 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()
DECLSPEC int SDLCALL SDL_GetCurrentDisplayMode ( int  displayIndex,
SDL_DisplayMode mode 
)

Fill in information about the current display mode.

DECLSPEC const char* SDLCALL 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()
DECLSPEC int SDLCALL SDL_GetDesktopDisplayMode ( int  displayIndex,
SDL_DisplayMode mode 
)

Fill in information about the desktop display mode.

DECLSPEC int SDLCALL SDL_GetDisplayBounds ( int  displayIndex,
SDL_Rect rect 
)

Get the desktop area represented by a display, with the primary display located at 0,0.

Returns:
0 on success, or -1 if the index is out of range.
See also:
SDL_GetNumVideoDisplays()
DECLSPEC int SDLCALL SDL_GetDisplayMode ( int  displayIndex,
int  modeIndex,
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()
DECLSPEC const char* SDLCALL SDL_GetDisplayName ( int  displayIndex )

Get the name of a display in UTF-8 encoding.

Returns:
The name of a display, or NULL for an invalid display index.
See also:
SDL_GetNumVideoDisplays()
DECLSPEC int SDLCALL SDL_GetNumDisplayModes ( int  displayIndex )

Returns the number of available display modes.

See also:
SDL_GetDisplayMode()
DECLSPEC int SDLCALL SDL_GetNumVideoDisplays ( void   )

Returns the number of available video displays.

See also:
SDL_GetDisplayBounds()
DECLSPEC int SDLCALL SDL_GetNumVideoDrivers ( void   )

Get the number of video drivers compiled into SDL.

See also:
SDL_GetVideoDriver()
DECLSPEC const char* SDLCALL 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()
DECLSPEC float SDLCALL SDL_GetWindowBrightness ( SDL_Window window )

Get the brightness (gamma correction) for a window.

Returns:
The last brightness value passed to SDL_SetWindowBrightness()
See also:
SDL_SetWindowBrightness()
DECLSPEC void* SDLCALL SDL_GetWindowData ( SDL_Window window,
const char *  name 
)

Retrieve the data pointer associated with a window.

Parameters:
windowThe window to query.
nameThe name of the pointer.
Returns:
The value associated with 'name'
See also:
SDL_SetWindowData()
DECLSPEC int SDLCALL SDL_GetWindowDisplayIndex ( SDL_Window window )

Get the display index associated with a window.

Returns:
the display index of the display containing the center of the window, or -1 on error.
DECLSPEC int SDLCALL SDL_GetWindowDisplayMode ( SDL_Window window,
SDL_DisplayMode mode 
)

Fill in information about the display mode used when a fullscreen window is visible.

See also:
SDL_SetWindowDisplayMode()
SDL_SetWindowFullscreen()
DECLSPEC Uint32 SDLCALL SDL_GetWindowFlags ( SDL_Window window )

Get the window flags.

DECLSPEC SDL_Window* SDLCALL SDL_GetWindowFromID ( Uint32  id )

Get a window from a stored ID, or NULL if it doesn't exist.

DECLSPEC int SDLCALL SDL_GetWindowGammaRamp ( SDL_Window window,
Uint16 red,
Uint16 green,
Uint16 blue 
)

Get the gamma ramp for a window.

Parameters:
windowThe window from which the gamma ramp should be queried.
redA pointer to a 256 element array of 16-bit quantities to hold the translation table for the red channel, or NULL.
greenA pointer to a 256 element array of 16-bit quantities to hold the translation table for the green channel, or NULL.
blueA 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_SetWindowGammaRamp()
DECLSPEC SDL_bool SDLCALL SDL_GetWindowGrab ( SDL_Window window )

Get a window's input grab mode.

Returns:
This returns SDL_TRUE if input is grabbed, and SDL_FALSE otherwise.
See also:
SDL_SetWindowGrab()
DECLSPEC Uint32 SDLCALL SDL_GetWindowID ( SDL_Window window )

Get the numeric ID of a window, for logging purposes.

DECLSPEC void SDLCALL SDL_GetWindowMaximumSize ( SDL_Window window,
int *  w,
int *  h 
)

Get the maximum size of a window's client area.

Parameters:
windowThe window to query.
wPointer to variable for storing the maximum width, may be NULL
hPointer to variable for storing the maximum height, may be NULL
See also:
SDL_GetWindowMinimumSize()
SDL_SetWindowMaximumSize()
DECLSPEC void SDLCALL SDL_GetWindowMinimumSize ( SDL_Window window,
int *  w,
int *  h 
)

Get the minimum size of a window's client area.

Parameters:
windowThe window to query.
wPointer to variable for storing the minimum width, may be NULL
hPointer to variable for storing the minimum height, may be NULL
See also:
SDL_GetWindowMaximumSize()
SDL_SetWindowMinimumSize()
DECLSPEC Uint32 SDLCALL SDL_GetWindowPixelFormat ( SDL_Window window )

Get the pixel format associated with the window.

DECLSPEC void SDLCALL SDL_GetWindowPosition ( SDL_Window window,
int *  x,
int *  y 
)

Get the position of a window.

Parameters:
windowThe window to query.
xPointer to variable for storing the x position, may be NULL
yPointer to variable for storing the y position, may be NULL
See also:
SDL_SetWindowPosition()
DECLSPEC void SDLCALL SDL_GetWindowSize ( SDL_Window window,
int *  w,
int *  h 
)

Get the size of a window's client area.

Parameters:
windowThe window to query.
wPointer to variable for storing the width, may be NULL
hPointer to variable for storing the height, may be NULL
See also:
SDL_SetWindowSize()
DECLSPEC SDL_Surface* SDLCALL SDL_GetWindowSurface ( SDL_Window window )

Get the SDL surface associated with the window.

Returns:
The window's framebuffer surface, or NULL on error.

A new surface will be created with the optimal format for the window, if necessary. This surface will be freed when the window is destroyed.

Note:
You may not combine this with 3D or the rendering API on this window.
See also:
SDL_UpdateWindowSurface()
SDL_UpdateWindowSurfaceRects()
DECLSPEC const char* SDLCALL SDL_GetWindowTitle ( SDL_Window window )

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

See also:
SDL_SetWindowTitle()
DECLSPEC SDL_GLContext SDLCALL SDL_GL_CreateContext ( SDL_Window window )

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

See also:
SDL_GL_DeleteContext()
DECLSPEC void SDLCALL SDL_GL_DeleteContext ( SDL_GLContext  context )

Delete an OpenGL context.

See also:
SDL_GL_CreateContext()
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_GetAttribute ( SDL_GLattr  attr,
int *  value 
)

Get the actual value for an attribute from the current context.

DECLSPEC SDL_GLContext SDLCALL SDL_GL_GetCurrentContext ( void   )

Get the currently active OpenGL context.

DECLSPEC SDL_Window* SDLCALL SDL_GL_GetCurrentWindow ( void   )

Get the currently active OpenGL window.

DECLSPEC void SDLCALL SDL_GL_GetDrawableSize ( SDL_Window window,
int *  w,
int *  h 
)

Get the size of a window's underlying drawable (for use with glViewport).

Parameters:
windowWindow from which the drawable size should be queried
wPointer to variable for storing the width, may be NULL
hPointer to variable for storing the height, may be NULL

This may differ from SDL_GetWindowSize if we're rendering to a high-DPI drawable, i.e. the window was created with SDL_WINDOW_ALLOW_HIGHDPI on a platform with high-DPI support (Apple calls this "Retina"), and not disabled by the SDL_HINT_VIDEO_HIGHDPI_DISABLED hint.

See also:
SDL_GetWindowSize()
SDL_CreateWindow()
DECLSPEC void* SDLCALL SDL_GL_GetProcAddress ( const char *  proc )

Get the address of an OpenGL function.

DECLSPEC int SDLCALL 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 late swaps happen immediately instead of waiting for the next retrace. If the system can't determine the swap interval, or there isn't a valid current context, this will return 0 as a safe default.
See also:
SDL_GL_SetSwapInterval()
DECLSPEC int SDLCALL SDL_GL_LoadLibrary ( const char *  path )

Dynamically load an OpenGL library.

Parameters:
pathThe 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()
DECLSPEC int SDLCALL SDL_GL_MakeCurrent ( SDL_Window window,
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.
DECLSPEC void SDLCALL SDL_GL_ResetAttributes ( void   )

Reset all previously set OpenGL context attributes to their default values.

DECLSPEC int SDLCALL SDL_GL_SetAttribute ( SDL_GLattr  attr,
int  value 
)

Set an OpenGL window attribute before window creation.

DECLSPEC int SDLCALL SDL_GL_SetSwapInterval ( int  interval )

Set the swap interval for the current OpenGL context.

Parameters:
interval0 for immediate updates, 1 for updates synchronized with the vertical retrace. If the system supports it, you may specify -1 to allow late swaps to happen immediately instead of waiting for the next retrace.
Returns:
0 on success, or -1 if setting the swap interval is not supported.
See also:
SDL_GL_GetSwapInterval()
DECLSPEC void SDLCALL SDL_GL_SwapWindow ( SDL_Window window )

Swap the OpenGL buffers for a window, if double-buffering is supported.

DECLSPEC void SDLCALL SDL_GL_UnloadLibrary ( void   )

Unload the OpenGL library previously loaded by SDL_GL_LoadLibrary().

See also:
SDL_GL_LoadLibrary()
DECLSPEC void SDLCALL SDL_HideWindow ( SDL_Window window )

Hide a window.

See also:
SDL_ShowWindow()
DECLSPEC SDL_bool SDLCALL SDL_IsScreenSaverEnabled ( void   )

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

See also:
SDL_EnableScreenSaver()
SDL_DisableScreenSaver()
DECLSPEC void SDLCALL SDL_MaximizeWindow ( SDL_Window window )

Make a window as large as possible.

See also:
SDL_RestoreWindow()
DECLSPEC void SDLCALL SDL_MinimizeWindow ( SDL_Window window )

Minimize a window to an iconic representation.

See also:
SDL_RestoreWindow()
DECLSPEC void SDLCALL SDL_RaiseWindow ( SDL_Window window )

Raise a window above other windows and set the input focus.

DECLSPEC void SDLCALL SDL_RestoreWindow ( SDL_Window window )

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

See also:
SDL_MaximizeWindow()
SDL_MinimizeWindow()
DECLSPEC void SDLCALL SDL_SetWindowBordered ( SDL_Window window,
SDL_bool  bordered 
)

Set the border state of a window.

This will add or remove the window's SDL_WINDOW_BORDERLESS flag and add or remove the border from the actual window. This is a no-op if the window's border already matches the requested state.

Parameters:
windowThe window of which to change the border state.
borderedSDL_FALSE to remove border, SDL_TRUE to add border.
Note:
You can't change the border state of a fullscreen window.
See also:
SDL_GetWindowFlags()
DECLSPEC int SDLCALL SDL_SetWindowBrightness ( SDL_Window window,
float  brightness 
)

Set the brightness (gamma correction) for a window.

Returns:
0 on success, or -1 if setting the brightness isn't supported.
See also:
SDL_GetWindowBrightness()
SDL_SetWindowGammaRamp()
DECLSPEC void* SDLCALL SDL_SetWindowData ( SDL_Window window,
const char *  name,
void *  userdata 
)

Associate an arbitrary named pointer with a window.

Parameters:
windowThe window to associate with the pointer.
nameThe name of the pointer.
userdataThe associated pointer.
Returns:
The previous value associated with 'name'
Note:
The name is case-sensitive.
See also:
SDL_GetWindowData()
DECLSPEC int SDLCALL SDL_SetWindowDisplayMode ( SDL_Window window,
const SDL_DisplayMode mode 
)

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

By default the window's dimensions and the desktop format and refresh rate are used.

Parameters:
windowThe window for which the display mode should be set.
modeThe mode to use, or NULL for the default mode.
Returns:
0 on success, or -1 if setting the display mode failed.
See also:
SDL_GetWindowDisplayMode()
SDL_SetWindowFullscreen()
DECLSPEC int SDLCALL SDL_SetWindowFullscreen ( SDL_Window window,
Uint32  flags 
)

Set a window's fullscreen state.

Returns:
0 on success, or -1 if setting the display mode failed.
See also:
SDL_SetWindowDisplayMode()
SDL_GetWindowDisplayMode()
DECLSPEC int SDLCALL SDL_SetWindowGammaRamp ( SDL_Window window,
const Uint16 red,
const Uint16 green,
const Uint16 blue 
)

Set the gamma ramp for a window.

Parameters:
windowThe window for which the gamma ramp should be set.
redThe translation table for the red channel, or NULL.
greenThe translation table for the green channel, or NULL.
blueThe 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_GetWindowGammaRamp()
DECLSPEC void SDLCALL SDL_SetWindowGrab ( SDL_Window window,
SDL_bool  grabbed 
)

Set a window's input grab mode.

Parameters:
windowThe window for which the input grab mode should be set.
grabbedThis is SDL_TRUE to grab input, and SDL_FALSE to release input.
See also:
SDL_GetWindowGrab()
DECLSPEC void SDLCALL SDL_SetWindowIcon ( SDL_Window window,
SDL_Surface icon 
)

Set the icon for a window.

Parameters:
windowThe window for which the icon should be set.
iconThe icon for the window.
DECLSPEC void SDLCALL SDL_SetWindowMaximumSize ( SDL_Window window,
int  max_w,
int  max_h 
)

Set the maximum size of a window's client area.

Parameters:
windowThe window to set a new maximum size.
max_wThe maximum width of the window, must be >0
max_hThe maximum height of the window, must be >0
Note:
You can't change the maximum size of a fullscreen window, it automatically matches the size of the display mode.
See also:
SDL_GetWindowMaximumSize()
SDL_SetWindowMinimumSize()
DECLSPEC void SDLCALL SDL_SetWindowMinimumSize ( SDL_Window window,
int  min_w,
int  min_h 
)

Set the minimum size of a window's client area.

Parameters:
windowThe window to set a new minimum size.
min_wThe minimum width of the window, must be >0
min_hThe minimum height of the window, must be >0
Note:
You can't change the minimum size of a fullscreen window, it automatically matches the size of the display mode.
See also:
SDL_GetWindowMinimumSize()
SDL_SetWindowMaximumSize()
DECLSPEC void SDLCALL SDL_SetWindowPosition ( SDL_Window window,
int  x,
int  y 
)

Set the position of a window.

Parameters:
windowThe window to reposition.
xThe x coordinate of the window, SDL_WINDOWPOS_CENTERED, or SDL_WINDOWPOS_UNDEFINED.
yThe 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()
DECLSPEC void SDLCALL SDL_SetWindowSize ( SDL_Window window,
int  w,
int  h 
)

Set the size of a window's client area.

Parameters:
windowThe window to resize.
wThe width of the window, must be >0
hThe height of the window, must be >0
Note:
You can't change the size of a fullscreen window, it automatically matches the size of the display mode.
See also:
SDL_GetWindowSize()
DECLSPEC void SDLCALL SDL_SetWindowTitle ( SDL_Window window,
const char *  title 
)

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

See also:
SDL_GetWindowTitle()
DECLSPEC void SDLCALL SDL_ShowWindow ( SDL_Window window )

Show a window.

See also:
SDL_HideWindow()
DECLSPEC int SDLCALL SDL_UpdateWindowSurface ( SDL_Window window )

Copy the window surface to the screen.

Returns:
0 on success, or -1 on error.
See also:
SDL_GetWindowSurface()
SDL_UpdateWindowSurfaceRects()
DECLSPEC int SDLCALL SDL_UpdateWindowSurfaceRects ( SDL_Window window,
const SDL_Rect rects,
int  numrects 
)

Copy a number of rectangles on the window surface to the screen.

Returns:
0 on success, or -1 on error.
See also:
SDL_GetWindowSurface()
SDL_UpdateWindowSurfaceRect()
DECLSPEC int SDLCALL SDL_VideoInit ( const char *  driver_name )

Initialize the video subsystem, optionally specifying a video driver.

Parameters:
driver_nameInitialize a specific driver by name, or NULL for the default video driver.
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()
DECLSPEC void SDLCALL SDL_VideoQuit ( void   )

Shuts down the video subsystem.

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

See also:
SDL_VideoInit()