arsa  2.7
Classes | Macros | Typedefs | Enumerations | Functions
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.

Classes

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

Macros

#define SDL_WINDOWPOS_UNDEFINED_MASK   0x1FFF0000u
 Used to indicate that you don't care what the window position is. More...
 
#define SDL_WINDOWPOS_UNDEFINED_DISPLAY(X)   (SDL_WINDOWPOS_UNDEFINED_MASK|(X))
 
#define SDL_WINDOWPOS_UNDEFINED   SDL_WINDOWPOS_UNDEFINED_DISPLAY(0)
 
#define SDL_WINDOWPOS_ISUNDEFINED(X)   (((X)&0xFFFF0000) == SDL_WINDOWPOS_UNDEFINED_MASK)
 
#define SDL_WINDOWPOS_CENTERED_MASK   0x2FFF0000u
 Used to indicate that the window position should be centered. More...
 
#define SDL_WINDOWPOS_CENTERED_DISPLAY(X)   (SDL_WINDOWPOS_CENTERED_MASK|(X))
 
#define SDL_WINDOWPOS_CENTERED   SDL_WINDOWPOS_CENTERED_DISPLAY(0)
 
#define SDL_WINDOWPOS_ISCENTERED(X)   (((X)&0xFFFF0000) == SDL_WINDOWPOS_CENTERED_MASK)
 

Typedefs

typedef struct SDL_Window SDL_Window
 The type used to identify a window. More...
 
typedef voidSDL_GLContext
 An opaque handle to an OpenGL context. More...
 
typedef SDL_HitTestResult(SDLCALLSDL_HitTest) (SDL_Window *win, const SDL_Point *area, void *data)
 Callback used for hit-testing. More...
 

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_FULLSCREEN_DESKTOP = ( SDL_WINDOW_FULLSCREEN | 0x00001000 ),
  SDL_WINDOW_FOREIGN = 0x00000800, SDL_WINDOW_ALLOW_HIGHDPI = 0x00002000, SDL_WINDOW_MOUSE_CAPTURE = 0x00004000, SDL_WINDOW_ALWAYS_ON_TOP = 0x00008000,
  SDL_WINDOW_SKIP_TASKBAR = 0x00010000, SDL_WINDOW_UTILITY = 0x00020000, SDL_WINDOW_TOOLTIP = 0x00040000, SDL_WINDOW_POPUP_MENU = 0x00080000,
  SDL_WINDOW_VULKAN = 0x10000000
}
 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, SDL_WINDOWEVENT_TAKE_FOCUS,
  SDL_WINDOWEVENT_HIT_TEST
}
 Event subtype for window events. More...
 
enum  SDL_DisplayEventID { SDL_DISPLAYEVENT_NONE, SDL_DISPLAYEVENT_ORIENTATION }
 Event subtype for display events. More...
 
enum  SDL_DisplayOrientation {
  SDL_ORIENTATION_UNKNOWN, SDL_ORIENTATION_LANDSCAPE, SDL_ORIENTATION_LANDSCAPE_FLIPPED, SDL_ORIENTATION_PORTRAIT,
  SDL_ORIENTATION_PORTRAIT_FLIPPED
}
 
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, SDL_GL_CONTEXT_EGL,
  SDL_GL_CONTEXT_FLAGS, SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_SHARE_WITH_CURRENT_CONTEXT, SDL_GL_FRAMEBUFFER_SRGB_CAPABLE,
  SDL_GL_CONTEXT_RELEASE_BEHAVIOR, SDL_GL_CONTEXT_RESET_NOTIFICATION, SDL_GL_CONTEXT_NO_ERROR
}
 OpenGL configuration attributes. More...
 
enum  SDL_GLprofile { SDL_GL_CONTEXT_PROFILE_CORE = 0x0001, SDL_GL_CONTEXT_PROFILE_COMPATIBILITY = 0x0002, SDL_GL_CONTEXT_PROFILE_ES = 0x0004 }
 
enum  SDL_GLcontextFlag { SDL_GL_CONTEXT_DEBUG_FLAG = 0x0001, SDL_GL_CONTEXT_FORWARD_COMPATIBLE_FLAG = 0x0002, SDL_GL_CONTEXT_ROBUST_ACCESS_FLAG = 0x0004, SDL_GL_CONTEXT_RESET_ISOLATION_FLAG = 0x0008 }
 
enum  SDL_GLcontextReleaseFlag { SDL_GL_CONTEXT_RELEASE_BEHAVIOR_NONE = 0x0000, SDL_GL_CONTEXT_RELEASE_BEHAVIOR_FLUSH = 0x0001 }
 
enum  SDL_GLContextResetNotification { SDL_GL_CONTEXT_RESET_NO_NOTIFICATION = 0x0000, SDL_GL_CONTEXT_RESET_LOSE_CONTEXT = 0x0001 }
 
enum  SDL_HitTestResult {
  SDL_HITTEST_NORMAL, SDL_HITTEST_DRAGGABLE, SDL_HITTEST_RESIZE_TOPLEFT, SDL_HITTEST_RESIZE_TOP,
  SDL_HITTEST_RESIZE_TOPRIGHT, SDL_HITTEST_RESIZE_RIGHT, SDL_HITTEST_RESIZE_BOTTOMRIGHT, SDL_HITTEST_RESIZE_BOTTOM,
  SDL_HITTEST_RESIZE_BOTTOMLEFT, SDL_HITTEST_RESIZE_LEFT
}
 Possible return values from the SDL_HitTest callback. More...
 

Functions

DECLSPEC int SDLCALL SDL_GetNumVideoDrivers (void)
 Get the number of video drivers compiled into SDL. More...
 
DECLSPEC const char *SDLCALL SDL_GetVideoDriver (int index)
 Get the name of a built in video driver. More...
 
DECLSPEC int SDLCALL SDL_VideoInit (const char *driver_name)
 Initialize the video subsystem, optionally specifying a video driver. More...
 
DECLSPEC void SDLCALL SDL_VideoQuit (void)
 Shuts down the video subsystem. More...
 
DECLSPEC const char *SDLCALL SDL_GetCurrentVideoDriver (void)
 Returns the name of the currently initialized video driver. More...
 
DECLSPEC int SDLCALL SDL_GetNumVideoDisplays (void)
 Returns the number of available video displays. More...
 
DECLSPEC const char *SDLCALL SDL_GetDisplayName (int displayIndex)
 Get the name of a display in UTF-8 encoding. More...
 
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. More...
 
DECLSPEC int SDLCALL SDL_GetDisplayUsableBounds (int displayIndex, SDL_Rect *rect)
 Get the usable desktop area represented by a display, with the primary display located at 0,0. More...
 
DECLSPEC int SDLCALL SDL_GetDisplayDPI (int displayIndex, float *ddpi, float *hdpi, float *vdpi)
 Get the dots/pixels-per-inch for a display. More...
 
DECLSPEC SDL_DisplayOrientation SDLCALL SDL_GetDisplayOrientation (int displayIndex)
 Get the orientation of a display. More...
 
DECLSPEC int SDLCALL SDL_GetNumDisplayModes (int displayIndex)
 Returns the number of available display modes. More...
 
DECLSPEC int SDLCALL SDL_GetDisplayMode (int displayIndex, int modeIndex, SDL_DisplayMode *mode)
 Fill in information about a specific display mode. More...
 
DECLSPEC int SDLCALL SDL_GetDesktopDisplayMode (int displayIndex, SDL_DisplayMode *mode)
 Fill in information about the desktop display mode. More...
 
DECLSPEC int SDLCALL SDL_GetCurrentDisplayMode (int displayIndex, SDL_DisplayMode *mode)
 Fill in information about the current display mode. More...
 
DECLSPEC SDL_DisplayMode *SDLCALL SDL_GetClosestDisplayMode (int displayIndex, const SDL_DisplayMode *mode, SDL_DisplayMode *closest)
 Get the closest match to the requested display mode. More...
 
DECLSPEC int SDLCALL SDL_GetWindowDisplayIndex (SDL_Window *window)
 Get the display index associated with a window. More...
 
DECLSPEC int SDLCALL SDL_SetWindowDisplayMode (SDL_Window *window, const SDL_DisplayMode *mode)
 Set the display mode used when a fullscreen window is visible. More...
 
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. More...
 
DECLSPEC Uint32 SDLCALL SDL_GetWindowPixelFormat (SDL_Window *window)
 Get the pixel format associated with the window. More...
 
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. More...
 
DECLSPEC SDL_Window *SDLCALL SDL_CreateWindowFrom (const void *data)
 Create an SDL window from an existing native window. More...
 
DECLSPEC Uint32 SDLCALL SDL_GetWindowID (SDL_Window *window)
 Get the numeric ID of a window, for logging purposes. More...
 
DECLSPEC SDL_Window *SDLCALL SDL_GetWindowFromID (Uint32 id)
 Get a window from a stored ID, or NULL if it doesn't exist. More...
 
DECLSPEC Uint32 SDLCALL SDL_GetWindowFlags (SDL_Window *window)
 Get the window flags. More...
 
DECLSPEC void SDLCALL SDL_SetWindowTitle (SDL_Window *window, const char *title)
 Set the title of a window, in UTF-8 format. More...
 
DECLSPEC const char *SDLCALL SDL_GetWindowTitle (SDL_Window *window)
 Get the title of a window, in UTF-8 format. More...
 
DECLSPEC void SDLCALL SDL_SetWindowIcon (SDL_Window *window, SDL_Surface *icon)
 Set the icon for a window. More...
 
DECLSPEC void *SDLCALL SDL_SetWindowData (SDL_Window *window, const char *name, void *userdata)
 Associate an arbitrary named pointer with a window. More...
 
DECLSPEC void *SDLCALL SDL_GetWindowData (SDL_Window *window, const char *name)
 Retrieve the data pointer associated with a window. More...
 
DECLSPEC void SDLCALL SDL_SetWindowPosition (SDL_Window *window, int x, int y)
 Set the position of a window. More...
 
DECLSPEC void SDLCALL SDL_GetWindowPosition (SDL_Window *window, int *x, int *y)
 Get the position of a window. More...
 
DECLSPEC void SDLCALL SDL_SetWindowSize (SDL_Window *window, int w, int h)
 Set the size of a window's client area. More...
 
DECLSPEC void SDLCALL SDL_GetWindowSize (SDL_Window *window, int *w, int *h)
 Get the size of a window's client area. More...
 
DECLSPEC int SDLCALL SDL_GetWindowBordersSize (SDL_Window *window, int *top, int *left, int *bottom, int *right)
 Get the size of a window's borders (decorations) around the client area. More...
 
DECLSPEC void SDLCALL SDL_SetWindowMinimumSize (SDL_Window *window, int min_w, int min_h)
 Set the minimum size of a window's client area. More...
 
DECLSPEC void SDLCALL SDL_GetWindowMinimumSize (SDL_Window *window, int *w, int *h)
 Get the minimum size of a window's client area. More...
 
DECLSPEC void SDLCALL SDL_SetWindowMaximumSize (SDL_Window *window, int max_w, int max_h)
 Set the maximum size of a window's client area. More...
 
DECLSPEC void SDLCALL SDL_GetWindowMaximumSize (SDL_Window *window, int *w, int *h)
 Get the maximum size of a window's client area. More...
 
DECLSPEC void SDLCALL SDL_SetWindowBordered (SDL_Window *window, SDL_bool bordered)
 Set the border state of a window. More...
 
DECLSPEC void SDLCALL SDL_SetWindowResizable (SDL_Window *window, SDL_bool resizable)
 Set the user-resizable state of a window. More...
 
DECLSPEC void SDLCALL SDL_ShowWindow (SDL_Window *window)
 Show a window. More...
 
DECLSPEC void SDLCALL SDL_HideWindow (SDL_Window *window)
 Hide a window. More...
 
DECLSPEC void SDLCALL SDL_RaiseWindow (SDL_Window *window)
 Raise a window above other windows and set the input focus. More...
 
DECLSPEC void SDLCALL SDL_MaximizeWindow (SDL_Window *window)
 Make a window as large as possible. More...
 
DECLSPEC void SDLCALL SDL_MinimizeWindow (SDL_Window *window)
 Minimize a window to an iconic representation. More...
 
DECLSPEC void SDLCALL SDL_RestoreWindow (SDL_Window *window)
 Restore the size and position of a minimized or maximized window. More...
 
DECLSPEC int SDLCALL SDL_SetWindowFullscreen (SDL_Window *window, Uint32 flags)
 Set a window's fullscreen state. More...
 
DECLSPEC SDL_Surface *SDLCALL SDL_GetWindowSurface (SDL_Window *window)
 Get the SDL surface associated with the window. More...
 
DECLSPEC int SDLCALL SDL_UpdateWindowSurface (SDL_Window *window)
 Copy the window surface to the screen. More...
 
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. More...
 
DECLSPEC void SDLCALL SDL_SetWindowGrab (SDL_Window *window, SDL_bool grabbed)
 Set a window's input grab mode. More...
 
DECLSPEC SDL_bool SDLCALL SDL_GetWindowGrab (SDL_Window *window)
 Get a window's input grab mode. More...
 
DECLSPEC SDL_Window *SDLCALL SDL_GetGrabbedWindow (void)
 Get the window that currently has an input grab enabled. More...
 
DECLSPEC int SDLCALL SDL_SetWindowBrightness (SDL_Window *window, float brightness)
 Set the brightness (gamma correction) for a window. More...
 
DECLSPEC float SDLCALL SDL_GetWindowBrightness (SDL_Window *window)
 Get the brightness (gamma correction) for a window. More...
 
DECLSPEC int SDLCALL SDL_SetWindowOpacity (SDL_Window *window, float opacity)
 Set the opacity for a window. More...
 
DECLSPEC int SDLCALL SDL_GetWindowOpacity (SDL_Window *window, float *out_opacity)
 Get the opacity of a window. More...
 
DECLSPEC int SDLCALL SDL_SetWindowModalFor (SDL_Window *modal_window, SDL_Window *parent_window)
 Sets the window as a modal for another window (TODO: reconsider this function and/or its name) More...
 
DECLSPEC int SDLCALL SDL_SetWindowInputFocus (SDL_Window *window)
 Explicitly sets input focus to the window. More...
 
DECLSPEC int SDLCALL SDL_SetWindowGammaRamp (SDL_Window *window, const Uint16 *red, const Uint16 *green, const Uint16 *blue)
 Set the gamma ramp for a window. More...
 
DECLSPEC int SDLCALL SDL_GetWindowGammaRamp (SDL_Window *window, Uint16 *red, Uint16 *green, Uint16 *blue)
 Get the gamma ramp for a window. More...
 
DECLSPEC int SDLCALL SDL_SetWindowHitTest (SDL_Window *window, SDL_HitTest callback, void *callback_data)
 Provide a callback that decides if a window region has special properties. More...
 
DECLSPEC void SDLCALL SDL_DestroyWindow (SDL_Window *window)
 Destroy a window. More...
 
DECLSPEC SDL_bool SDLCALL SDL_IsScreenSaverEnabled (void)
 Returns whether the screensaver is currently enabled (default off). More...
 
DECLSPEC void SDLCALL SDL_EnableScreenSaver (void)
 Allow the screen to be blanked by a screensaver. More...
 
DECLSPEC void SDLCALL SDL_DisableScreenSaver (void)
 Prevent the screen from being blanked by a screensaver. More...
 
OpenGL support functions
DECLSPEC int SDLCALL SDL_GL_LoadLibrary (const char *path)
 Dynamically load an OpenGL library. More...
 
DECLSPEC void *SDLCALL SDL_GL_GetProcAddress (const char *proc)
 Get the address of an OpenGL function. More...
 
DECLSPEC void SDLCALL SDL_GL_UnloadLibrary (void)
 Unload the OpenGL library previously loaded by SDL_GL_LoadLibrary(). More...
 
DECLSPEC SDL_bool SDLCALL SDL_GL_ExtensionSupported (const char *extension)
 Return true if an OpenGL extension is supported for the current context. More...
 
DECLSPEC void SDLCALL SDL_GL_ResetAttributes (void)
 Reset all previously set OpenGL context attributes to their default values. More...
 
DECLSPEC int SDLCALL SDL_GL_SetAttribute (SDL_GLattr attr, int value)
 Set an OpenGL window attribute before window creation. More...
 
DECLSPEC int SDLCALL SDL_GL_GetAttribute (SDL_GLattr attr, int *value)
 Get the actual value for an attribute from the current context. More...
 
DECLSPEC SDL_GLContext SDLCALL SDL_GL_CreateContext (SDL_Window *window)
 Create an OpenGL context for use with an OpenGL window, and make it current. More...
 
DECLSPEC int SDLCALL SDL_GL_MakeCurrent (SDL_Window *window, SDL_GLContext context)
 Set up an OpenGL context for rendering into an OpenGL window. More...
 
DECLSPEC SDL_Window *SDLCALL SDL_GL_GetCurrentWindow (void)
 Get the currently active OpenGL window. More...
 
DECLSPEC SDL_GLContext SDLCALL SDL_GL_GetCurrentContext (void)
 Get the currently active OpenGL context. More...
 
DECLSPEC void SDLCALL SDL_GL_GetDrawableSize (SDL_Window *window, int *w, int *h)
 Get the size of a window's underlying drawable in pixels (for use with glViewport). More...
 
DECLSPEC int SDLCALL SDL_GL_SetSwapInterval (int interval)
 Set the swap interval for the current OpenGL context. More...
 
DECLSPEC int SDLCALL SDL_GL_GetSwapInterval (void)
 Get the swap interval for the current OpenGL context. More...
 
DECLSPEC void SDLCALL SDL_GL_SwapWindow (SDL_Window *window)
 Swap the OpenGL buffers for a window, if double-buffering is supported. More...
 
DECLSPEC void SDLCALL SDL_GL_DeleteContext (SDL_GLContext context)
 Delete an OpenGL context. More...
 

Detailed Description

Header file for SDL video functions.

Definition in file SDL_video.h.

Macro Definition Documentation

◆ SDL_WINDOWPOS_CENTERED

#define SDL_WINDOWPOS_CENTERED   SDL_WINDOWPOS_CENTERED_DISPLAY(0)

Definition at line 139 of file SDL_video.h.

◆ SDL_WINDOWPOS_CENTERED_DISPLAY

#define SDL_WINDOWPOS_CENTERED_DISPLAY (   X)    (SDL_WINDOWPOS_CENTERED_MASK|(X))

Definition at line 138 of file SDL_video.h.

◆ SDL_WINDOWPOS_CENTERED_MASK

#define SDL_WINDOWPOS_CENTERED_MASK   0x2FFF0000u

Used to indicate that the window position should be centered.

Definition at line 137 of file SDL_video.h.

◆ SDL_WINDOWPOS_ISCENTERED

#define SDL_WINDOWPOS_ISCENTERED (   X)    (((X)&0xFFFF0000) == SDL_WINDOWPOS_CENTERED_MASK)

Definition at line 140 of file SDL_video.h.

◆ SDL_WINDOWPOS_ISUNDEFINED

#define SDL_WINDOWPOS_ISUNDEFINED (   X)    (((X)&0xFFFF0000) == SDL_WINDOWPOS_UNDEFINED_MASK)

Definition at line 131 of file SDL_video.h.

◆ SDL_WINDOWPOS_UNDEFINED

#define SDL_WINDOWPOS_UNDEFINED   SDL_WINDOWPOS_UNDEFINED_DISPLAY(0)

Definition at line 130 of file SDL_video.h.

◆ SDL_WINDOWPOS_UNDEFINED_DISPLAY

#define SDL_WINDOWPOS_UNDEFINED_DISPLAY (   X)    (SDL_WINDOWPOS_UNDEFINED_MASK|(X))

Definition at line 129 of file SDL_video.h.

◆ SDL_WINDOWPOS_UNDEFINED_MASK

#define SDL_WINDOWPOS_UNDEFINED_MASK   0x1FFF0000u

Used to indicate that you don't care what the window position is.

Definition at line 128 of file SDL_video.h.

Typedef Documentation

◆ SDL_GLContext

typedef void* SDL_GLContext

An opaque handle to an OpenGL context.

Definition at line 193 of file SDL_video.h.

◆ SDL_HitTest

typedef SDL_HitTestResult(SDLCALL * SDL_HitTest) (SDL_Window *win, const SDL_Point *area, void *data)

Callback used for hit-testing.

See also
SDL_SetWindowHitTest

Definition at line 1039 of file SDL_video.h.

◆ SDL_Window

typedef struct SDL_Window SDL_Window

Enumeration Type Documentation

◆ SDL_DisplayEventID

Event subtype for display events.

Enumerator
SDL_DISPLAYEVENT_NONE 

Never used

SDL_DISPLAYEVENT_ORIENTATION 

Display orientation has changed to data1

Definition at line 175 of file SDL_video.h.

176 {
SDL_DisplayEventID
Event subtype for display events.
Definition: SDL_video.h:175

◆ SDL_DisplayOrientation

Enumerator
SDL_ORIENTATION_UNKNOWN 

The display orientation can't be determined

SDL_ORIENTATION_LANDSCAPE 

The display is in landscape mode, with the right side up, relative to portrait mode

SDL_ORIENTATION_LANDSCAPE_FLIPPED 

The display is in landscape mode, with the left side up, relative to portrait mode

SDL_ORIENTATION_PORTRAIT 

The display is in portrait mode

SDL_ORIENTATION_PORTRAIT_FLIPPED 

The display is in portrait mode, upside down

Definition at line 181 of file SDL_video.h.

◆ SDL_GLattr

enum SDL_GLattr

OpenGL configuration attributes.

Enumerator
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 
SDL_GL_CONTEXT_EGL 
SDL_GL_CONTEXT_FLAGS 
SDL_GL_CONTEXT_PROFILE_MASK 
SDL_GL_SHARE_WITH_CURRENT_CONTEXT 
SDL_GL_FRAMEBUFFER_SRGB_CAPABLE 
SDL_GL_CONTEXT_RELEASE_BEHAVIOR 
SDL_GL_CONTEXT_RESET_NOTIFICATION 
SDL_GL_CONTEXT_NO_ERROR 

Definition at line 198 of file SDL_video.h.

199 {
227 } SDL_GLattr;
SDL_GLattr
OpenGL configuration attributes.
Definition: SDL_video.h:198

◆ SDL_GLcontextFlag

Enumerator
SDL_GL_CONTEXT_DEBUG_FLAG 
SDL_GL_CONTEXT_FORWARD_COMPATIBLE_FLAG 
SDL_GL_CONTEXT_ROBUST_ACCESS_FLAG 
SDL_GL_CONTEXT_RESET_ISOLATION_FLAG 

Definition at line 236 of file SDL_video.h.

◆ SDL_GLcontextReleaseFlag

Enumerator
SDL_GL_CONTEXT_RELEASE_BEHAVIOR_NONE 
SDL_GL_CONTEXT_RELEASE_BEHAVIOR_FLUSH 

Definition at line 244 of file SDL_video.h.

◆ SDL_GLContextResetNotification

Enumerator
SDL_GL_CONTEXT_RESET_NO_NOTIFICATION 
SDL_GL_CONTEXT_RESET_LOSE_CONTEXT 

Definition at line 250 of file SDL_video.h.

◆ SDL_GLprofile

Enumerator
SDL_GL_CONTEXT_PROFILE_CORE 
SDL_GL_CONTEXT_PROFILE_COMPATIBILITY 
SDL_GL_CONTEXT_PROFILE_ES 

GLX_CONTEXT_ES2_PROFILE_BIT_EXT

Definition at line 229 of file SDL_video.h.

◆ SDL_HitTestResult

Possible return values from the SDL_HitTest callback.

See also
SDL_HitTest
Enumerator
SDL_HITTEST_NORMAL 

Region is normal. No special properties.

SDL_HITTEST_DRAGGABLE 

Region can drag entire window.

SDL_HITTEST_RESIZE_TOPLEFT 
SDL_HITTEST_RESIZE_TOP 
SDL_HITTEST_RESIZE_TOPRIGHT 
SDL_HITTEST_RESIZE_RIGHT 
SDL_HITTEST_RESIZE_BOTTOMRIGHT 
SDL_HITTEST_RESIZE_BOTTOM 
SDL_HITTEST_RESIZE_BOTTOMLEFT 
SDL_HITTEST_RESIZE_LEFT 

Definition at line 1020 of file SDL_video.h.

◆ SDL_WindowEventID

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

SDL_WINDOWEVENT_TAKE_FOCUS 

Window is being offered a focus (should SetWindowInputFocus() on itself or a subwindow, or ignore)

SDL_WINDOWEVENT_HIT_TEST 

Window had a hit test that wasn't SDL_HITTEST_NORMAL.

Definition at line 146 of file SDL_video.h.

147 {
SDL_WindowEventID
Event subtype for window events.
Definition: SDL_video.h:146

◆ SDL_WindowFlags

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_FULLSCREEN_DESKTOP 
SDL_WINDOW_FOREIGN 

window not created by SDL

SDL_WINDOW_ALLOW_HIGHDPI 

window should be created in high-DPI mode if supported. On macOS NSHighResolutionCapable must be set true in the application's Info.plist for this to have any effect.

SDL_WINDOW_MOUSE_CAPTURE 

window has mouse captured (unrelated to INPUT_GRABBED)

SDL_WINDOW_ALWAYS_ON_TOP 

window should always be above others

SDL_WINDOW_SKIP_TASKBAR 

window should not be added to the taskbar

SDL_WINDOW_UTILITY 

window should be treated as a utility window

SDL_WINDOW_TOOLTIP 

window should be treated as a tooltip

SDL_WINDOW_POPUP_MENU 

window should be treated as a popup menu

SDL_WINDOW_VULKAN 

window usable for Vulkan surface

Definition at line 97 of file SDL_video.h.

98 {
99  /* !!! FIXME: change this to name = (1<<x). */
100  SDL_WINDOW_FULLSCREEN = 0x00000001,
101  SDL_WINDOW_OPENGL = 0x00000002,
102  SDL_WINDOW_SHOWN = 0x00000004,
103  SDL_WINDOW_HIDDEN = 0x00000008,
104  SDL_WINDOW_BORDERLESS = 0x00000010,
105  SDL_WINDOW_RESIZABLE = 0x00000020,
106  SDL_WINDOW_MINIMIZED = 0x00000040,
107  SDL_WINDOW_MAXIMIZED = 0x00000080,
108  SDL_WINDOW_INPUT_GRABBED = 0x00000100,
109  SDL_WINDOW_INPUT_FOCUS = 0x00000200,
110  SDL_WINDOW_MOUSE_FOCUS = 0x00000400,
112  SDL_WINDOW_FOREIGN = 0x00000800,
113  SDL_WINDOW_ALLOW_HIGHDPI = 0x00002000,
116  SDL_WINDOW_MOUSE_CAPTURE = 0x00004000,
117  SDL_WINDOW_ALWAYS_ON_TOP = 0x00008000,
118  SDL_WINDOW_SKIP_TASKBAR = 0x00010000,
119  SDL_WINDOW_UTILITY = 0x00020000,
120  SDL_WINDOW_TOOLTIP = 0x00040000,
121  SDL_WINDOW_POPUP_MENU = 0x00080000,
122  SDL_WINDOW_VULKAN = 0x10000000
SDL_WindowFlags
The flags on a window.
Definition: SDL_video.h:97

Function Documentation

◆ SDL_CreateWindow()

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, in screen coordinates.
hThe height of the window, in screen coordinates.
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, SDL_WINDOW_VULKAN.
Returns
The created window, or NULL if window creation failed.

If the window is created with the SDL_WINDOW_ALLOW_HIGHDPI flag, its size in pixels may differ from its size in screen coordinates on platforms with high-DPI support (e.g. iOS and Mac OS X). Use SDL_GetWindowSize() to query the client area's size in screen coordinates, and SDL_GL_GetDrawableSize(), SDL_Vulkan_GetDrawableSize(), or SDL_GetRendererOutputSize() to query the drawable size in pixels.

If the window is created with any of the SDL_WINDOW_OPENGL or SDL_WINDOW_VULKAN flags, then the corresponding LoadLibrary function (SDL_GL_LoadLibrary or SDL_Vulkan_LoadLibrary) is called and the corresponding UnloadLibrary function is called by SDL_DestroyWindow().

If SDL_WINDOW_VULKAN is specified and there isn't a working Vulkan driver, SDL_CreateWindow() will fail because SDL_Vulkan_LoadLibrary() will fail.

Note
On non-Apple devices, SDL requires you to either not link to the Vulkan loader or link to a dynamic library version. This limitation may be removed in a future version of SDL.
See also
SDL_DestroyWindow()
SDL_GL_LoadLibrary()
SDL_Vulkan_LoadLibrary()

◆ SDL_CreateWindowFrom()

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 created window, or NULL if window creation failed.
See also
SDL_DestroyWindow()

◆ SDL_DestroyWindow()

DECLSPEC void SDLCALL SDL_DestroyWindow ( SDL_Window window)

Destroy a window.

◆ SDL_DisableScreenSaver()

DECLSPEC void SDLCALL SDL_DisableScreenSaver ( void  )

Prevent the screen from being blanked by a screensaver.

See also
SDL_IsScreenSaverEnabled()
SDL_EnableScreenSaver()

◆ SDL_EnableScreenSaver()

DECLSPEC void SDLCALL SDL_EnableScreenSaver ( void  )

Allow the screen to be blanked by a screensaver.

See also
SDL_IsScreenSaverEnabled()
SDL_DisableScreenSaver()

◆ SDL_GetClosestDisplayMode()

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()

◆ SDL_GetCurrentDisplayMode()

DECLSPEC int SDLCALL SDL_GetCurrentDisplayMode ( int  displayIndex,
SDL_DisplayMode mode 
)

Fill in information about the current display mode.

◆ SDL_GetCurrentVideoDriver()

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()

◆ SDL_GetDesktopDisplayMode()

DECLSPEC int SDLCALL SDL_GetDesktopDisplayMode ( int  displayIndex,
SDL_DisplayMode mode 
)

Fill in information about the desktop display mode.

◆ SDL_GetDisplayBounds()

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()

◆ SDL_GetDisplayDPI()

DECLSPEC int SDLCALL SDL_GetDisplayDPI ( int  displayIndex,
float *  ddpi,
float *  hdpi,
float *  vdpi 
)

Get the dots/pixels-per-inch for a display.

Note
Diagonal, horizontal and vertical DPI can all be optionally returned if the parameter is non-NULL.
Returns
0 on success, or -1 if no DPI information is available or the index is out of range.
See also
SDL_GetNumVideoDisplays()

◆ SDL_GetDisplayMode()

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()

◆ SDL_GetDisplayName()

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()

◆ SDL_GetDisplayOrientation()

DECLSPEC SDL_DisplayOrientation SDLCALL SDL_GetDisplayOrientation ( int  displayIndex)

Get the orientation of a display.

Returns
The orientation of the display, or SDL_ORIENTATION_UNKNOWN if it isn't available.
See also
SDL_GetNumVideoDisplays()

◆ SDL_GetDisplayUsableBounds()

DECLSPEC int SDLCALL SDL_GetDisplayUsableBounds ( int  displayIndex,
SDL_Rect rect 
)

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

This is the same area as SDL_GetDisplayBounds() reports, but with portions reserved by the system removed. For example, on Mac OS X, this subtracts the area occupied by the menu bar and dock.

Setting a window to be fullscreen generally bypasses these unusable areas, so these are good guidelines for the maximum space available to a non-fullscreen window.

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

◆ SDL_GetGrabbedWindow()

DECLSPEC SDL_Window* SDLCALL SDL_GetGrabbedWindow ( void  )

Get the window that currently has an input grab enabled.

Returns
This returns the window if input is grabbed, and NULL otherwise.
See also
SDL_SetWindowGrab()

◆ SDL_GetNumDisplayModes()

DECLSPEC int SDLCALL SDL_GetNumDisplayModes ( int  displayIndex)

Returns the number of available display modes.

See also
SDL_GetDisplayMode()

◆ SDL_GetNumVideoDisplays()

DECLSPEC int SDLCALL SDL_GetNumVideoDisplays ( void  )

Returns the number of available video displays.

See also
SDL_GetDisplayBounds()

◆ SDL_GetNumVideoDrivers()

DECLSPEC int SDLCALL SDL_GetNumVideoDrivers ( void  )

Get the number of video drivers compiled into SDL.

See also
SDL_GetVideoDriver()

◆ 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()

◆ SDL_GetWindowBordersSize()

DECLSPEC int SDLCALL SDL_GetWindowBordersSize ( SDL_Window window,
int *  top,
int *  left,
int *  bottom,
int *  right 
)

Get the size of a window's borders (decorations) around the client area.

Parameters
windowThe window to query.
topPointer to variable for storing the size of the top border. NULL is permitted.
leftPointer to variable for storing the size of the left border. NULL is permitted.
bottomPointer to variable for storing the size of the bottom border. NULL is permitted.
rightPointer to variable for storing the size of the right border. NULL is permitted.
Returns
0 on success, or -1 if getting this information is not supported.
Note
if this function fails (returns -1), the size values will be initialized to 0, 0, 0, 0 (if a non-NULL pointer is provided), as if the window in question was borderless.

◆ SDL_GetWindowBrightness()

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()

◆ SDL_GetWindowData()

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()

◆ SDL_GetWindowDisplayIndex()

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.

◆ SDL_GetWindowDisplayMode()

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()

◆ SDL_GetWindowFlags()

DECLSPEC Uint32 SDLCALL SDL_GetWindowFlags ( SDL_Window window)

Get the window flags.

◆ SDL_GetWindowFromID()

DECLSPEC SDL_Window* SDLCALL SDL_GetWindowFromID ( Uint32  id)

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

◆ SDL_GetWindowGammaRamp()

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()

◆ SDL_GetWindowGrab()

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()

◆ SDL_GetWindowID()

DECLSPEC Uint32 SDLCALL SDL_GetWindowID ( SDL_Window window)

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

◆ SDL_GetWindowMaximumSize()

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()

◆ SDL_GetWindowMinimumSize()

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()

◆ SDL_GetWindowOpacity()

DECLSPEC int SDLCALL SDL_GetWindowOpacity ( SDL_Window window,
float *  out_opacity 
)

Get the opacity of a window.

If transparency isn't supported on this platform, opacity will be reported as 1.0f without error.

Parameters
windowThe window in question.
out_opacityOpacity (0.0f - transparent, 1.0f - opaque)
Returns
0 on success, or -1 on error (invalid window, etc).
See also
SDL_SetWindowOpacity()

◆ SDL_GetWindowPixelFormat()

DECLSPEC Uint32 SDLCALL SDL_GetWindowPixelFormat ( SDL_Window window)

Get the pixel format associated with the window.

◆ SDL_GetWindowPosition()

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, in screen coordinates. May be NULL.
yPointer to variable for storing the y position, in screen coordinates. May be NULL.
See also
SDL_SetWindowPosition()

◆ SDL_GetWindowSize()

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, in screen coordinates. May be NULL.
hPointer to variable for storing the height, in screen coordinates. May be NULL.

The window size in screen coordinates may differ from the size in pixels, if the window was created with SDL_WINDOW_ALLOW_HIGHDPI on a platform with high-dpi support (e.g. iOS or OS X). Use SDL_GL_GetDrawableSize() or SDL_GetRendererOutputSize() to get the real client area size in pixels.

See also
SDL_SetWindowSize()

◆ SDL_GetWindowSurface()

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()

◆ SDL_GetWindowTitle()

DECLSPEC const char* SDLCALL SDL_GetWindowTitle ( SDL_Window window)

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

See also
SDL_SetWindowTitle()

◆ SDL_GL_CreateContext()

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()

◆ SDL_GL_DeleteContext()

DECLSPEC void SDLCALL SDL_GL_DeleteContext ( SDL_GLContext  context)

Delete an OpenGL context.

See also
SDL_GL_CreateContext()

◆ SDL_GL_ExtensionSupported()

DECLSPEC SDL_bool SDLCALL SDL_GL_ExtensionSupported ( const char *  extension)

Return true if an OpenGL extension is supported for the current context.

◆ SDL_GL_GetAttribute()

DECLSPEC int SDLCALL SDL_GL_GetAttribute ( SDL_GLattr  attr,
int *  value 
)

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

Returns
0 on success, or -1 if the attribute could not be retrieved. The integer at value will be modified in either case.

◆ SDL_GL_GetCurrentContext()

DECLSPEC SDL_GLContext SDLCALL SDL_GL_GetCurrentContext ( void  )

Get the currently active OpenGL context.

◆ SDL_GL_GetCurrentWindow()

DECLSPEC SDL_Window* SDLCALL SDL_GL_GetCurrentWindow ( void  )

Get the currently active OpenGL window.

◆ SDL_GL_GetDrawableSize()

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

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

Parameters
windowWindow from which the drawable size should be queried
wPointer to variable for storing the width in pixels, may be NULL
hPointer to variable for storing the height in pixels, 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()

◆ SDL_GL_GetProcAddress()

DECLSPEC void* SDLCALL SDL_GL_GetProcAddress ( const char *  proc)

Get the address of an OpenGL function.

◆ SDL_GL_GetSwapInterval()

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()

◆ SDL_GL_LoadLibrary()

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()

◆ SDL_GL_MakeCurrent()

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.

◆ SDL_GL_ResetAttributes()

DECLSPEC void SDLCALL SDL_GL_ResetAttributes ( void  )

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

◆ SDL_GL_SetAttribute()

DECLSPEC int SDLCALL SDL_GL_SetAttribute ( SDL_GLattr  attr,
int  value 
)

Set an OpenGL window attribute before window creation.

Returns
0 on success, or -1 if the attribute could not be set.

◆ SDL_GL_SetSwapInterval()

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()

◆ SDL_GL_SwapWindow()

DECLSPEC void SDLCALL SDL_GL_SwapWindow ( SDL_Window window)

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

◆ SDL_GL_UnloadLibrary()

DECLSPEC void SDLCALL SDL_GL_UnloadLibrary ( void  )

Unload the OpenGL library previously loaded by SDL_GL_LoadLibrary().

See also
SDL_GL_LoadLibrary()

◆ SDL_HideWindow()

DECLSPEC void SDLCALL SDL_HideWindow ( SDL_Window window)

Hide a window.

See also
SDL_ShowWindow()

◆ SDL_IsScreenSaverEnabled()

DECLSPEC SDL_bool SDLCALL SDL_IsScreenSaverEnabled ( void  )

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

See also
SDL_EnableScreenSaver()
SDL_DisableScreenSaver()

◆ SDL_MaximizeWindow()

DECLSPEC void SDLCALL SDL_MaximizeWindow ( SDL_Window window)

Make a window as large as possible.

See also
SDL_RestoreWindow()

◆ SDL_MinimizeWindow()

DECLSPEC void SDLCALL SDL_MinimizeWindow ( SDL_Window window)

Minimize a window to an iconic representation.

See also
SDL_RestoreWindow()

◆ SDL_RaiseWindow()

DECLSPEC void SDLCALL SDL_RaiseWindow ( SDL_Window window)

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

◆ SDL_RestoreWindow()

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()

◆ SDL_SetWindowBordered()

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()

◆ SDL_SetWindowBrightness()

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()

◆ SDL_SetWindowData()

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()

◆ SDL_SetWindowDisplayMode()

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()

◆ 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()

◆ SDL_SetWindowGammaRamp()

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()

◆ SDL_SetWindowGrab()

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.

If the caller enables a grab while another window is currently grabbed, the other window loses its grab in favor of the caller's window.

See also
SDL_GetWindowGrab()

◆ SDL_SetWindowHitTest()

DECLSPEC int SDLCALL SDL_SetWindowHitTest ( SDL_Window window,
SDL_HitTest  callback,
void callback_data 
)

Provide a callback that decides if a window region has special properties.

Normally windows are dragged and resized by decorations provided by the system window manager (a title bar, borders, etc), but for some apps, it makes sense to drag them from somewhere else inside the window itself; for example, one might have a borderless window that wants to be draggable from any part, or simulate its own title bar, etc.

This function lets the app provide a callback that designates pieces of a given window as special. This callback is run during event processing if we need to tell the OS to treat a region of the window specially; the use of this callback is known as "hit testing."

Mouse input may not be delivered to your application if it is within a special area; the OS will often apply that input to moving the window or resizing the window and not deliver it to the application.

Specifying NULL for a callback disables hit-testing. Hit-testing is disabled by default.

Platforms that don't support this functionality will return -1 unconditionally, even if you're attempting to disable hit-testing.

Your callback may fire at any time, and its firing does not indicate any specific behavior (for example, on Windows, this certainly might fire when the OS is deciding whether to drag your window, but it fires for lots of other reasons, too, some unrelated to anything you probably care about and when the mouse isn't actually at the location it is testing). Since this can fire at any time, you should try to keep your callback efficient, devoid of allocations, etc.

Parameters
windowThe window to set hit-testing on.
callbackThe callback to call when doing a hit-test.
callback_dataAn app-defined void pointer passed to the callback.
Returns
0 on success, -1 on error (including unsupported).

◆ SDL_SetWindowIcon()

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.

◆ SDL_SetWindowInputFocus()

DECLSPEC int SDLCALL SDL_SetWindowInputFocus ( SDL_Window window)

Explicitly sets input focus to the window.

You almost certainly want SDL_RaiseWindow() instead of this function. Use this with caution, as you might give focus to a window that's completely obscured by other windows.

Parameters
windowThe window that should get the input focus
Returns
0 on success, or -1 otherwise.
See also
SDL_RaiseWindow()

◆ SDL_SetWindowMaximumSize()

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()

◆ 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()

◆ SDL_SetWindowModalFor()

DECLSPEC int SDLCALL SDL_SetWindowModalFor ( SDL_Window modal_window,
SDL_Window parent_window 
)

Sets the window as a modal for another window (TODO: reconsider this function and/or its name)

Parameters
modal_windowThe window that should be modal
parent_windowThe parent window
Returns
0 on success, or -1 otherwise.

◆ SDL_SetWindowOpacity()

DECLSPEC int SDLCALL SDL_SetWindowOpacity ( SDL_Window window,
float  opacity 
)

Set the opacity for a window.

Parameters
windowThe window which will be made transparent or opaque
opacityOpacity (0.0f - transparent, 1.0f - opaque) This will be clamped internally between 0.0f and 1.0f.
Returns
0 on success, or -1 if setting the opacity isn't supported.
See also
SDL_GetWindowOpacity()

◆ SDL_SetWindowPosition()

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 in screen coordinates, or SDL_WINDOWPOS_CENTERED or SDL_WINDOWPOS_UNDEFINED.
yThe y coordinate of the window in screen coordinates, or SDL_WINDOWPOS_CENTERED or SDL_WINDOWPOS_UNDEFINED.
Note
The window coordinate origin is the upper left of the display.
See also
SDL_GetWindowPosition()

◆ SDL_SetWindowResizable()

DECLSPEC void SDLCALL SDL_SetWindowResizable ( SDL_Window window,
SDL_bool  resizable 
)

Set the user-resizable state of a window.

This will add or remove the window's SDL_WINDOW_RESIZABLE flag and allow/disallow user resizing of the window. This is a no-op if the window's resizable state already matches the requested state.

Parameters
windowThe window of which to change the resizable state.
resizableSDL_TRUE to allow resizing, SDL_FALSE to disallow.
Note
You can't change the resizable state of a fullscreen window.
See also
SDL_GetWindowFlags()

◆ SDL_SetWindowSize()

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, in screen coordinates. Must be >0.
hThe height of the window, in screen coordinates. Must be >0.
Note
Fullscreen windows automatically match the size of the display mode, and you should use SDL_SetWindowDisplayMode() to change their size.

The window size in screen coordinates may differ from the size in pixels, if the window was created with SDL_WINDOW_ALLOW_HIGHDPI on a platform with high-dpi support (e.g. iOS or OS X). Use SDL_GL_GetDrawableSize() or SDL_GetRendererOutputSize() to get the real client area size in pixels.

See also
SDL_GetWindowSize()
SDL_SetWindowDisplayMode()

◆ SDL_SetWindowTitle()

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()

◆ SDL_ShowWindow()

DECLSPEC void SDLCALL SDL_ShowWindow ( SDL_Window window)

Show a window.

See also
SDL_HideWindow()

◆ SDL_UpdateWindowSurface()

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()

◆ 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_UpdateWindowSurface()

◆ SDL_VideoInit()

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()

◆ 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()