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"`
Include dependency graph for SDL_video.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

## Data Structures

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

## Macros

#define | SDL_WINDOWPOS_UNDEFINED_MASK 0x1FFF0000
| 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 0x2FFF0000
| 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 void * | SDL_GLContext
| An opaque handle to an OpenGL context. More...
typedef SDL_HitTestResult(* | SDL_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
}

| 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 {
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
}

| 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_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

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

#define SDL_WINDOWPOS_CENTERED SDL_WINDOWPOS_CENTERED_DISPLAY(0)

Definition at line 129 of file SDL_video.h.

Referenced by initWindow(), main(), SDLTest_CommonArg(), test_multi_audio(), video_createWindowVariousPositions(), WatchGameController(), and WatchJoystick().

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

Definition at line 128 of file SDL_video.h.

Referenced by SDLTest_CommonArg().

#define SDL_WINDOWPOS_CENTERED_MASK 0x2FFF0000

Used to indicate that the window position should be centered.

Definition at line 127 of file SDL_video.h.

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

Definition at line 130 of file SDL_video.h.

Referenced by SDL_CreateWindow(), SDL_GetWindowDisplayIndex(), SDL_SetWindowPosition(), and SDLTest_CommonArg().

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

Definition at line 121 of file SDL_video.h.

Referenced by SDL_CreateWindow(), SDL_GetWindowDisplayIndex(), SDL_SendWindowEvent(), SDL_SetWindowPosition(), and SDLTest_CommonArg().

#define SDL_WINDOWPOS_UNDEFINED SDL_WINDOWPOS_UNDEFINED_DISPLAY(0)

Definition at line 120 of file SDL_video.h.

Referenced by main(), SDL_CreateWindowAndRenderer(), SDLTest_CommonCreateState(), and video_createWindowVariousPositions().

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

Definition at line 119 of file SDL_video.h.

Referenced by SDLTest_CommonArg().

#define SDL_WINDOWPOS_UNDEFINED_MASK 0x1FFF0000

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

Definition at line 118 of file SDL_video.h.

## Typedef Documentation

SDL_PRINTF_FORMAT_STRING const char int SDL_PRINTF_FORMAT_STRING const char int SDL_PRINTF_FORMAT_STRING const char int SDL_PRINTF_FORMAT_STRING const char const char SDL_SCANF_FORMAT_STRING const char return SDL_ThreadFunction const char void return Uint32 return Uint32 SDL_AssertionHandler void SDL_SpinLock SDL_atomic_t int int return SDL_atomic_t return void void void return void return int return SDL_AudioSpec SDL_AudioSpec return int int return return int SDL_RWops int SDL_AudioSpec Uint8 Uint32 return SDL_AudioCVT SDL_AudioFormat Uint8 int SDL_AudioFormat Uint8 int return Uint8 const Uint8 Uint32 int const char return return return return return return return return Uint32 return Uint32 SDL_Event return SDL_Event int return SDL_EventFilter void SDL_EventFilter void SDL_EventFilter void int return const char const char return SDL_JoystickGUID return int return int return SDL_GameController return int return const char return SDL_GameController SDL_GameControllerAxis return const char return SDL_GameController SDL_GameControllerButton return SDL_GameController SDL_RWops return SDL_TouchID SDL_RWops return int return int return return SDL_Joystick return SDL_Haptic SDL_Haptic return SDL_Haptic return SDL_Haptic SDL_HapticEffect return SDL_Haptic int Uint32 return SDL_Haptic int SDL_Haptic int return SDL_Haptic return SDL_Haptic return SDL_Haptic return SDL_Haptic return const char const char return const char SDL_HintCallback void int return SDL_Joystick return SDL_Joystick return const char return SDL_Joystick return SDL_Joystick return SDL_Joystick return int return SDL_Joystick int return SDL_Joystick int return return return SDL_Scancode return SDL_Scancode return SDL_Keycode return return const char return void int SDL_LogPriority SDL_LogOutputFunction void Uint32 const char const char SDL_Window return int int return SDL_Window int int return SDL_Surface int int return SDL_Cursor return int return SDL_mutex return SDL_mutex return Uint32 return SDL_sem return SDL_sem Uint32 return SDL_sem return SDL_cond SDL_cond return SDL_cond SDL_mutex Uint32 return Uint32 int Uint32 Uint32 Uint32 Uint32 return Uint32 return int return SDL_Palette const SDL_Color int int return const SDL_PixelFormat Uint8 Uint8 Uint8 return Uint32 const SDL_PixelFormat Uint8 Uint8 Uint8 float Uint16 int int return const SDL_Rect const SDL_Rect SDL_Rect return const SDL_Point int const SDL_Rect SDL_Rect return return int int Uint32 SDL_Window SDL_Renderer return SDL_Surface return SDL_Renderer SDL_RendererInfo return SDL_Renderer Uint32 int int int return SDL_Texture Uint32 int int int return SDL_Texture Uint8 Uint8 Uint8 return SDL_Texture Uint8 return SDL_Texture SDL_BlendMode return SDL_Texture const SDL_Rect const Uint8 int const Uint8 int const Uint8 int return SDL_Texture SDL_Renderer SDL_Texture return SDL_Renderer int int return SDL_Renderer const SDL_Rect return SDL_Renderer const SDL_Rect return SDL_Renderer float float return SDL_Renderer Uint8 Uint8 Uint8 Uint8 return SDL_Renderer SDL_BlendMode return SDL_Renderer return SDL_Renderer const SDL_Point int return SDL_Renderer const SDL_Point int return SDL_Renderer const SDL_Rect int return SDL_Renderer const SDL_Rect int return SDL_Renderer SDL_Texture const SDL_Rect const SDL_Rect const double const SDL_Point const SDL_RendererFlip return SDL_Renderer SDL_Renderer SDL_Texture return void int return return SDL_RWops return SDL_RWops return SDL_RWops return SDL_RWops return SDL_RWops Uint16 return SDL_RWops Uint32 return SDL_RWops Uint64 return const char unsigned int unsigned int unsigned int unsigned int Uint32 return SDL_Window SDL_Surface SDL_WindowShapeMode return size_t return void size_t return const char return void size_t size_t int(*) SDL_DYNAPI_PROC int return int return int size_t return size_t return const wchar_t return const wchar_t size_t return const char size_t return const char size_t return char return char return const char int return int char int return long char int return Sint64 char int return const char return const char char int return const char char int return const char char return const char const char size_t return const char const char size_t return double return double return double return double return double return double return double int return float return const char const char return SDL_iconv_t const char size_t char size_t return Uint32 int int int Uint32 Uint32 Uint32 Uint32 return SDL_Surface SDL_Surface return SDL_RWops int return SDL_Surface int return SDL_Surface Uint32 return SDL_Surface Uint8 Uint8 Uint8 return SDL_Surface Uint8 return SDL_Surface SDL_BlendMode return SDL_Surface SDL_Rect SDL_Surface Uint32 Uint32 return SDL_Surface const SDL_Rect Uint32 return SDL_Surface const SDL_Rect SDL_Surface SDL_Rect return SDL_Surface const SDL_Rect SDL_Surface const SDL_Rect return SDL_Surface SDL_Rect SDL_Surface SDL_Rect return SDL_Thread return SDL_Thread return SDL_Thread int return SDL_TLSID const void void(*) return return Uint32 SDL_TimerID return int return SDL_TouchID int return return return const char return return int return int return int SDL_DisplayMode return int const SDL_DisplayMode SDL_DisplayMode return SDL_Window const SDL_DisplayMode return SDL_Window return const void return Uint32 return SDL_Window const char SDL_Window SDL_Surface SDL_Window const char return SDL_Window int int SDL_Window int int SDL_Window int int SDL_Window int int SDL_Window SDL_Window SDL_Window SDL_Window Uint32 return SDL_Window return SDL_Window SDL_bool SDL_Window float return SDL_Window const Uint16 const Uint16 const Uint16 return SDL_Window const char return SDL_GLattr int return SDL_Window return return SDL_Window int int return SDL_GLContext(int, SDL_vsscanf,(const char *a, const char *b, va_list c),(a, b, c), return) SDL_DYNAPI_PROC(int

An opaque handle to an OpenGL context.

Definition at line 164 of file SDL_video.h.

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

Callback used for hit-testing.

See also
  SDL_SetWindowHitTest

Definition at line 871 of file SDL_video.h.

## Enumeration Type Documentation

enum SDL_PRINTF_FORMAT_STRING const char int SDL_PRINTF_FORMAT_STRING const char int SDL_PRINTF_FORMAT_STRING const char int SDL_PRINTF_FORMAT_STRING const char const char SDL_SCANF_FORMAT_STRING const char return SDL_ThreadFunction const char void return Uint32 return Uint32 SDL_AssertionHandler void SDL_SpinLock SDL_atomic_t int int return SDL_atomic_t return void void void return void return int return SDL_AudioSpec SDL_AudioSpec return int int return return int SDL_RWops int SDL_AudioSpec Uint8 Uint32 return SDL_AudioCVT SDL_AudioFormat Uint8 int SDL_AudioFormat Uint8 int return Uint8 const Uint8 Uint32 int const char return return return return return return return return Uint32 return Uint32 SDL_Event return SDL_Event int return SDL_EventFilter void SDL_EventFilter void SDL_EventFilter void int return const char const char return SDL_JoystickGUID return int return int return SDL_GameController return int return const char return SDL_GameController SDL_GameControllerAxis return const char return SDL_GameController SDL_GameControllerButton return SDL_GameController SDL_RWops return SDL_TouchID SDL_RWops return int return int return return SDL_Joystick return SDL_Haptic SDL_Haptic return SDL_Haptic return SDL_Haptic SDL_HapticEffect return SDL_Haptic int Uint32 return SDL_Haptic int SDL_Haptic int return SDL_Haptic return SDL_Haptic return SDL_Haptic return SDL_Haptic return const char const char return const char SDL_HintCallback void int return SDL_Joystick return SDL_Joystick return const char return SDL_Joystick return SDL_Joystick return SDL_Joystick return int return SDL_Joystick int return SDL_Joystick int return return return SDL_Scancode return SDL_Scancode return SDL_Keycode return return const char return void int SDL_LogPriority SDL_LogOutputFunction void Uint32 const char const char SDL_Window return int int return SDL_Window int int return SDL_Surface int int return SDL_Cursor return int return SDL_mutex return SDL_mutex return Uint32 return SDL_sem return SDL_sem Uint32 return SDL_sem return SDL_cond SDL_cond return SDL_cond SDL_mutex Uint32 return Uint32 int Uint32 Uint32 Uint32 Uint32 return Uint32 return int return SDL_Palette const SDL_Color int int return const SDL_PixelFormat Uint8 Uint8 Uint8 return Uint32 const SDL_PixelFormat Uint8 Uint8 Uint8 float Uint16 int int return const SDL_Rect const SDL_Rect SDL_Rect return const SDL_Point int const SDL_Rect SDL_Rect return return int int Uint32 SDL_Window SDL_Renderer return SDL_Surface return SDL_Renderer SDL_RendererInfo return SDL_Renderer Uint32 int int int return SDL_Texture Uint32 int int int return SDL_Texture Uint8 Uint8 Uint8 return SDL_Texture Uint8 return SDL_Texture SDL_BlendMode return SDL_Texture const SDL_Rect const Uint8 int const Uint8 int const Uint8 int return SDL_Texture SDL_Renderer SDL_Texture return SDL_Renderer int int return SDL_Renderer const SDL_Rect return SDL_Renderer const SDL_Rect return SDL_Renderer float float return SDL_Renderer Uint8 Uint8 Uint8 Uint8 return SDL_Renderer SDL_BlendMode return SDL_Renderer return SDL_Renderer const SDL_Point int return SDL_Renderer const SDL_Point int return SDL_Renderer const SDL_Rect int return SDL_Renderer const SDL_Rect int return SDL_Renderer SDL_Texture const SDL_Rect const SDL_Rect const double const SDL_Point const SDL_RendererFlip return SDL_Renderer SDL_Renderer SDL_Texture return void int return return SDL_RWops return SDL_RWops return SDL_RWops return SDL_RWops return SDL_RWops Uint16 return SDL_RWops Uint32 return SDL_RWops Uint64 return const char unsigned int unsigned int unsigned int unsigned int Uint32 return SDL_Window SDL_Surface SDL_WindowShapeMode return size_t return void size_t return const char return void size_t size_t int(*) a int return int return int size_t return size_t return const wchar_t return const wchar_t size_t return const char size_t return const char size_t return char return char return const char int return int char int return long char int return Sint64 char int return const char return const char char int return const char char int return const char char return const char const char size_t return const char const char size_t return double return double return double return double return double return double return double int return float return const char const char return SDL_iconv_t const char size_t char size_t return Uint32 int int int Uint32 Uint32 Uint32 Uint32 return SDL_Surface SDL_Surface return SDL_RWops int return SDL_Surface int return SDL_Surface Uint32 return SDL_Surface Uint8 Uint8 Uint8 return SDL_Surface Uint8 return SDL_Surface SDL_BlendMode return SDL_Surface SDL_Rect SDL_Surface Uint32 Uint32 return SDL_Surface const SDL_Rect Uint32 return SDL_Surface const SDL_Rect SDL_Surface SDL_Rect return SDL_Surface const SDL_Rect SDL_Surface const SDL_Rect return SDL_Surface SDL_Rect SDL_Surface SDL_Rect return SDL_Thread return SDL_Thread return SDL_Thread int return SDL_TLSID const void void(*) return return Uint32 SDL_TimerID return int return SDL_TouchID int return return return const char return return int return int return int SDL_DisplayMode return int const SDL_DisplayMode SDL_DisplayMode return SDL_Window const SDL_DisplayMode return SDL_Window return const void return Uint32 return SDL_Window const char SDL_Window SDL_Surface SDL_Window const char return SDL_Window int int SDL_Window int int SDL_Window int int SDL_Window int int SDL_Window SDL_Window SDL_Window SDL_Window Uint32 return SDL_Window return SDL_Window SDL_bool SDL_Window float return SDL_Window const Uint16 const Uint16 const Uint16 return SDL_Window const char return 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 |

Definition at line 169 of file SDL_video.h.

{
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_GLattr;
SDL_GL_ACCUM_RED_SIZE
Definition: SDL_video.h:179
SDL_GL_ACCUM_BLUE_SIZE
Definition: SDL_video.h:181
SDL_GL_ACCUM_ALPHA_SIZE
Definition: SDL_video.h:182
SDL_GL_ACCELERATED_VISUAL
Definition: SDL_video.h:186
SDL_GL_RED_SIZE
Definition: SDL_video.h:171
SDL_GL_STEREO
Definition: SDL_video.h:183
SDL_GL_CONTEXT_MINOR_VERSION
Definition: SDL_video.h:189
SDL_GLattr
SDL_GLattr
OpenGL configuration attributes.
Definition: SDL_video.h:169
SDL_GL_CONTEXT_FLAGS
Definition: SDL_video.h:191
SDL_GL_STENCIL_SIZE
Definition: SDL_video.h:178
SDL_GL_CONTEXT_MAJOR_VERSION
Definition: SDL_video.h:188
SDL_GL_MULTISAMPLEBUFFERS
Definition: SDL_video.h:184
SDL_GL_RETAINED_BACKING
Definition: SDL_video.h:187
SDL_GL_ALPHA_SIZE
Definition: SDL_video.h:174
SDL_GL_CONTEXT_RELEASE_BEHAVIOR
Definition: SDL_video.h:195
SDL_GL_ACCUM_GREEN_SIZE
Definition: SDL_video.h:180
SDL_GL_DEPTH_SIZE
Definition: SDL_video.h:177
SDL_GL_CONTEXT_PROFILE_MASK
Definition: SDL_video.h:192
SDL_GL_CONTEXT_EGL
Definition: SDL_video.h:190
SDL_GL_DOUBLEBUFFER
Definition: SDL_video.h:176
SDL_GL_MULTISAMPLESAMPLES
Definition: SDL_video.h:185
SDL_GL_SHARE_WITH_CURRENT_CONTEXT
Definition: SDL_video.h:193
SDL_GL_FRAMEBUFFER_SRGB_CAPABLE
Definition: SDL_video.h:194
SDL_GL_GREEN_SIZE
Definition: SDL_video.h:172
SDL_GL_BLUE_SIZE
Definition: SDL_video.h:173
SDL_GL_BUFFER_SIZE
Definition: SDL_video.h:175

enum 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 205 of file SDL_video.h.

{
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
} SDL_GLcontextFlag;
SDL_GLcontextFlag
SDL_GLcontextFlag
Definition: SDL_video.h:205
SDL_GL_CONTEXT_FORWARD_COMPATIBLE_FLAG
Definition: SDL_video.h:208
SDL_GL_CONTEXT_DEBUG_FLAG
Definition: SDL_video.h:207
SDL_GL_CONTEXT_RESET_ISOLATION_FLAG
Definition: SDL_video.h:210
SDL_GL_CONTEXT_ROBUST_ACCESS_FLAG
Definition: SDL_video.h:209

enum SDL_GLcontextReleaseFlag

Enumerator
SDL_GL_CONTEXT_RELEASE_BEHAVIOR_NONE |
SDL_GL_CONTEXT_RELEASE_BEHAVIOR_FLUSH |

Definition at line 213 of file SDL_video.h.

{
SDL_GL_CONTEXT_RELEASE_BEHAVIOR_NONE = 0x0000,
SDL_GL_CONTEXT_RELEASE_BEHAVIOR_FLUSH = 0x0001
} SDL_GLcontextReleaseFlag;
SDL_GLcontextReleaseFlag
SDL_GLcontextReleaseFlag
Definition: SDL_video.h:213
SDL_GL_CONTEXT_RELEASE_BEHAVIOR_NONE
Definition: SDL_video.h:215
SDL_GL_CONTEXT_RELEASE_BEHAVIOR_FLUSH
Definition: SDL_video.h:216

enum SDL_GLprofile

Enumerator
SDL_GL_CONTEXT_PROFILE_CORE |
SDL_GL_CONTEXT_PROFILE_COMPATIBILITY |
SDL_GL_CONTEXT_PROFILE_ES |

Definition at line 198 of file SDL_video.h.

{
SDL_GL_CONTEXT_PROFILE_CORE = 0x0001,
SDL_GL_CONTEXT_PROFILE_COMPATIBILITY = 0x0002,
SDL_GL_CONTEXT_PROFILE_ES = 0x0004 /* GLX_CONTEXT_ES2_PROFILE_BIT_EXT */
} SDL_GLprofile;
SDL_GLprofile
SDL_GLprofile
Definition: SDL_video.h:198
SDL_GL_CONTEXT_PROFILE_COMPATIBILITY
Definition: SDL_video.h:201
SDL_GL_CONTEXT_PROFILE_ES
Definition: SDL_video.h:202
SDL_GL_CONTEXT_PROFILE_CORE
Definition: SDL_video.h:200

enum 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 852 of file SDL_video.h.

{
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
} SDL_HitTestResult;
SDL_HITTEST_RESIZE_TOPRIGHT
Definition: SDL_video.h:858
SDL_HITTEST_RESIZE_LEFT
Definition: SDL_video.h:863
SDL_HITTEST_RESIZE_BOTTOMRIGHT
Definition: SDL_video.h:860
SDL_HITTEST_NORMAL
Definition: SDL_video.h:854
SDL_HITTEST_RESIZE_TOP
Definition: SDL_video.h:857
SDL_HITTEST_RESIZE_BOTTOM
Definition: SDL_video.h:861
SDL_HITTEST_RESIZE_RIGHT
Definition: SDL_video.h:859
SDL_HitTestResult
SDL_HitTestResult
Possible return values from the SDL_HitTest callback.
Definition: SDL_video.h:852
SDL_HITTEST_DRAGGABLE
Definition: SDL_video.h:855
SDL_HITTEST_RESIZE_BOTTOMLEFT
Definition: SDL_video.h:862
SDL_HITTEST_RESIZE_TOPLEFT
Definition: SDL_video.h:856

enum 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

Definition at line 136 of file SDL_video.h.

{
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_WindowEventID;
SDL_WINDOWEVENT_MINIMIZED
Definition: SDL_video.h:149
SDL_WINDOWEVENT_NONE
Definition: SDL_video.h:138
SDL_WINDOWEVENT_MAXIMIZED
Definition: SDL_video.h:150
SDL_WINDOWEVENT_SIZE_CHANGED
Definition: SDL_video.h:146
SDL_WINDOWEVENT_HIDDEN
Definition: SDL_video.h:140
SDL_WINDOWEVENT_FOCUS_GAINED
Definition: SDL_video.h:155
SDL_WINDOWEVENT_RESTORED
Definition: SDL_video.h:151
SDL_WindowEventID
SDL_WindowEventID
Event subtype for window events.
Definition: SDL_video.h:136
SDL_WINDOWEVENT_FOCUS_LOST
Definition: SDL_video.h:156
SDL_WINDOWEVENT_LEAVE
Definition: SDL_video.h:154
SDL_WINDOWEVENT_CLOSE
Definition: SDL_video.h:157
SDL_WINDOWEVENT_SHOWN
Definition: SDL_video.h:139
SDL_WINDOWEVENT_ENTER
Definition: SDL_video.h:153
SDL_WINDOWEVENT_EXPOSED
Definition: SDL_video.h:141
SDL_WINDOWEVENT_RESIZED
Definition: SDL_video.h:145
SDL_WINDOWEVENT_MOVED
Definition: SDL_video.h:143

enum 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
SDL_WINDOW_MOUSE_CAPTURE | window has mouse captured (unrelated to INPUT_GRABBED)

Definition at line 96 of file SDL_video.h.

{
SDL_WINDOW_FULLSCREEN = 0x00000001, /**< fullscreen window */
SDL_WINDOW_OPENGL = 0x00000002, /**< window usable with OpenGL context */
SDL_WINDOW_SHOWN = 0x00000004, /**< window is visible */
SDL_WINDOW_HIDDEN = 0x00000008, /**< window is not visible */
SDL_WINDOW_BORDERLESS = 0x00000010, /**< no window decoration */
SDL_WINDOW_RESIZABLE = 0x00000020, /**< window can be resized */
SDL_WINDOW_MINIMIZED = 0x00000040, /**< window is minimized */
SDL_WINDOW_MAXIMIZED = 0x00000080, /**< window is maximized */
SDL_WINDOW_INPUT_GRABBED = 0x00000100, /**< window has grabbed input focus */
SDL_WINDOW_INPUT_FOCUS = 0x00000200, /**< window has input focus */
SDL_WINDOW_MOUSE_FOCUS = 0x00000400, /**< window has mouse focus */
SDL_WINDOW_FULLSCREEN_DESKTOP = ( SDL_WINDOW_FULLSCREEN | 0x00001000 ),
SDL_WINDOW_FOREIGN = 0x00000800, /**< window not created by SDL */
SDL_WINDOW_ALLOW_HIGHDPI = 0x00002000, /**< window should be created in high-DPI mode if supported */
SDL_WINDOW_MOUSE_CAPTURE = 0x00004000 /**< window has mouse captured (unrelated to INPUT_GRABBED) */
} SDL_WindowFlags;
SDL_WindowFlags
SDL_WindowFlags
The flags on a window.
Definition: SDL_video.h:96
SDL_WINDOW_MOUSE_FOCUS
Definition: SDL_video.h:108
SDL_WINDOW_HIDDEN
Definition: SDL_video.h:101
SDL_WINDOW_SHOWN
Definition: SDL_video.h:100
SDL_WINDOW_MOUSE_CAPTURE
Definition: SDL_video.h:112
SDL_WINDOW_ALLOW_HIGHDPI
Definition: SDL_video.h:111
SDL_WINDOW_MINIMIZED
Definition: SDL_video.h:104
SDL_WINDOW_INPUT_FOCUS
Definition: SDL_video.h:107
SDL_WINDOW_RESIZABLE
Definition: SDL_video.h:103
SDL_WINDOW_BORDERLESS
Definition: SDL_video.h:102
SDL_WINDOW_MAXIMIZED
Definition: SDL_video.h:105
SDL_WINDOW_FULLSCREEN
Definition: SDL_video.h:98
SDL_WINDOW_OPENGL
Definition: SDL_video.h:99
SDL_WINDOW_FOREIGN
Definition: SDL_video.h:110
SDL_WINDOW_INPUT_GRABBED
Definition: SDL_video.h:106
SDL_WINDOW_FULLSCREEN_DESKTOP
Definition: SDL_video.h:109

## Function Documentation

SDL_Window* 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, in screen coordinates.
  h | The height of the window, in screen coordinates.
  flags | The 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.

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() or SDL_GetRendererOutputSize() to query the drawable size in pixels.

See also
  SDL_DestroyWindow()

Definition at line 1316 of file SDL_video.c.

References SDL_Window::brightness, CREATE_FLAGS, SDL_VideoDevice::CreateWindow, SDL_Window::flags, FULLSCREEN_VISIBLE, SDL_VideoDevice::GL_CreateContext, SDL_Rect::h, SDL_Window::h, SDL_Window::id, SDL_Window::is_destroying, SDL_Window::last_fullscreen_flags, SDL_Window::magic, SDL_Window::next, SDL_VideoDevice::next_object_id, NULL, SDL_Window::prev, SDL_atoi, SDL_calloc(), SDL_DestroyWindow(), SDL_FALSE, SDL_FinishWindowCreation(), SDL_GetDisplayBounds(), SDL_GetDisplayForWindow(), SDL_GetHint, SDL_GetIndexOfDisplay(), SDL_GL_LoadLibrary(), SDL_HINT_VIDEO_HIGHDPI_DISABLED, SDL_OutOfMemory, SDL_SetError, SDL_SetWindowTitle(), SDL_UpdateFullscreenMode(), SDL_VideoInit(), SDL_WINDOW_ALLOW_HIGHDPI, SDL_WINDOW_HIDDEN, SDL_WINDOW_OPENGL, SDL_WINDOWPOS_ISCENTERED, SDL_WINDOWPOS_ISUNDEFINED, SDL_Rect::w, SDL_Window::w, window, SDL_VideoDevice::window_magic, SDL_VideoDevice::windows, SDL_Rect::x, SDL_Window::x, SDL_Rect::y, and SDL_Window::y.

Referenced by ShouldUseTextureFramebuffer().

{
SDL_Window *window;
const char *hint;
if (!_this) {
/* Initialize the video system if needed */
if (SDL_VideoInit(NULL) < 0) {
return NULL;
}
}
/* Some platforms can't create zero-sized windows */
if (w < 1) {
w = 1;
}
if (h < 1) {
h = 1;
}
/* Some platforms blow up if the windows are too large. Raise it later? */
if ((w > 16384) || (h > 16384)) {
SDL_SetError("Window is too large.");
return NULL;
}
/* Some platforms have OpenGL enabled by default */
#if (SDL_VIDEO_OPENGL && __MACOSX__) || __IPHONEOS__ || __ANDROID__ || __NACL__
flags |= SDL_WINDOW_OPENGL;
#endif
if (flags & SDL_WINDOW_OPENGL) {
if (!_this->GL_CreateContext) {
SDL_SetError("No OpenGL support in video driver");
return NULL;
}
if (SDL_GL_LoadLibrary(NULL) < 0) {
return NULL;
}
}
/* Unless the user has specified the high-DPI disabling hint, respect the
* SDL_WINDOW_ALLOW_HIGHDPI flag.
*/
if (flags & SDL_WINDOW_ALLOW_HIGHDPI) {
hint = SDL_GetHint(SDL_HINT_VIDEO_HIGHDPI_DISABLED);
if (hint && SDL_atoi(hint) > 0) {
flags &= ~SDL_WINDOW_ALLOW_HIGHDPI;
}
}
window = (SDL_Window *)SDL_calloc(1, sizeof(*window));
if (!window) {
SDL_OutOfMemory();
return NULL;
}
window->magic = &_this->window_magic;
window->id = _this->next_object_id++;
window->x = x;
window->y = y;
window->w = w;
window->h = h;
if (SDL_WINDOWPOS_ISUNDEFINED(x) || SDL_WINDOWPOS_ISUNDEFINED(y) ||
SDL_WINDOWPOS_ISCENTERED(x) || SDL_WINDOWPOS_ISCENTERED(y)) {
SDL_VideoDisplay *display = SDL_GetDisplayForWindow(window);
int displayIndex;
SDL_Rect bounds;
displayIndex = SDL_GetIndexOfDisplay(display);
SDL_GetDisplayBounds(displayIndex, &bounds);
if (SDL_WINDOWPOS_ISUNDEFINED(x) || SDL_WINDOWPOS_ISCENTERED(x)) {
window->x = bounds.x + (bounds.w - w) / 2;
}
if (SDL_WINDOWPOS_ISUNDEFINED(y) || SDL_WINDOWPOS_ISCENTERED(y)) {
window->y = bounds.y + (bounds.h - h) / 2;
}
}
window->flags = ((flags & CREATE_FLAGS) | SDL_WINDOW_HIDDEN);
window->last_fullscreen_flags = window->flags;
window->brightness = 1.0f;
window->next = _this->windows;
window->is_destroying = SDL_FALSE;
if (_this->windows) {
_this->windows->prev = window;
}
_this->windows = window;
if (_this->CreateWindow && _this->CreateWindow(_this, window) < 0) {
SDL_DestroyWindow(window);
return NULL;
}
#if __WINRT__ && (NTDDI_VERSION < NTDDI_WIN10)
/* HACK: WinRT 8.x apps can't choose whether or not they are fullscreen
or not. The user can choose this, via OS-provided UI, but this can't
be set programmatically.
Just look at what SDL's WinRT video backend code detected with regards
to fullscreen (being active, or not), and figure out a return/error code
from that.
*/
flags = window->flags;
#endif
if (title) {
SDL_SetWindowTitle(window, title);
}
SDL_FinishWindowCreation(window, flags);
/* If the window was created fullscreen, make sure the mode code matches */
SDL_UpdateFullscreenMode(window, FULLSCREEN_VISIBLE(window));
return window;
}
SDL_WINDOWPOS_ISUNDEFINED
#define SDL_WINDOWPOS_ISUNDEFINED(X)
Definition: SDL_video.h:121
SDL_Window::next
SDL_Window * next
Definition: SDL_sysvideo.h:109
SDL_Window::w
int w
Definition: SDL_sysvideo.h:78
FULLSCREEN_VISIBLE
#define FULLSCREEN_VISIBLE(W)
Definition: SDL_sysvideo.h:111
x
GLint GLint GLint GLint GLint x
Definition: SDL_opengl.h:1567
SDL_Window::x
int x
Definition: SDL_sysvideo.h:77
SDL_Window::magic
const void * magic
Definition: SDL_sysvideo.h:73
window
SDL_Window * window
Definition: testautomation_render.c:26
SDL_HINT_VIDEO_HIGHDPI_DISABLED
#define SDL_HINT_VIDEO_HIGHDPI_DISABLED
If set to 1, then do not allow high-DPI windows. ("Retina" on Mac and iOS)
Definition: SDL_hints.h:379
SDL_GL_LoadLibrary
int SDL_GL_LoadLibrary(const char *path)
Dynamically load an OpenGL library.
Definition: SDL_video.c:2582
SDL_SetWindowTitle
void SDL_SetWindowTitle(SDL_Window *window, const char *title)
Set the title of a window, in UTF-8 format.
Definition: SDL_video.c:1579
SDL_GetHint
#define SDL_GetHint
Definition: SDL_dynapi_overrides.h:197
SDL_WINDOWPOS_ISCENTERED
#define SDL_WINDOWPOS_ISCENTERED(X)
Definition: SDL_video.h:130
SDL_Window::is_destroying
SDL_bool is_destroying
Definition: SDL_sysvideo.h:97
SDL_WINDOW_HIDDEN
Definition: SDL_video.h:101
_this
static SDL_VideoDevice * _this
Definition: SDL_video.c:114
CREATE_FLAGS
#define CREATE_FLAGS
Definition: SDL_video.c:1287
SDL_calloc
void * SDL_calloc(size_t nmemb, size_t size)
SDL_GetDisplayForWindow
SDL_VideoDisplay * SDL_GetDisplayForWindow(SDL_Window *window)
Definition: SDL_video.c:1039
SDL_VideoDevice::GL_CreateContext
SDL_GLContext(* GL_CreateContext)(_THIS, SDL_Window *window)
Definition: SDL_sysvideo.h:237
y
GLint GLint GLint GLint GLint GLint y
Definition: SDL_opengl.h:1567
SDL_DestroyWindow
void SDL_DestroyWindow(SDL_Window *window)
Destroy a window.
Definition: SDL_video.c:2419
SDL_WINDOW_ALLOW_HIGHDPI
Definition: SDL_video.h:111
SDL_Window::y
int y
Definition: SDL_sysvideo.h:77
SDL_Rect::x
int x
Definition: SDL_rect.h:66
SDL_UpdateFullscreenMode
static int SDL_UpdateFullscreenMode(SDL_Window *window, SDL_bool fullscreen)
Definition: SDL_video.c:1133
SDL_VideoDevice::windows
SDL_Window * windows
Definition: SDL_sysvideo.h:281
SDL_GetDisplayBounds
int SDL_GetDisplayBounds(int displayIndex, SDL_Rect *rect)
Get the desktop area represented by a display, with the primary display located at 0...
Definition: SDL_video.c:663
SDL_Rect::w
int w
Definition: SDL_rect.h:67
SDL_atoi
#define SDL_atoi
Definition: SDL_dynapi_overrides.h:416
SDL_VideoDevice::window_magic
Uint8 window_magic
Definition: SDL_sysvideo.h:283
SDL_Window::brightness
float brightness
Definition: SDL_sysvideo.h:89
SDL_VideoDisplay
Definition: SDL_sysvideo.h:120
SDL_Window::h
int h
Definition: SDL_sysvideo.h:78
NULL
#define NULL
Definition: begin_code.h:143
SDL_OutOfMemory
#define SDL_OutOfMemory()
Definition: SDL_error.h:52
SDL_Window::last_fullscreen_flags
Uint32 last_fullscreen_flags
Definition: SDL_sysvideo.h:82
SDL_SetError
#define SDL_SetError
Definition: SDL_dynapi_overrides.h:36
SDL_Window::prev
SDL_Window * prev
Definition: SDL_sysvideo.h:108
SDL_VideoInit
int SDL_VideoInit(const char *driver_name)
Initialize the video subsystem, optionally specifying a video driver.
Definition: SDL_video.c:443
SDL_Rect::h
int h
Definition: SDL_rect.h:67
SDL_VideoDevice::CreateWindow
int(* CreateWindow)(_THIS, SDL_Window *window)
Definition: SDL_sysvideo.h:195
SDL_Window
The type used to identify a window.
Definition: SDL_sysvideo.h:71
SDL_FinishWindowCreation
static void SDL_FinishWindowCreation(SDL_Window *window, Uint32 flags)
Definition: SDL_video.c:1291
SDL_FALSE
Definition: SDL_stdinc.h:128
SDL_Window::id
Uint32 id
Definition: SDL_sysvideo.h:74
flags
GLbitfield flags
Definition: SDL_opengl_glext.h:1480
SDL_WINDOW_OPENGL
Definition: SDL_video.h:99
w
GLubyte GLubyte GLubyte GLubyte w
Definition: SDL_opengl_glext.h:731
SDL_GetIndexOfDisplay
static int SDL_GetIndexOfDisplay(SDL_VideoDisplay *display)
Definition: SDL_video.c:632
SDL_Window::flags
Uint32 flags
Definition: SDL_sysvideo.h:81
SDL_VideoDevice::next_object_id
Uint32 next_object_id
Definition: SDL_sysvideo.h:284
SDL_Rect::y
int y
Definition: SDL_rect.h:66
h
GLfloat GLfloat GLfloat GLfloat h
Definition: SDL_opengl_glext.h:1946
SDL_Rect
A rectangle, with the origin at the upper left.
Definition: SDL_rect.h:64

SDL_Window* SDL_CreateWindowFrom | ( | const void * | data | ) |

Create an SDL window from an existing native window.

Parameters

  data | A pointer to driver-dependent window creation data

Returns
  The id of the window created, or zero if window creation failed.

See also
  SDL_DestroyWindow()

Definition at line 1432 of file SDL_video.c.

References SDL_Window::brightness, SDL_VideoDevice::CreateWindowFrom, SDL_Window::flags, SDL_Window::id, SDL_Window::is_destroying, SDL_Window::last_fullscreen_flags, SDL_Window::magic, SDL_Window::next, SDL_VideoDevice::next_object_id, NULL, SDL_Window::prev, SDL_calloc(), SDL_DestroyWindow(), SDL_FALSE, SDL_OutOfMemory, SDL_UninitializedVideo(), SDL_Unsupported, SDL_WINDOW_FOREIGN, window, SDL_VideoDevice::window_magic, and SDL_VideoDevice::windows.

{
SDL_Window *window;
if (!_this) {
SDL_UninitializedVideo();
return NULL;
}
if (!_this->CreateWindowFrom) {
SDL_Unsupported();
return NULL;
}
window = (SDL_Window *)SDL_calloc(1, sizeof(*window));
if (!window) {
SDL_OutOfMemory();
return NULL;
}
window->magic = &_this->window_magic;
window->id = _this->next_object_id++;
window->flags = SDL_WINDOW_FOREIGN;
window->last_fullscreen_flags = window->flags;
window->is_destroying = SDL_FALSE;
window->brightness = 1.0f;
window->next = _this->windows;
if (_this->windows) {
_this->windows->prev = window;
}
_this->windows = window;
if (_this->CreateWindowFrom(_this, window, data) < 0) {
SDL_DestroyWindow(window);
return NULL;
}
return window;
}
SDL_Window::next
SDL_Window * next
Definition: SDL_sysvideo.h:109
SDL_Window::magic
const void * magic
Definition: SDL_sysvideo.h:73
SDL_VideoDevice::CreateWindowFrom
int(* CreateWindowFrom)(_THIS, SDL_Window *window, const void *data)
Definition: SDL_sysvideo.h:196
window
SDL_Window * window
Definition: testautomation_render.c:26
data
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: SDL_opengl.h:1967
SDL_Window::is_destroying
SDL_bool is_destroying
Definition: SDL_sysvideo.h:97
_this
static SDL_VideoDevice * _this
Definition: SDL_video.c:114
SDL_calloc
void * SDL_calloc(size_t nmemb, size_t size)
SDL_DestroyWindow
void SDL_DestroyWindow(SDL_Window *window)
Destroy a window.
Definition: SDL_video.c:2419
SDL_VideoDevice::windows
SDL_Window * windows
Definition: SDL_sysvideo.h:281
SDL_VideoDevice::window_magic
Uint8 window_magic
Definition: SDL_sysvideo.h:283
SDL_Window::brightness
float brightness
Definition: SDL_sysvideo.h:89
NULL
#define NULL
Definition: begin_code.h:143
SDL_OutOfMemory
#define SDL_OutOfMemory()
Definition: SDL_error.h:52
SDL_Window::last_fullscreen_flags
Uint32 last_fullscreen_flags
Definition: SDL_sysvideo.h:82
SDL_Window::prev
SDL_Window * prev
Definition: SDL_sysvideo.h:108
SDL_Window
The type used to identify a window.
Definition: SDL_sysvideo.h:71
SDL_FALSE
Definition: SDL_stdinc.h:128
SDL_Window::id
Uint32 id
Definition: SDL_sysvideo.h:74
SDL_UninitializedVideo
static int SDL_UninitializedVideo()
Definition: SDL_video.c:419
SDL_WINDOW_FOREIGN
Definition: SDL_video.h:110
SDL_Window::flags
Uint32 flags
Definition: SDL_sysvideo.h:81
SDL_VideoDevice::next_object_id
Uint32 next_object_id
Definition: SDL_sysvideo.h:284
SDL_Unsupported
#define SDL_Unsupported()
Definition: SDL_error.h:53

void SDL_DestroyWindow | ( | SDL_Window * | window | ) |

Destroy a window.

Definition at line 2419 of file SDL_video.c.

References CHECK_WINDOW_MAGIC, SDL_VideoDevice::current_glwin, SDL_Window::data, SDL_VideoDevice::DestroyWindow, SDL_VideoDevice::DestroyWindowFramebuffer, SDL_Surface::flags, SDL_Window::flags, SDL_VideoDisplay::fullscreen_window, SDL_Window::gamma, SDL_Window::icon, SDL_Window::is_destroying, SDL_Window::magic, SDL_WindowUserData::name, SDL_WindowUserData::next, SDL_Window::next, NULL, SDL_Window::prev, SDL_DONTFREE, SDL_free(), SDL_FreeSurface, SDL_GetDisplayForWindow(), SDL_GetKeyboardFocus, SDL_GetMouseFocus, SDL_GL_MakeCurrent(), SDL_GL_UnloadLibrary(), SDL_HideWindow(), SDL_SetKeyboardFocus(), SDL_SetMouseFocus(), SDL_TRUE, SDL_WINDOW_OPENGL, SDL_Window::surface, SDL_Window::title, and SDL_VideoDevice::windows.

Referenced by SDL_CreateWindow(), SDL_CreateWindowFrom(), SDL_VideoQuit(), and ShouldUseTextureFramebuffer().

{
SDL_VideoDisplay *display;
CHECK_WINDOW_MAGIC(window,);
window->is_destroying = SDL_TRUE;
/* Restore video mode, etc. */
SDL_HideWindow(window);
/* Make sure this window no longer has focus */
if (SDL_GetKeyboardFocus() == window) {
SDL_SetKeyboardFocus(NULL);
}
if (SDL_GetMouseFocus() == window) {
SDL_SetMouseFocus(NULL);
}
/* make no context current if this is the current context window. */
if (window->flags & SDL_WINDOW_OPENGL) {
if (_this->current_glwin == window) {
SDL_GL_MakeCurrent(window, NULL);
}
}
if (window->surface) {
window->surface->flags &= ~SDL_DONTFREE;
SDL_FreeSurface(window->surface);
}
if (_this->DestroyWindowFramebuffer) {
_this->DestroyWindowFramebuffer(_this, window);
}
if (_this->DestroyWindow) {
_this->DestroyWindow(_this, window);
}
if (window->flags & SDL_WINDOW_OPENGL) {
SDL_GL_UnloadLibrary();
}
display = SDL_GetDisplayForWindow(window);
if (display->fullscreen_window == window) {
display->fullscreen_window = NULL;
}
/* Now invalidate magic */
window->magic = NULL;
/* Free memory associated with the window */
SDL_free(window->title);
SDL_FreeSurface(window->icon);
SDL_free(window->gamma);
while (window->data) {
SDL_WindowUserData *data = window->data;
window->data = data->next;
SDL_free(data->name);
SDL_free(data);
}
/* Unlink the window from the list */
if (window->next) {
window->next->prev = window->prev;
}
if (window->prev) {
window->prev->next = window->next;
} else {
_this->windows = window->next;
}
SDL_free(window);
}
SDL_Window::next
SDL_Window * next
Definition: SDL_sysvideo.h:109
SDL_WindowUserData
Definition: SDL_sysvideo.h:63
SDL_SetKeyboardFocus
void SDL_SetKeyboardFocus(SDL_Window *window)
Definition: SDL_keyboard.c:612
SDL_Window::magic
const void * magic
Definition: SDL_sysvideo.h:73
data
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: SDL_opengl.h:1967
SDL_DONTFREE
#define SDL_DONTFREE
Definition: SDL_surface.h:55
SDL_Window::is_destroying
SDL_bool is_destroying
Definition: SDL_sysvideo.h:97
SDL_SetMouseFocus
void SDL_SetMouseFocus(SDL_Window *window)
Definition: SDL_mouse.c:103
SDL_HideWindow
void SDL_HideWindow(SDL_Window *window)
Hide a window.
Definition: SDL_video.c:1950
SDL_GetKeyboardFocus
#define SDL_GetKeyboardFocus
Definition: SDL_dynapi_overrides.h:222
SDL_Surface::flags
Uint32 flags
Definition: SDL_surface.h:71
_this
static SDL_VideoDevice * _this
Definition: SDL_video.c:114
SDL_WindowUserData::next
struct SDL_WindowUserData * next
Definition: SDL_sysvideo.h:67
SDL_GetDisplayForWindow
SDL_VideoDisplay * SDL_GetDisplayForWindow(SDL_Window *window)
Definition: SDL_video.c:1039
SDL_FreeSurface
#define SDL_FreeSurface
Definition: SDL_dynapi_overrides.h:450
SDL_WindowUserData::name
char * name
Definition: SDL_sysvideo.h:65
SDL_free
void SDL_free(void *mem)
SDL_GL_MakeCurrent
int SDL_GL_MakeCurrent(SDL_Window *window, SDL_GLContext ctx)
Set up an OpenGL context for rendering into an OpenGL window.
Definition: SDL_video.c:3158
SDL_GL_UnloadLibrary
void SDL_GL_UnloadLibrary(void)
Unload the OpenGL library previously loaded by SDL_GL_LoadLibrary().
Definition: SDL_video.c:2633
SDL_VideoDevice::DestroyWindow
void(* DestroyWindow)(_THIS, SDL_Window *window)
Definition: SDL_sysvideo.h:214
SDL_Window::title
char * title
Definition: SDL_sysvideo.h:75
SDL_VideoDevice::windows
SDL_Window * windows
Definition: SDL_sysvideo.h:281
SDL_TRUE
Definition: SDL_stdinc.h:129
SDL_VideoDisplay::fullscreen_window
SDL_Window * fullscreen_window
Definition: SDL_sysvideo.h:129
SDL_VideoDisplay
Definition: SDL_sysvideo.h:120
SDL_VideoDevice::DestroyWindowFramebuffer
void(* DestroyWindowFramebuffer)(_THIS, SDL_Window *window)
Definition: SDL_sysvideo.h:217
NULL
#define NULL
Definition: begin_code.h:143
SDL_GetMouseFocus
#define SDL_GetMouseFocus
Definition: SDL_dynapi_overrides.h:251
SDL_Window::icon
SDL_Surface * icon
Definition: SDL_sysvideo.h:76
SDL_Window::prev
SDL_Window * prev
Definition: SDL_sysvideo.h:108
SDL_WINDOW_OPENGL
Definition: SDL_video.h:99
SDL_Window::gamma
Uint16 * gamma
Definition: SDL_sysvideo.h:90
CHECK_WINDOW_MAGIC
#define CHECK_WINDOW_MAGIC(window, retval)
Definition: SDL_video.c:116
SDL_Window::flags
Uint32 flags
Definition: SDL_sysvideo.h:81
SDL_Window::surface
SDL_Surface * surface
Definition: SDL_sysvideo.h:93
SDL_VideoDevice::current_glwin
SDL_Window * current_glwin
Definition: SDL_sysvideo.h:325
SDL_Window::data
SDL_WindowUserData * data
Definition: SDL_sysvideo.h:104

void SDL_DisableScreenSaver | ( | void |  | ) |

Prevent the screen from being blanked by a screensaver.

See also
  SDL_IsScreenSaverEnabled()
  SDL_EnableScreenSaver()

Definition at line 2517 of file SDL_video.c.

References SDL_TRUE, SDL_VideoDevice::suspend_screensaver, and SDL_VideoDevice::SuspendScreenSaver.

Referenced by SDL_VideoInit().

{
if (!_this) {
return;
}
if (_this->suspend_screensaver) {
return;
}
_this->suspend_screensaver = SDL_TRUE;
if (_this->SuspendScreenSaver) {
_this->SuspendScreenSaver(_this);
}
}
_this
static SDL_VideoDevice * _this
Definition: SDL_video.c:114
SDL_TRUE
Definition: SDL_stdinc.h:129
SDL_VideoDevice::suspend_screensaver
SDL_bool suspend_screensaver
Definition: SDL_sysvideo.h:278
SDL_VideoDevice::SuspendScreenSaver
void(* SuspendScreenSaver)(_THIS)
Definition: SDL_sysvideo.h:252

void SDL_EnableScreenSaver | ( | void |  | ) |

Allow the screen to be blanked by a screensaver.

See also
  SDL_IsScreenSaverEnabled()
  SDL_DisableScreenSaver()

Definition at line 2502 of file SDL_video.c.

References SDL_FALSE, SDL_VideoDevice::suspend_screensaver, and SDL_VideoDevice::SuspendScreenSaver.

Referenced by SDL_VideoQuit().

{
if (!_this) {
return;
}
if (!_this->suspend_screensaver) {
return;
}
_this->suspend_screensaver = SDL_FALSE;
if (_this->SuspendScreenSaver) {
_this->SuspendScreenSaver(_this);
}
}
_this
static SDL_VideoDevice * _this
Definition: SDL_video.c:114
SDL_FALSE
Definition: SDL_stdinc.h:128
SDL_VideoDevice::suspend_screensaver
SDL_bool suspend_screensaver
Definition: SDL_sysvideo.h:278
SDL_VideoDevice::SuspendScreenSaver
void(* SuspendScreenSaver)(_THIS)
Definition: SDL_sysvideo.h:252

SDL_DisplayMode* SDL_GetClosestDisplayMode | ( | int | displayIndex,
|  | const SDL_DisplayMode * | mode,
|  | SDL_DisplayMode * | closest
| ) |  |

Get the closest match to the requested display mode.

Parameters

  displayIndex | The index of display from which mode should be queried.
  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()

Definition at line 917 of file SDL_video.c.

References CHECK_DISPLAY_INDEX, SDL_VideoDevice::displays, NULL, and SDL_GetClosestDisplayModeForDisplay().

{
SDL_VideoDisplay *display;
CHECK_DISPLAY_INDEX(displayIndex, NULL);
display = &_this->displays[displayIndex];
return SDL_GetClosestDisplayModeForDisplay(display, mode, closest);
}
_this
static SDL_VideoDevice * _this
Definition: SDL_video.c:114
SDL_VideoDevice::displays
SDL_VideoDisplay * displays
Definition: SDL_sysvideo.h:280
SDL_VideoDisplay
Definition: SDL_sysvideo.h:120
NULL
#define NULL
Definition: begin_code.h:143
SDL_GetClosestDisplayModeForDisplay
static SDL_DisplayMode * SDL_GetClosestDisplayModeForDisplay(SDL_VideoDisplay *display, const SDL_DisplayMode *mode, SDL_DisplayMode *closest)
Definition: SDL_video.c:810
CHECK_DISPLAY_INDEX
#define CHECK_DISPLAY_INDEX(displayIndex, retval)
Definition: SDL_video.c:126

int SDL_GetCurrentDisplayMode | ( | int | displayIndex,
|  | SDL_DisplayMode * | mode
| ) |  |

Fill in information about the current display mode.

Definition at line 796 of file SDL_video.c.

References CHECK_DISPLAY_INDEX, SDL_VideoDisplay::current_mode, and SDL_VideoDevice::displays.

{
SDL_VideoDisplay *display;
CHECK_DISPLAY_INDEX(displayIndex, -1);
display = &_this->displays[displayIndex];
if (mode) {
*mode = display->current_mode;
}
return 0;
}
_this
static SDL_VideoDevice * _this
Definition: SDL_video.c:114
SDL_VideoDisplay::current_mode
SDL_DisplayMode current_mode
Definition: SDL_sysvideo.h:127
SDL_VideoDevice::displays
SDL_VideoDisplay * displays
Definition: SDL_sysvideo.h:280
SDL_VideoDisplay
Definition: SDL_sysvideo.h:120
CHECK_DISPLAY_INDEX
#define CHECK_DISPLAY_INDEX(displayIndex, retval)
Definition: SDL_video.c:126

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

Definition at line 563 of file SDL_video.c.

References SDL_VideoDevice::name, NULL, and SDL_UninitializedVideo().

{
if (!_this) {
SDL_UninitializedVideo();
return NULL;
}
return _this->name;
}
SDL_VideoDevice::name
const char * name
Definition: SDL_sysvideo.h:146
_this
static SDL_VideoDevice * _this
Definition: SDL_video.c:114
NULL
#define NULL
Definition: begin_code.h:143
SDL_UninitializedVideo
static int SDL_UninitializedVideo()
Definition: SDL_video.c:419

int SDL_GetDesktopDisplayMode | ( | int | displayIndex,
|  | SDL_DisplayMode * | mode
| ) |  |

Fill in information about the desktop display mode.

Definition at line 782 of file SDL_video.c.

References CHECK_DISPLAY_INDEX, SDL_VideoDisplay::desktop_mode, and SDL_VideoDevice::displays.

{
SDL_VideoDisplay *display;
CHECK_DISPLAY_INDEX(displayIndex, -1);
display = &_this->displays[displayIndex];
if (mode) {
*mode = display->desktop_mode;
}
return 0;
}
_this
static SDL_VideoDevice * _this
Definition: SDL_video.c:114
SDL_VideoDevice::displays
SDL_VideoDisplay * displays
Definition: SDL_sysvideo.h:280
SDL_VideoDisplay
Definition: SDL_sysvideo.h:120
SDL_VideoDisplay::desktop_mode
SDL_DisplayMode desktop_mode
Definition: SDL_sysvideo.h:126
CHECK_DISPLAY_INDEX
#define CHECK_DISPLAY_INDEX(displayIndex, retval)
Definition: SDL_video.c:126

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

Definition at line 663 of file SDL_video.c.

References CHECK_DISPLAY_INDEX, SDL_VideoDisplay::current_mode, SDL_VideoDevice::displays, SDL_VideoDevice::GetDisplayBounds, SDL_DisplayMode::h, SDL_Rect::h, SDL_DisplayMode::w, SDL_Rect::w, SDL_Rect::x, and SDL_Rect::y.

Referenced by SDL_CreateWindow(), SDL_GetWindowDisplayIndex(), SDL_GetWindowPosition(), and SDL_SetWindowPosition().

{
CHECK_DISPLAY_INDEX(displayIndex, -1);
if (rect) {
SDL_VideoDisplay *display = &_this->displays[displayIndex];
if (_this->GetDisplayBounds) {
if (_this->GetDisplayBounds(_this, display, rect) == 0) {
return 0;
}
}
/* Assume that the displays are left to right */
if (displayIndex == 0) {
rect->x = 0;
rect->y = 0;
} else {
SDL_GetDisplayBounds(displayIndex-1, rect);
rect->x += rect->w;
}
rect->w = display->current_mode.w;
rect->h = display->current_mode.h;
}
return 0;
}
SDL_DisplayMode::w
int w
Definition: SDL_video.h:56
_this
static SDL_VideoDevice * _this
Definition: SDL_video.c:114
SDL_VideoDisplay::current_mode
SDL_DisplayMode current_mode
Definition: SDL_sysvideo.h:127
SDL_VideoDevice::displays
SDL_VideoDisplay * displays
Definition: SDL_sysvideo.h:280
SDL_VideoDevice::GetDisplayBounds
int(* GetDisplayBounds)(_THIS, SDL_VideoDisplay *display, SDL_Rect *rect)
Definition: SDL_sysvideo.h:171
SDL_DisplayMode::h
int h
Definition: SDL_video.h:57
SDL_Rect::x
int x
Definition: SDL_rect.h:66
SDL_GetDisplayBounds
int SDL_GetDisplayBounds(int displayIndex, SDL_Rect *rect)
Get the desktop area represented by a display, with the primary display located at 0...
Definition: SDL_video.c:663
SDL_Rect::w
int w
Definition: SDL_rect.h:67
SDL_VideoDisplay
Definition: SDL_sysvideo.h:120
SDL_Rect::h
int h
Definition: SDL_rect.h:67
CHECK_DISPLAY_INDEX
#define CHECK_DISPLAY_INDEX(displayIndex, retval)
Definition: SDL_video.c:126
SDL_Rect::y
int y
Definition: SDL_rect.h:66

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

Definition at line 691 of file SDL_video.c.

References CHECK_DISPLAY_INDEX, SDL_VideoDevice::displays, and SDL_VideoDevice::GetDisplayDPI.

{
SDL_VideoDisplay *display;
CHECK_DISPLAY_INDEX(displayIndex, -1);
display = &_this->displays[displayIndex];
if (_this->GetDisplayDPI) {
if (_this->GetDisplayDPI(_this, display, ddpi, hdpi, vdpi) == 0) {
return 0;
}
}
return -1;
}
SDL_VideoDevice::GetDisplayDPI
int(* GetDisplayDPI)(_THIS, SDL_VideoDisplay *display, float *ddpi, float *hdpi, float *vdpi)
Definition: SDL_sysvideo.h:176
_this
static SDL_VideoDevice * _this
Definition: SDL_video.c:114
SDL_VideoDevice::displays
SDL_VideoDisplay * displays
Definition: SDL_sysvideo.h:280
SDL_VideoDisplay
Definition: SDL_sysvideo.h:120
CHECK_DISPLAY_INDEX
#define CHECK_DISPLAY_INDEX(displayIndex, retval)
Definition: SDL_video.c:126

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

Definition at line 764 of file SDL_video.c.

References CHECK_DISPLAY_INDEX, SDL_VideoDisplay::display_modes, SDL_VideoDevice::displays, SDL_GetNumDisplayModesForDisplay(), and SDL_SetError.

{
SDL_VideoDisplay *display;
CHECK_DISPLAY_INDEX(displayIndex, -1);
display = &_this->displays[displayIndex];
if (index < 0 || index >= SDL_GetNumDisplayModesForDisplay(display)) {
return SDL_SetError("index must be in the range of 0 - %d",
SDL_GetNumDisplayModesForDisplay(display) - 1);
}
if (mode) {
*mode = display->display_modes[index];
}
return 0;
}
SDL_GetNumDisplayModesForDisplay
static int SDL_GetNumDisplayModesForDisplay(SDL_VideoDisplay *display)
Definition: SDL_video.c:745
_this
static SDL_VideoDevice * _this
Definition: SDL_video.c:114
SDL_VideoDisplay::display_modes
SDL_DisplayMode * display_modes
Definition: SDL_sysvideo.h:125
SDL_VideoDevice::displays
SDL_VideoDisplay * displays
Definition: SDL_sysvideo.h:280
index
GLuint index
Definition: SDL_opengl_glext.h:660
SDL_VideoDisplay
Definition: SDL_sysvideo.h:120
SDL_SetError
#define SDL_SetError
Definition: SDL_dynapi_overrides.h:36
CHECK_DISPLAY_INDEX
#define CHECK_DISPLAY_INDEX(displayIndex, retval)
Definition: SDL_video.c:126

const char* 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()

Definition at line 655 of file SDL_video.c.

References CHECK_DISPLAY_INDEX, SDL_VideoDevice::displays, SDL_VideoDisplay::name, and NULL.

{
CHECK_DISPLAY_INDEX(displayIndex, NULL);
return _this->displays[displayIndex].name;
}
SDL_VideoDisplay::name
char * name
Definition: SDL_sysvideo.h:122
_this
static SDL_VideoDevice * _this
Definition: SDL_video.c:114
SDL_VideoDevice::displays
SDL_VideoDisplay * displays
Definition: SDL_sysvideo.h:280
NULL
#define NULL
Definition: begin_code.h:143
CHECK_DISPLAY_INDEX
#define CHECK_DISPLAY_INDEX(displayIndex, retval)
Definition: SDL_video.c:126

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

Definition at line 2282 of file SDL_video.c.

References SDL_Window::flags, SDL_VideoDevice::grabbed_window, SDL_assert, and SDL_WINDOW_INPUT_GRABBED.

{
SDL_assert(!_this->grabbed_window || ((_this->grabbed_window->flags & SDL_WINDOW_INPUT_GRABBED) != 0));
return _this->grabbed_window;
}
_this
static SDL_VideoDevice * _this
Definition: SDL_video.c:114
SDL_assert
#define SDL_assert(condition)
Definition: SDL_assert.h:167
SDL_VideoDevice::grabbed_window
SDL_Window * grabbed_window
Definition: SDL_sysvideo.h:282
SDL_Window::flags
Uint32 flags
Definition: SDL_sysvideo.h:81
SDL_WINDOW_INPUT_GRABBED
Definition: SDL_video.h:106

int SDL_GetNumDisplayModes | ( | int | displayIndex | ) |

Returns the number of available display modes.

See also
  SDL_GetDisplayMode()

Definition at line 756 of file SDL_video.c.

References CHECK_DISPLAY_INDEX, SDL_VideoDevice::displays, and SDL_GetNumDisplayModesForDisplay().

{
CHECK_DISPLAY_INDEX(displayIndex, -1);
return SDL_GetNumDisplayModesForDisplay(&_this->displays[displayIndex]);
}
SDL_GetNumDisplayModesForDisplay
static int SDL_GetNumDisplayModesForDisplay(SDL_VideoDisplay *display)
Definition: SDL_video.c:745
_this
static SDL_VideoDevice * _this
Definition: SDL_video.c:114
SDL_VideoDevice::displays
SDL_VideoDisplay * displays
Definition: SDL_sysvideo.h:280
CHECK_DISPLAY_INDEX
#define CHECK_DISPLAY_INDEX(displayIndex, retval)
Definition: SDL_video.c:126

int SDL_GetNumVideoDisplays | ( | void |  | ) |

Returns the number of available video displays.

See also
  SDL_GetDisplayBounds()

Definition at line 622 of file SDL_video.c.

References SDL_VideoDevice::num_displays, and SDL_UninitializedVideo().

{
if (!_this) {
SDL_UninitializedVideo();
return 0;
}
return _this->num_displays;
}
_this
static SDL_VideoDevice * _this
Definition: SDL_video.c:114
SDL_VideoDevice::num_displays
int num_displays
Definition: SDL_sysvideo.h:279
SDL_UninitializedVideo
static int SDL_UninitializedVideo()
Definition: SDL_video.c:419

int SDL_GetNumVideoDrivers | ( | void |  | ) |

Get the number of video drivers compiled into SDL.

See also
  SDL_GetVideoDriver()

Definition at line 425 of file SDL_video.c.

References SDL_arraysize.

Referenced by SDL_GetVideoDriver().

{
return SDL_arraysize(bootstrap) - 1;
}
bootstrap
static VideoBootStrap * bootstrap[]
Definition: SDL_video.c:59
SDL_arraysize
#define SDL_arraysize(array)
Definition: SDL_stdinc.h:93

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

Definition at line 431 of file SDL_video.c.

References VideoBootStrap::name, NULL, and SDL_GetNumVideoDrivers().

{
if (index >= 0 && index < SDL_GetNumVideoDrivers()) {
return bootstrap[index]->name;
}
return NULL;
}
SDL_GetNumVideoDrivers
int SDL_GetNumVideoDrivers(void)
Get the number of video drivers compiled into SDL.
Definition: SDL_video.c:425
index
GLuint index
Definition: SDL_opengl_glext.h:660
NULL
#define NULL
Definition: begin_code.h:143
bootstrap
static VideoBootStrap * bootstrap[]
Definition: SDL_video.c:59
VideoBootStrap::name
const char * name
Definition: SDL_sysvideo.h:350

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

Definition at line 2140 of file SDL_video.c.

References SDL_Window::brightness, and CHECK_WINDOW_MAGIC.

{
CHECK_WINDOW_MAGIC(window, 1.0f);
return window->brightness;
}
f
GLfloat f
Definition: SDL_opengl_glext.h:1870
SDL_Window::brightness
float brightness
Definition: SDL_sysvideo.h:89
CHECK_WINDOW_MAGIC
#define CHECK_WINDOW_MAGIC(window, retval)
Definition: SDL_video.c:116

void* SDL_GetWindowData | ( | SDL_Window * | window,
|  | const char * | name
| ) |  |

Retrieve the data pointer associated with a window.

Parameters

  window | The window to query.
  name | The name of the pointer.

Returns
  The value associated with 'name'

See also
  SDL_SetWindowData()

Definition at line 1673 of file SDL_video.c.

References CHECK_WINDOW_MAGIC, SDL_WindowUserData::data, SDL_Window::data, SDL_WindowUserData::name, SDL_WindowUserData::next, NULL, SDL_InvalidParamError, and SDL_strcmp.

Referenced by SDL_CreateWindowTexture(), and SDL_UpdateWindowTexture().

{
SDL_WindowUserData *data;
CHECK_WINDOW_MAGIC(window, NULL);
/* Input validation */
if (name == NULL || name[0] == '\0') {
SDL_InvalidParamError("name");
return NULL;
}
for (data = window->data; data; data = data->next) {
if (data->name && SDL_strcmp(data->name, name) == 0) {
return data->data;
}
}
return NULL;
}
SDL_WindowUserData
Definition: SDL_sysvideo.h:63
SDL_WindowUserData::data
void * data
Definition: SDL_sysvideo.h:66
data
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: SDL_opengl.h:1967
name
GLuint const GLchar * name
Definition: SDL_opengl_glext.h:660
SDL_InvalidParamError
#define SDL_InvalidParamError(param)
Definition: SDL_error.h:54
SDL_WindowUserData::next
struct SDL_WindowUserData * next
Definition: SDL_sysvideo.h:67
SDL_WindowUserData::name
char * name
Definition: SDL_sysvideo.h:65
NULL
#define NULL
Definition: begin_code.h:143
SDL_strcmp
#define SDL_strcmp
Definition: SDL_dynapi_overrides.h:423
CHECK_WINDOW_MAGIC
#define CHECK_WINDOW_MAGIC(window, retval)
Definition: SDL_video.c:116
SDL_Window::data
SDL_WindowUserData * data
Definition: SDL_sysvideo.h:104

int 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.

Definition at line 979 of file SDL_video.c.

References CHECK_WINDOW_MAGIC, SDL_VideoDevice::displays, SDL_VideoDisplay::fullscreen_window, SDL_Rect::h, SDL_Window::h, i, NULL, SDL_VideoDevice::num_displays, rect, SDL_EnclosePoints, SDL_GetDisplayBounds(), SDL_SetError, SDL_WINDOWPOS_ISCENTERED, SDL_WINDOWPOS_ISUNDEFINED, SDL_Rect::w, SDL_Window::w, SDL_Point::x, SDL_Rect::x, SDL_Window::x, SDL_Point::y, SDL_Rect::y, and SDL_Window::y.

Referenced by SDL_GetDisplayForWindow(), and SDL_GetWindowPosition().

{
int displayIndex;
int i, dist;
int closest = -1;
int closest_dist = 0x7FFFFFFF;
SDL_Point center;
SDL_Point delta;
SDL_Rect rect;
CHECK_WINDOW_MAGIC(window, -1);
if (SDL_WINDOWPOS_ISUNDEFINED(window->x) ||
SDL_WINDOWPOS_ISCENTERED(window->x)) {
displayIndex = (window->x & 0xFFFF);
if (displayIndex >= _this->num_displays) {
displayIndex = 0;
}
return displayIndex;
}
if (SDL_WINDOWPOS_ISUNDEFINED(window->y) ||
SDL_WINDOWPOS_ISCENTERED(window->y)) {
displayIndex = (window->y & 0xFFFF);
if (displayIndex >= _this->num_displays) {
displayIndex = 0;
}
return displayIndex;
}
/* Find the display containing the window */
for (i = 0; i < _this->num_displays; ++i) {
SDL_VideoDisplay *display = &_this->displays[i];
if (display->fullscreen_window == window) {
return i;
}
}
center.x = window->x + window->w / 2;
center.y = window->y + window->h / 2;
for (i = 0; i < _this->num_displays; ++i) {
SDL_GetDisplayBounds(i, &rect);
if (SDL_EnclosePoints(&center, 1, &rect, NULL)) {
return i;
}
delta.x = center.x - (rect.x + rect.w / 2);
delta.y = center.y - (rect.y + rect.h / 2);
dist = (delta.x*delta.x + delta.y*delta.y);
if (dist < closest_dist) {
closest = i;
closest_dist = dist;
}
}
if (closest < 0) {
SDL_SetError("Couldn't find any displays");
}
return closest;
}
SDL_WINDOWPOS_ISUNDEFINED
#define SDL_WINDOWPOS_ISUNDEFINED(X)
Definition: SDL_video.h:121
SDL_Window::w
int w
Definition: SDL_sysvideo.h:78
SDL_Window::x
int x
Definition: SDL_sysvideo.h:77
rect
SDL_Rect rect
Definition: testrelative.c:27
SDL_Point
The structure that defines a point.
Definition: SDL_rect.h:48
SDL_WINDOWPOS_ISCENTERED
#define SDL_WINDOWPOS_ISCENTERED(X)
Definition: SDL_video.h:130
_this
static SDL_VideoDevice * _this
Definition: SDL_video.c:114
SDL_Point::x
int x
Definition: SDL_rect.h:50
SDL_Point::y
int y
Definition: SDL_rect.h:51
SDL_VideoDevice::num_displays
int num_displays
Definition: SDL_sysvideo.h:279
SDL_VideoDevice::displays
SDL_VideoDisplay * displays
Definition: SDL_sysvideo.h:280
SDL_Window::y
int y
Definition: SDL_sysvideo.h:77
SDL_Rect::x
int x
Definition: SDL_rect.h:66
SDL_GetDisplayBounds
int SDL_GetDisplayBounds(int displayIndex, SDL_Rect *rect)
Get the desktop area represented by a display, with the primary display located at 0...
Definition: SDL_video.c:663
SDL_Rect::w
int w
Definition: SDL_rect.h:67
SDL_VideoDisplay::fullscreen_window
SDL_Window * fullscreen_window
Definition: SDL_sysvideo.h:129
SDL_VideoDisplay
Definition: SDL_sysvideo.h:120
SDL_Window::h
int h
Definition: SDL_sysvideo.h:78
i
return Display return Display Bool Bool int int int return Display XEvent Bool(*) XPointer return Display return Display Drawable _Xconst char unsigned int unsigned int return Display Pixmap Pixmap XColor XColor unsigned int unsigned int return Display _Xconst char char int char return Display Visual unsigned int int int char unsigned int unsigned int in i)
Definition: SDL_x11sym.h:42
NULL
#define NULL
Definition: begin_code.h:143
SDL_SetError
#define SDL_SetError
Definition: SDL_dynapi_overrides.h:36
SDL_Rect::h
int h
Definition: SDL_rect.h:67
SDL_EnclosePoints
#define SDL_EnclosePoints
Definition: SDL_dynapi_overrides.h:302
CHECK_WINDOW_MAGIC
#define CHECK_WINDOW_MAGIC(window, retval)
Definition: SDL_video.c:116
SDL_Rect::y
int y
Definition: SDL_rect.h:66
SDL_Rect
A rectangle, with the origin at the upper left.
Definition: SDL_rect.h:64

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

Definition at line 1070 of file SDL_video.c.

References CHECK_WINDOW_MAGIC, SDL_VideoDisplay::desktop_mode, SDL_Window::flags, SDL_Window::fullscreen_mode, SDL_DisplayMode::h, SDL_Rect::h, SDL_GetClosestDisplayModeForDisplay(), SDL_GetDisplayForWindow(), SDL_InvalidParamError, SDL_SetError, SDL_WINDOW_FULLSCREEN_DESKTOP, SDL_DisplayMode::w, SDL_Rect::w, and SDL_Window::windowed.

Referenced by SDL_SetWindowDisplayMode(), and SDL_UpdateFullscreenMode().

{
SDL_DisplayMode fullscreen_mode;
SDL_VideoDisplay *display;
CHECK_WINDOW_MAGIC(window, -1);
if (!mode) {
return SDL_InvalidParamError("mode");
}
fullscreen_mode = window->fullscreen_mode;
if (!fullscreen_mode.w) {
fullscreen_mode.w = window->windowed.w;
}
if (!fullscreen_mode.h) {
fullscreen_mode.h = window->windowed.h;
}
display = SDL_GetDisplayForWindow(window);
/* if in desktop size mode, just return the size of the desktop */
if ((window->flags & SDL_WINDOW_FULLSCREEN_DESKTOP) == SDL_WINDOW_FULLSCREEN_DESKTOP) {
fullscreen_mode = display->desktop_mode;
} else if (!SDL_GetClosestDisplayModeForDisplay(SDL_GetDisplayForWindow(window),
&fullscreen_mode,
&fullscreen_mode)) {
return SDL_SetError("Couldn't find display mode match");
}
if (mode) {
*mode = fullscreen_mode;
}
return 0;
}
SDL_Window::fullscreen_mode
SDL_DisplayMode fullscreen_mode
Definition: SDL_sysvideo.h:87
SDL_DisplayMode::w
int w
Definition: SDL_video.h:56
SDL_DisplayMode
The structure that defines a display mode.
Definition: SDL_video.h:53
SDL_InvalidParamError
#define SDL_InvalidParamError(param)
Definition: SDL_error.h:54
SDL_Window::windowed
SDL_Rect windowed
Definition: SDL_sysvideo.h:85
SDL_GetDisplayForWindow
SDL_VideoDisplay * SDL_GetDisplayForWindow(SDL_Window *window)
Definition: SDL_video.c:1039
SDL_DisplayMode::h
int h
Definition: SDL_video.h:57
SDL_Rect::w
int w
Definition: SDL_rect.h:67
SDL_VideoDisplay
Definition: SDL_sysvideo.h:120
SDL_VideoDisplay::desktop_mode
SDL_DisplayMode desktop_mode
Definition: SDL_sysvideo.h:126
SDL_SetError
#define SDL_SetError
Definition: SDL_dynapi_overrides.h:36
SDL_Rect::h
int h
Definition: SDL_rect.h:67
SDL_GetClosestDisplayModeForDisplay
static SDL_DisplayMode * SDL_GetClosestDisplayModeForDisplay(SDL_VideoDisplay *display, const SDL_DisplayMode *mode, SDL_DisplayMode *closest)
Definition: SDL_video.c:810
CHECK_WINDOW_MAGIC
#define CHECK_WINDOW_MAGIC(window, retval)
Definition: SDL_video.c:116
SDL_Window::flags
Uint32 flags
Definition: SDL_sysvideo.h:81
SDL_WINDOW_FULLSCREEN_DESKTOP
Definition: SDL_video.h:109

Uint32 SDL_GetWindowFlags | ( | SDL_Window * | window | ) |

Get the window flags.

Definition at line 1571 of file SDL_video.c.

References CHECK_WINDOW_MAGIC, and SDL_Window::flags.

Referenced by SDL_ShowMessageBox().

{
CHECK_WINDOW_MAGIC(window, 0);
return window->flags;
}
CHECK_WINDOW_MAGIC
#define CHECK_WINDOW_MAGIC(window, retval)
Definition: SDL_video.c:116
SDL_Window::flags
Uint32 flags
Definition: SDL_sysvideo.h:81

SDL_Window* SDL_GetWindowFromID | ( | Uint32 | id | ) |

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

Definition at line 1555 of file SDL_video.c.

References SDL_Window::id, SDL_Window::next, NULL, window, and SDL_VideoDevice::windows.

{
SDL_Window *window;
if (!_this) {
return NULL;
}
for (window = _this->windows; window; window = window->next) {
if (window->id == id) {
return window;
}
}
return NULL;
}
SDL_Window::next
SDL_Window * next
Definition: SDL_sysvideo.h:109
window
SDL_Window * window
Definition: testautomation_render.c:26
_this
static SDL_VideoDevice * _this
Definition: SDL_video.c:114
SDL_VideoDevice::windows
SDL_Window * windows
Definition: SDL_sysvideo.h:281
NULL
#define NULL
Definition: begin_code.h:143
SDL_Window
The type used to identify a window.
Definition: SDL_sysvideo.h:71
SDL_Window::id
Uint32 id
Definition: SDL_sysvideo.h:74

int SDL_GetWindowGammaRamp | ( | SDL_Window * | window,
|  | Uint16 * | red,
|  | Uint16 * | green,
|  | Uint16 * | blue
| ) |  |

Get the gamma ramp for a window.

Parameters

  window | The window from which the gamma ramp should be queried.
  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_SetWindowGammaRamp()

Definition at line 2182 of file SDL_video.c.

References CHECK_WINDOW_MAGIC, SDL_Window::gamma, SDL_VideoDevice::GetWindowGammaRamp, i, SDL_Window::saved_gamma, SDL_malloc, SDL_memcpy, and SDL_OutOfMemory.

Referenced by SDL_SetWindowGammaRamp().

{
CHECK_WINDOW_MAGIC(window, -1);
if (!window->gamma) {
int i;
window->gamma = (Uint16 *)SDL_malloc(256*6*sizeof(Uint16));
if (!window->gamma) {
return SDL_OutOfMemory();
}
window->saved_gamma = window->gamma + 3*256;
if (_this->GetWindowGammaRamp) {
if (_this->GetWindowGammaRamp(_this, window, window->gamma) < 0) {
return -1;
}
} else {
/* Create an identity gamma ramp */
for (i = 0; i < 256; ++i) {
Uint16 value = (Uint16)((i << 8) | i);
window->gamma[0*256+i] = value;
window->gamma[1*256+i] = value;
window->gamma[2*256+i] = value;
}
}
SDL_memcpy(window->saved_gamma, window->gamma, 3*256*sizeof(Uint16));
}
if (red) {
SDL_memcpy(red, &window->gamma[0*256], 256*sizeof(Uint16));
}
if (green) {
SDL_memcpy(green, &window->gamma[1*256], 256*sizeof(Uint16));
}
if (blue) {
SDL_memcpy(blue, &window->gamma[2*256], 256*sizeof(Uint16));
}
return 0;
}
SDL_Window::saved_gamma
Uint16 * saved_gamma
Definition: SDL_sysvideo.h:91
red
const GLubyte GLuint red
Definition: SDL_glfuncs.h:78
_this
static SDL_VideoDevice * _this
Definition: SDL_video.c:114
SDL_memcpy
#define SDL_memcpy
Definition: SDL_dynapi_overrides.h:393
value
GLsizei const GLfloat * value
Definition: SDL_opengl_glext.h:698
blue
GLbyte GLbyte blue
Definition: SDL_opengl_glext.h:379
i
return Display return Display Bool Bool int int int return Display XEvent Bool(*) XPointer return Display return Display Drawable _Xconst char unsigned int unsigned int return Display Pixmap Pixmap XColor XColor unsigned int unsigned int return Display _Xconst char char int char return Display Visual unsigned int int int char unsigned int unsigned int in i)
Definition: SDL_x11sym.h:42
SDL_OutOfMemory
#define SDL_OutOfMemory()
Definition: SDL_error.h:52
SDL_VideoDevice::GetWindowGammaRamp
int(* GetWindowGammaRamp)(_THIS, SDL_Window *window, Uint16 *ramp)
Definition: SDL_sysvideo.h:212
green
GLbyte green
Definition: SDL_opengl_glext.h:379
Uint16
uint16_t Uint16
An unsigned 16-bit integer type.
Definition: SDL_stdinc.h:147
SDL_malloc
#define SDL_malloc
Definition: SDL_dynapi_overrides.h:380
SDL_Window::gamma
Uint16 * gamma
Definition: SDL_sysvideo.h:90
CHECK_WINDOW_MAGIC
#define CHECK_WINDOW_MAGIC(window, retval)
Definition: SDL_video.c:116

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

Definition at line 2274 of file SDL_video.c.

References CHECK_WINDOW_MAGIC, SDL_Window::flags, SDL_VideoDevice::grabbed_window, SDL_assert, SDL_FALSE, and SDL_WINDOW_INPUT_GRABBED.

{
CHECK_WINDOW_MAGIC(window, SDL_FALSE);
SDL_assert(!_this->grabbed_window || ((_this->grabbed_window->flags & SDL_WINDOW_INPUT_GRABBED) != 0));
return window == _this->grabbed_window;
}
_this
static SDL_VideoDevice * _this
Definition: SDL_video.c:114
SDL_assert
#define SDL_assert(condition)
Definition: SDL_assert.h:167
SDL_FALSE
Definition: SDL_stdinc.h:128
SDL_VideoDevice::grabbed_window
SDL_Window * grabbed_window
Definition: SDL_sysvideo.h:282
CHECK_WINDOW_MAGIC
#define CHECK_WINDOW_MAGIC(window, retval)
Definition: SDL_video.c:116
SDL_Window::flags
Uint32 flags
Definition: SDL_sysvideo.h:81
SDL_WINDOW_INPUT_GRABBED
Definition: SDL_video.h:106

Uint32 SDL_GetWindowID | ( | SDL_Window * | window | ) |

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

Definition at line 1547 of file SDL_video.c.

References CHECK_WINDOW_MAGIC, and SDL_Window::id.

{
CHECK_WINDOW_MAGIC(window, 0);
return window->id;
}
SDL_Window::id
Uint32 id
Definition: SDL_sysvideo.h:74
CHECK_WINDOW_MAGIC
#define CHECK_WINDOW_MAGIC(window, retval)
Definition: SDL_video.c:116

void SDL_GetWindowMaximumSize | ( | SDL_Window * | window,
|  | int * | w,
|  | int * | h
| ) |  |

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

Parameters

  window | The window to query.
  w | Pointer to variable for storing the maximum width, may be NULL
  h | Pointer to variable for storing the maximum height, may be NULL

See also
  SDL_GetWindowMinimumSize()
  SDL_SetWindowMaximumSize()

Definition at line 1923 of file SDL_video.c.

References CHECK_WINDOW_MAGIC, SDL_Window::max_h, and SDL_Window::max_w.

{
CHECK_WINDOW_MAGIC(window,);
if (max_w) {
*max_w = window->max_w;
}
if (max_h) {
*max_h = window->max_h;
}
}
SDL_Window::max_w
int max_w
Definition: SDL_sysvideo.h:80
SDL_Window::max_h
int max_h
Definition: SDL_sysvideo.h:80
CHECK_WINDOW_MAGIC
#define CHECK_WINDOW_MAGIC(window, retval)
Definition: SDL_video.c:116

void SDL_GetWindowMinimumSize | ( | SDL_Window * | window,
|  | int * | w,
|  | int * | h
| ) |  |

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

Parameters

  window | The window to query.
  w | Pointer to variable for storing the minimum width, may be NULL
  h | Pointer to variable for storing the minimum height, may be NULL

See also
  SDL_GetWindowMaximumSize()
  SDL_SetWindowMinimumSize()

Definition at line 1887 of file SDL_video.c.

References CHECK_WINDOW_MAGIC, SDL_Window::min_h, and SDL_Window::min_w.

{
CHECK_WINDOW_MAGIC(window,);
if (min_w) {
*min_w = window->min_w;
}
if (min_h) {
*min_h = window->min_h;
}
}
SDL_Window::min_w
int min_w
Definition: SDL_sysvideo.h:79
SDL_Window::min_h
int min_h
Definition: SDL_sysvideo.h:79
CHECK_WINDOW_MAGIC
#define CHECK_WINDOW_MAGIC(window, retval)
Definition: SDL_video.c:116

Uint32 SDL_GetWindowPixelFormat | ( | SDL_Window * | window | ) |

Get the pixel format associated with the window.

Definition at line 1107 of file SDL_video.c.

References CHECK_WINDOW_MAGIC, SDL_VideoDisplay::current_mode, SDL_DisplayMode::format, SDL_GetDisplayForWindow(), and SDL_PIXELFORMAT_UNKNOWN.

{
SDL_VideoDisplay *display;
CHECK_WINDOW_MAGIC(window, SDL_PIXELFORMAT_UNKNOWN);
display = SDL_GetDisplayForWindow(window);
return display->current_mode.format;
}
SDL_GetDisplayForWindow
SDL_VideoDisplay * SDL_GetDisplayForWindow(SDL_Window *window)
Definition: SDL_video.c:1039
SDL_PIXELFORMAT_UNKNOWN
Definition: SDL_pixels.h:172
SDL_VideoDisplay::current_mode
SDL_DisplayMode current_mode
Definition: SDL_sysvideo.h:127
SDL_VideoDisplay
Definition: SDL_sysvideo.h:120
CHECK_WINDOW_MAGIC
#define CHECK_WINDOW_MAGIC(window, retval)
Definition: SDL_video.c:116
SDL_DisplayMode::format
Uint32 format
Definition: SDL_video.h:55

void SDL_GetWindowPosition | ( | SDL_Window * | window,
|  | int * | x,
|  | int * | y
| ) |  |

Get the position of a window.

Parameters

  window | The window to query.
  x | Pointer to variable for storing the x position, in screen coordinates. May be NULL.
  y | Pointer to variable for storing the y position, in screen coordinates. May be NULL.

See also
  SDL_SetWindowPosition()

Definition at line 1739 of file SDL_video.c.

References CHECK_WINDOW_MAGIC, SDL_Window::flags, SDL_GetDisplayBounds(), SDL_GetWindowDisplayIndex(), SDL_WINDOW_FULLSCREEN, SDL_zero, SDL_Rect::x, SDL_Window::x, SDL_Rect::y, and SDL_Window::y.

{
CHECK_WINDOW_MAGIC(window,);
/* Fullscreen windows are always at their display's origin */
if (window->flags & SDL_WINDOW_FULLSCREEN) {
int displayIndex;
if (x) {
*x = 0;
}
if (y) {
*y = 0;
}
/* Find the window's monitor and update to the
monitor offset. */
displayIndex = SDL_GetWindowDisplayIndex(window);
if (displayIndex >= 0) {
SDL_Rect bounds;
SDL_zero(bounds);
SDL_GetDisplayBounds(displayIndex, &bounds);
if (x) {
*x = bounds.x;
}
if (y) {
*y = bounds.y;
}
}
} else {
if (x) {
*x = window->x;
}
if (y) {
*y = window->y;
}
}
}
x
GLint GLint GLint GLint GLint x
Definition: SDL_opengl.h:1567
SDL_Window::x
int x
Definition: SDL_sysvideo.h:77
y
GLint GLint GLint GLint GLint GLint y
Definition: SDL_opengl.h:1567
SDL_zero
#define SDL_zero(x)
Definition: SDL_stdinc.h:357
SDL_Window::y
int y
Definition: SDL_sysvideo.h:77
SDL_Rect::x
int x
Definition: SDL_rect.h:66
SDL_GetDisplayBounds
int SDL_GetDisplayBounds(int displayIndex, SDL_Rect *rect)
Get the desktop area represented by a display, with the primary display located at 0...
Definition: SDL_video.c:663
SDL_WINDOW_FULLSCREEN
Definition: SDL_video.h:98
CHECK_WINDOW_MAGIC
#define CHECK_WINDOW_MAGIC(window, retval)
Definition: SDL_video.c:116
SDL_GetWindowDisplayIndex
int SDL_GetWindowDisplayIndex(SDL_Window *window)
Get the display index associated with a window.
Definition: SDL_video.c:979
SDL_Window::flags
Uint32 flags
Definition: SDL_sysvideo.h:81
SDL_Rect::y
int y
Definition: SDL_rect.h:66
SDL_Rect
A rectangle, with the origin at the upper left.
Definition: SDL_rect.h:64

void SDL_GetWindowSize | ( | SDL_Window * | window,
|  | int * | w,
|  | int * | h
| ) |  |

Get the size of a window's client area.

Parameters

  window | The window to query.
  w | Pointer to variable for storing the width, in screen coordinates. May be NULL.
  h | Pointer 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()

Definition at line 1851 of file SDL_video.c.

References CHECK_WINDOW_MAGIC, SDL_Window::h, and SDL_Window::w.

Referenced by SDL_GL_GetDrawableSize().

{
CHECK_WINDOW_MAGIC(window,);
if (w) {
*w = window->w;
}
if (h) {
*h = window->h;
}
}
SDL_Window::w
int w
Definition: SDL_sysvideo.h:78
SDL_Window::h
int h
Definition: SDL_sysvideo.h:78
w
GLubyte GLubyte GLubyte GLubyte w
Definition: SDL_opengl_glext.h:731
CHECK_WINDOW_MAGIC
#define CHECK_WINDOW_MAGIC(window, retval)
Definition: SDL_video.c:116
h
GLfloat GLfloat GLfloat GLfloat h
Definition: SDL_opengl_glext.h:1946

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

Definition at line 2078 of file SDL_video.c.

References CHECK_WINDOW_MAGIC, SDL_Surface::flags, NULL, SDL_CreateWindowFramebuffer(), SDL_DONTFREE, SDL_FreeSurface, SDL_TRUE, SDL_Window::surface, and SDL_Window::surface_valid.

{
CHECK_WINDOW_MAGIC(window, NULL);
if (!window->surface_valid) {
if (window->surface) {
window->surface->flags &= ~SDL_DONTFREE;
SDL_FreeSurface(window->surface);
}
window->surface = SDL_CreateWindowFramebuffer(window);
if (window->surface) {
window->surface_valid = SDL_TRUE;
window->surface->flags |= SDL_DONTFREE;
}
}
return window->surface;
}
SDL_DONTFREE
#define SDL_DONTFREE
Definition: SDL_surface.h:55
SDL_Surface::flags
Uint32 flags
Definition: SDL_surface.h:71
SDL_FreeSurface
#define SDL_FreeSurface
Definition: SDL_dynapi_overrides.h:450
SDL_TRUE
Definition: SDL_stdinc.h:129
NULL
#define NULL
Definition: begin_code.h:143
CHECK_WINDOW_MAGIC
#define CHECK_WINDOW_MAGIC(window, retval)
Definition: SDL_video.c:116
SDL_Window::surface_valid
SDL_bool surface_valid
Definition: SDL_sysvideo.h:94
SDL_Window::surface
SDL_Surface * surface
Definition: SDL_sysvideo.h:93
SDL_CreateWindowFramebuffer
static SDL_Surface * SDL_CreateWindowFramebuffer(SDL_Window *window)
Definition: SDL_video.c:2054

const char* SDL_GetWindowTitle | ( | SDL_Window * | window | ) |

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

See also
  SDL_SetWindowTitle()

Definition at line 1596 of file SDL_video.c.

References CHECK_WINDOW_MAGIC, and SDL_Window::title.

{
CHECK_WINDOW_MAGIC(window, "");
return window->title ? window->title : "";
}
SDL_Window::title
char * title
Definition: SDL_sysvideo.h:75
CHECK_WINDOW_MAGIC
#define CHECK_WINDOW_MAGIC(window, retval)
Definition: SDL_video.c:116

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

Definition at line 3135 of file SDL_video.c.

References CHECK_WINDOW_MAGIC, SDL_VideoDevice::current_glctx, SDL_VideoDevice::current_glctx_tls, SDL_VideoDevice::current_glwin, SDL_VideoDevice::current_glwin_tls, SDL_Window::flags, SDL_VideoDevice::GL_CreateContext, NULL, SDL_SetError, SDL_TLSSet, SDL_WINDOW_OPENGL, and window.

Referenced by ShouldUseTextureFramebuffer().

{
SDL_GLContext ctx = NULL;
CHECK_WINDOW_MAGIC(window, NULL);
if (!(window->flags & SDL_WINDOW_OPENGL)) {
SDL_SetError("The specified window isn't an OpenGL window");
return NULL;
}
ctx = _this->GL_CreateContext(_this, window);
/* Creating a context is assumed to make it current in the SDL driver. */
if (ctx) {
_this->current_glwin = window;
_this->current_glctx = ctx;
SDL_TLSSet(_this->current_glwin_tls, window, NULL);
SDL_TLSSet(_this->current_glctx_tls, ctx, NULL);
}
return ctx;
}
SDL_TLSSet
#define SDL_TLSSet
Definition: SDL_dynapi_overrides.h:486
window
SDL_Window * window
Definition: testautomation_render.c:26
SDL_VideoDevice::current_glwin_tls
SDL_TLSID current_glwin_tls
Definition: SDL_sysvideo.h:327
_this
static SDL_VideoDevice * _this
Definition: SDL_video.c:114
SDL_GLContext
void * SDL_GLContext
An opaque handle to an OpenGL context.
Definition: SDL_video.h:164
SDL_VideoDevice::current_glctx
SDL_GLContext current_glctx
Definition: SDL_sysvideo.h:326
SDL_VideoDevice::GL_CreateContext
SDL_GLContext(* GL_CreateContext)(_THIS, SDL_Window *window)
Definition: SDL_sysvideo.h:237
NULL
#define NULL
Definition: begin_code.h:143
SDL_SetError
#define SDL_SetError
Definition: SDL_dynapi_overrides.h:36
SDL_VideoDevice::current_glctx_tls
SDL_TLSID current_glctx_tls
Definition: SDL_sysvideo.h:328
SDL_WINDOW_OPENGL
Definition: SDL_video.h:99
CHECK_WINDOW_MAGIC
#define CHECK_WINDOW_MAGIC(window, retval)
Definition: SDL_video.c:116
SDL_Window::flags
Uint32 flags
Definition: SDL_sysvideo.h:81
SDL_VideoDevice::current_glwin
SDL_Window * current_glwin
Definition: SDL_sysvideo.h:325

void SDL_GL_DeleteContext | ( | SDL_GLContext | context | ) |

Delete an OpenGL context.

See also
  SDL_GL_CreateContext()

Definition at line 3266 of file SDL_video.c.

References SDL_PixelFormat::Amask, SDL_PixelFormat::BytesPerPixel, SDL_Surface::flags, SDL_Surface::format, SDL_VideoDevice::GL_DeleteContext, SDL_Surface::h, NULL, SDL_Surface::pitch, SDL_Surface::pixels, SDL_free(), SDL_GL_GetCurrentContext(), SDL_GL_MakeCurrent(), SDL_malloc, SDL_memset, and SDL_Surface::w.

Referenced by ShouldUseTextureFramebuffer().

{
if (!_this || !context) {
return;
}
if (SDL_GL_GetCurrentContext() == context) {
SDL_GL_MakeCurrent(NULL, NULL);
}
_this->GL_DeleteContext(_this, context);
}
_this
static SDL_VideoDevice * _this
Definition: SDL_video.c:114
SDL_GL_MakeCurrent
int SDL_GL_MakeCurrent(SDL_Window *window, SDL_GLContext ctx)
Set up an OpenGL context for rendering into an OpenGL window.
Definition: SDL_video.c:3158
NULL
#define NULL
Definition: begin_code.h:143
SDL_GL_GetCurrentContext
SDL_GLContext SDL_GL_GetCurrentContext(void)
Get the currently active OpenGL context.
Definition: SDL_video.c:3199
SDL_VideoDevice::GL_DeleteContext
void(* GL_DeleteContext)(_THIS, SDL_GLContext context)
Definition: SDL_sysvideo.h:243

SDL_bool SDL_GL_ExtensionSupported | ( | const char * | extension | ) |

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

Definition at line 2656 of file SDL_video.c.

References APIENTRY, GL_EXTENSIONS, GL_NUM_EXTENSIONS, GL_VERSION, i, isAtLeastGL3(), SDL_FALSE, SDL_getenv, SDL_GL_GetProcAddress(), SDL_strchr, SDL_strcmp, SDL_strlen, SDL_strstr, SDL_TRUE, and void.

{
#if SDL_VIDEO_OPENGL || SDL_VIDEO_OPENGL_ES || SDL_VIDEO_OPENGL_ES2
const GLubyte *(APIENTRY * glGetStringFunc) (GLenum);
const char *extensions;
const char *start;
const char *where, *terminator;
/* Extension names should not have spaces. */
where = SDL_strchr(extension, ' ');
if (where || *extension == '\0') {
return SDL_FALSE;
}
/* See if there's an environment variable override */
start = SDL_getenv(extension);
if (start && *start == '0') {
return SDL_FALSE;
}
/* Lookup the available extensions */
glGetStringFunc = SDL_GL_GetProcAddress("glGetString");
if (!glGetStringFunc) {
return SDL_FALSE;
}
if (isAtLeastGL3((const char *) glGetStringFunc(GL_VERSION))) {
const GLubyte *(APIENTRY * glGetStringiFunc) (GLenum, GLuint);
void (APIENTRY * glGetIntegervFunc) (GLenum pname, GLint * params);
GLint num_exts = 0;
GLint i;
glGetStringiFunc = SDL_GL_GetProcAddress("glGetStringi");
glGetIntegervFunc = SDL_GL_GetProcAddress("glGetIntegerv");
if ((!glGetStringiFunc) || (!glGetIntegervFunc)) {
return SDL_FALSE;
}
#ifndef GL_NUM_EXTENSIONS
#define GL_NUM_EXTENSIONS 0x821D
#endif
glGetIntegervFunc(GL_NUM_EXTENSIONS, &num_exts);
for (i = 0; i < num_exts; i++) {
const char *thisext = (const char *) glGetStringiFunc(GL_EXTENSIONS, i);
if (SDL_strcmp(thisext, extension) == 0) {
return SDL_TRUE;
}
}
return SDL_FALSE;
}
/* Try the old way with glGetString(GL_EXTENSIONS) ... */
extensions = (const char *) glGetStringFunc(GL_EXTENSIONS);
if (!extensions) {
return SDL_FALSE;
}
/*
* It takes a bit of care to be fool-proof about parsing the OpenGL
* extensions string. Don't be fooled by sub-strings, etc.
*/
start = extensions;
for (;;) {
where = SDL_strstr(start, extension);
if (!where)
break;
terminator = where + SDL_strlen(extension);
if (where == start || *(where - 1) == ' ')
if (*terminator == ' ' || *terminator == '\0')
return SDL_TRUE;
start = terminator;
}
return SDL_FALSE;
#else
return SDL_FALSE;
#endif
}
APIENTRY
#define APIENTRY
Definition: SDL_opengl.h:132
GLint
int GLint
Definition: SDL_opengl.h:175
GL_EXTENSIONS
#define GL_EXTENSIONS
Definition: SDL_opengl.h:709
start
GLuint start
Definition: SDL_opengl.h:1564
GL_VERSION
#define GL_VERSION
Definition: SDL_opengl.h:708
SDL_strchr
#define SDL_strchr
Definition: SDL_dynapi_overrides.h:407
GL_NUM_EXTENSIONS
#define GL_NUM_EXTENSIONS
isAtLeastGL3
static SDL_INLINE SDL_bool isAtLeastGL3(const char *verstr)
Definition: SDL_video.c:2650
params
const GLfloat * params
Definition: SDL_opengl_glext.h:371
SDL_TRUE
Definition: SDL_stdinc.h:129
GLubyte
unsigned char GLubyte
Definition: SDL_opengl.h:176
SDL_getenv
#define SDL_getenv
Definition: SDL_dynapi_overrides.h:384
i
return Display return Display Bool Bool int int int return Display XEvent Bool(*) XPointer return Display return Display Drawable _Xconst char unsigned int unsigned int return Display Pixmap Pixmap XColor XColor unsigned int unsigned int return Display _Xconst char char int char return Display Visual unsigned int int int char unsigned int unsigned int in i)
Definition: SDL_x11sym.h:42
GLenum
unsigned int GLenum
Definition: SDL_opengl.h:169
pname
GLenum pname
Definition: SDL_opengl_glext.h:530
GLuint
unsigned int GLuint
Definition: SDL_opengl.h:178
void
SDL_PRINTF_FORMAT_STRING const char int SDL_PRINTF_FORMAT_STRING const char int SDL_PRINTF_FORMAT_STRING const char int SDL_PRINTF_FORMAT_STRING const char const char SDL_SCANF_FORMAT_STRING const char return SDL_ThreadFunction const char void return Uint32 return Uint32 void
Definition: SDL_dynapi_procs.h:93
SDL_strlen
#define SDL_strlen
Definition: SDL_dynapi_overrides.h:399
SDL_FALSE
Definition: SDL_stdinc.h:128
SDL_GL_GetProcAddress
void * SDL_GL_GetProcAddress(const char *proc)
Get the address of an OpenGL function.
Definition: SDL_video.c:2611
SDL_strcmp
#define SDL_strcmp
Definition: SDL_dynapi_overrides.h:423
SDL_strstr
#define SDL_strstr
Definition: SDL_dynapi_overrides.h:409

int SDL_GL_GetAttribute | ( | SDL_GLattr | attr,
|  | int * | value
| ) |  |

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

Definition at line 2899 of file SDL_video.c.

References SDL_VideoDevice::accelerated, APIENTRY, SDL_VideoDevice::double_buffer, SDL_VideoDevice::flags, SDL_VideoDevice::framebuffer_srgb_capable, GL_ACCUM_ALPHA_BITS, GL_ACCUM_BLUE_BITS, GL_ACCUM_GREEN_BITS, GL_ACCUM_RED_BITS, GL_ALPHA_BITS, GL_BACK_LEFT, GL_BLUE_BITS, SDL_VideoDevice::gl_config, GL_CONTEXT_RELEASE_BEHAVIOR, GL_CONTEXT_RELEASE_BEHAVIOR_KHR, GL_DEPTH, GL_DEPTH_BITS, GL_DOUBLEBUFFER, GL_FRAMEBUFFER, GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE, GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE, GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE, GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE, GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE, GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE, GL_GREEN_BITS, GL_INVALID_ENUM, GL_INVALID_VALUE, GL_NO_ERROR, GL_RED_BITS, GL_SAMPLE_BUFFERS, GL_SAMPLES, GL_STENCIL, GL_STENCIL_BITS, GL_STEREO, GL_VERSION, isAtLeastGL3(), SDL_VideoDevice::major_version, SDL_VideoDevice::minor_version, SDL_VideoDevice::profile_mask, SDL_VideoDevice::retained_backing, SDL_GL_ACCELERATED_VISUAL, SDL_GL_ACCUM_ALPHA_SIZE, SDL_GL_ACCUM_BLUE_SIZE, SDL_GL_ACCUM_GREEN_SIZE, SDL_GL_ACCUM_RED_SIZE, SDL_GL_ALPHA_SIZE, SDL_GL_BLUE_SIZE, SDL_GL_BUFFER_SIZE, SDL_GL_CONTEXT_EGL, SDL_GL_CONTEXT_FLAGS, SDL_GL_CONTEXT_MAJOR_VERSION, SDL_GL_CONTEXT_MINOR_VERSION, SDL_GL_CONTEXT_PROFILE_ES, SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_RELEASE_BEHAVIOR, SDL_GL_DEPTH_SIZE, SDL_GL_DOUBLEBUFFER, SDL_GL_FRAMEBUFFER_SRGB_CAPABLE, SDL_GL_GetProcAddress(), SDL_GL_GREEN_SIZE, SDL_GL_MULTISAMPLEBUFFERS, SDL_GL_MULTISAMPLESAMPLES, SDL_GL_RED_SIZE, SDL_GL_RETAINED_BACKING, SDL_GL_SHARE_WITH_CURRENT_CONTEXT, SDL_GL_STENCIL_SIZE, SDL_GL_STEREO, SDL_SetError, SDL_Unsupported, SDL_VideoDevice::share_with_current_context, and void.

{
#if SDL_VIDEO_OPENGL || SDL_VIDEO_OPENGL_ES || SDL_VIDEO_OPENGL_ES2
GLenum (APIENTRY *glGetErrorFunc) (void);
GLenum attrib = 0;
GLenum error = 0;
/*
* Some queries in Core Profile desktop OpenGL 3+ contexts require
* glGetFramebufferAttachmentParameteriv instead of glGetIntegerv. Note that
* the enums we use for the former function don't exist in OpenGL ES 2, and
* the function itself doesn't exist prior to OpenGL 3 and OpenGL ES 2.
*/
#if SDL_VIDEO_OPENGL
const GLubyte *(APIENTRY *glGetStringFunc) (GLenum name);
void (APIENTRY *glGetFramebufferAttachmentParameterivFunc) (GLenum target, GLenum attachment, GLenum pname, GLint* params);
GLenum attachment = GL_BACK_LEFT;
GLenum attachmentattrib = 0;
#endif
/* Clear value in any case */
*value = 0;
switch (attr) {
case SDL_GL_RED_SIZE:
#if SDL_VIDEO_OPENGL
attachmentattrib = GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE;
#endif
attrib = GL_RED_BITS;
break;
case SDL_GL_BLUE_SIZE:
#if SDL_VIDEO_OPENGL
attachmentattrib = GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE;
#endif
attrib = GL_BLUE_BITS;
break;
case SDL_GL_GREEN_SIZE:
#if SDL_VIDEO_OPENGL
attachmentattrib = GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE;
#endif
attrib = GL_GREEN_BITS;
break;
case SDL_GL_ALPHA_SIZE:
#if SDL_VIDEO_OPENGL
attachmentattrib = GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE;
#endif
attrib = GL_ALPHA_BITS;
break;
case SDL_GL_DOUBLEBUFFER:
#if SDL_VIDEO_OPENGL
attrib = GL_DOUBLEBUFFER;
break;
#else
/* OpenGL ES 1.0 and above specifications have EGL_SINGLE_BUFFER */
/* parameter which switches double buffer to single buffer. OpenGL ES */
/* SDL driver must set proper value after initialization */
*value = _this->gl_config.double_buffer;
return 0;
#endif
case SDL_GL_DEPTH_SIZE:
#if SDL_VIDEO_OPENGL
attachment = GL_DEPTH;
attachmentattrib = GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE;
#endif
attrib = GL_DEPTH_BITS;
break;
case SDL_GL_STENCIL_SIZE:
#if SDL_VIDEO_OPENGL
attachment = GL_STENCIL;
attachmentattrib = GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE;
#endif
attrib = GL_STENCIL_BITS;
break;
#if SDL_VIDEO_OPENGL
case SDL_GL_ACCUM_RED_SIZE:
attrib = GL_ACCUM_RED_BITS;
break;
case SDL_GL_ACCUM_GREEN_SIZE:
attrib = GL_ACCUM_GREEN_BITS;
break;
case SDL_GL_ACCUM_BLUE_SIZE:
attrib = GL_ACCUM_BLUE_BITS;
break;
case SDL_GL_ACCUM_ALPHA_SIZE:
attrib = GL_ACCUM_ALPHA_BITS;
break;
case SDL_GL_STEREO:
attrib = GL_STEREO;
break;
#else
case SDL_GL_ACCUM_RED_SIZE:
case SDL_GL_ACCUM_GREEN_SIZE:
case SDL_GL_ACCUM_BLUE_SIZE:
case SDL_GL_ACCUM_ALPHA_SIZE:
case SDL_GL_STEREO:
/* none of these are supported in OpenGL ES */
*value = 0;
return 0;
#endif
case SDL_GL_MULTISAMPLEBUFFERS:
attrib = GL_SAMPLE_BUFFERS;
break;
case SDL_GL_MULTISAMPLESAMPLES:
attrib = GL_SAMPLES;
break;
case SDL_GL_CONTEXT_RELEASE_BEHAVIOR:
#if SDL_VIDEO_OPENGL
attrib = GL_CONTEXT_RELEASE_BEHAVIOR;
#else
attrib = GL_CONTEXT_RELEASE_BEHAVIOR_KHR;
#endif
break;
case SDL_GL_BUFFER_SIZE:
{
int rsize = 0, gsize = 0, bsize = 0, asize = 0;
/* There doesn't seem to be a single flag in OpenGL for this! */
if (SDL_GL_GetAttribute(SDL_GL_RED_SIZE, &rsize) < 0) {
return -1;
}
if (SDL_GL_GetAttribute(SDL_GL_GREEN_SIZE, &gsize) < 0) {
return -1;
}
if (SDL_GL_GetAttribute(SDL_GL_BLUE_SIZE, &bsize) < 0) {
return -1;
}
if (SDL_GL_GetAttribute(SDL_GL_ALPHA_SIZE, &asize) < 0) {
return -1;
}
*value = rsize + gsize + bsize + asize;
return 0;
}
case SDL_GL_ACCELERATED_VISUAL:
{
/* FIXME: How do we get this information? */
*value = (_this->gl_config.accelerated != 0);
return 0;
}
case SDL_GL_RETAINED_BACKING:
{
*value = _this->gl_config.retained_backing;
return 0;
}
case SDL_GL_CONTEXT_MAJOR_VERSION:
{
*value = _this->gl_config.major_version;
return 0;
}
case SDL_GL_CONTEXT_MINOR_VERSION:
{
*value = _this->gl_config.minor_version;
return 0;
}
case SDL_GL_CONTEXT_EGL:
/* FIXME: SDL_GL_CONTEXT_EGL to be deprecated in SDL 2.1 */
{
if (_this->gl_config.profile_mask == SDL_GL_CONTEXT_PROFILE_ES) {
*value = 1;
}
else {
*value = 0;
}
return 0;
}
case SDL_GL_CONTEXT_FLAGS:
{
*value = _this->gl_config.flags;
return 0;
}
case SDL_GL_CONTEXT_PROFILE_MASK:
{
*value = _this->gl_config.profile_mask;
return 0;
}
case SDL_GL_SHARE_WITH_CURRENT_CONTEXT:
{
*value = _this->gl_config.share_with_current_context;
return 0;
}
case SDL_GL_FRAMEBUFFER_SRGB_CAPABLE:
{
*value = _this->gl_config.framebuffer_srgb_capable;
return 0;
}
default:
return SDL_SetError("Unknown OpenGL attribute");
}
#if SDL_VIDEO_OPENGL
glGetStringFunc = SDL_GL_GetProcAddress("glGetString");
if (!glGetStringFunc) {
return SDL_SetError("Failed getting OpenGL glGetString entry point");
}
if (attachmentattrib && isAtLeastGL3((const char *) glGetStringFunc(GL_VERSION))) {
glGetFramebufferAttachmentParameterivFunc = SDL_GL_GetProcAddress("glGetFramebufferAttachmentParameteriv");
if (glGetFramebufferAttachmentParameterivFunc) {
glGetFramebufferAttachmentParameterivFunc(GL_FRAMEBUFFER, attachment, attachmentattrib, (GLint *) value);
} else {
return SDL_SetError("Failed getting OpenGL glGetFramebufferAttachmentParameteriv entry point");
}
} else
#endif
{
void (APIENTRY *glGetIntegervFunc) (GLenum pname, GLint * params);
glGetIntegervFunc = SDL_GL_GetProcAddress("glGetIntegerv");
if (glGetIntegervFunc) {
glGetIntegervFunc(attrib, (GLint *) value);
} else {
return SDL_SetError("Failed getting OpenGL glGetIntegerv entry point");
}
}
glGetErrorFunc = SDL_GL_GetProcAddress("glGetError");
if (!glGetErrorFunc) {
return SDL_SetError("Failed getting OpenGL glGetError entry point");
}
error = glGetErrorFunc();
if (error != GL_NO_ERROR) {
if (error == GL_INVALID_ENUM) {
return SDL_SetError("OpenGL error: GL_INVALID_ENUM");
} else if (error == GL_INVALID_VALUE) {
return SDL_SetError("OpenGL error: GL_INVALID_VALUE");
}
return SDL_SetError("OpenGL error: %08X", error);
}
return 0;
#else
return SDL_Unsupported();
#endif /* SDL_VIDEO_OPENGL */
}
GL_STENCIL_BITS
#define GL_STENCIL_BITS
Definition: SDL_opengl.h:467
GL_INVALID_ENUM
#define GL_INVALID_ENUM
Definition: SDL_opengl.h:713
GL_SAMPLE_BUFFERS
#define GL_SAMPLE_BUFFERS
Definition: SDL_opengl.h:1832
GL_BACK_LEFT
#define GL_BACK_LEFT
Definition: SDL_opengl.h:492
GL_CONTEXT_RELEASE_BEHAVIOR_KHR
#define GL_CONTEXT_RELEASE_BEHAVIOR_KHR
Definition: SDL_video.c:50
GL_DOUBLEBUFFER
#define GL_DOUBLEBUFFER
Definition: SDL_opengl.h:514
SDL_GL_ACCUM_RED_SIZE
Definition: SDL_video.h:179
SDL_GL_ACCUM_BLUE_SIZE
Definition: SDL_video.h:181
SDL_VideoDevice::minor_version
int minor_version
Definition: SDL_sysvideo.h:308
APIENTRY
#define APIENTRY
Definition: SDL_opengl.h:132
GL_RED_BITS
#define GL_RED_BITS
Definition: SDL_opengl.h:506
GLint
int GLint
Definition: SDL_opengl.h:175
GL_CONTEXT_RELEASE_BEHAVIOR
#define GL_CONTEXT_RELEASE_BEHAVIOR
Definition: SDL_opengl_glext.h:2992
GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE
#define GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE
Definition: SDL_opengl_glext.h:994
SDL_GL_ACCUM_ALPHA_SIZE
Definition: SDL_video.h:182
SDL_VideoDevice::retained_backing
int retained_backing
Definition: SDL_sysvideo.h:314
SDL_VideoDevice::profile_mask
int profile_mask
Definition: SDL_sysvideo.h:310
SDL_GL_ACCELERATED_VISUAL
Definition: SDL_video.h:186
GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE
#define GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE
Definition: SDL_opengl_glext.h:996
GL_SAMPLES
#define GL_SAMPLES
Definition: SDL_opengl.h:1833
GL_DEPTH_BITS
#define GL_DEPTH_BITS
Definition: SDL_opengl.h:321
name
GLuint const GLchar * name
Definition: SDL_opengl_glext.h:660
GL_VERSION
#define GL_VERSION
Definition: SDL_opengl.h:708
SDL_GL_RED_SIZE
Definition: SDL_video.h:171
GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE
#define GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE
Definition: SDL_opengl_glext.h:999
GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE
#define GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE
Definition: SDL_opengl_glext.h:997
GL_ACCUM_ALPHA_BITS
#define GL_ACCUM_ALPHA_BITS
Definition: SDL_opengl.h:376
GL_FRAMEBUFFER
#define GL_FRAMEBUFFER
Definition: SDL_opengl_glext.h:1051
SDL_GL_STEREO
Definition: SDL_video.h:183
SDL_GL_CONTEXT_MINOR_VERSION
Definition: SDL_video.h:189
GL_NO_ERROR
#define GL_NO_ERROR
Definition: SDL_opengl.h:712
_this
static SDL_VideoDevice * _this
Definition: SDL_video.c:114
SDL_VideoDevice::gl_config
struct SDL_VideoDevice::@29 gl_config
SDL_VideoDevice::accelerated
int accelerated
Definition: SDL_sysvideo.h:306
GL_BLUE_BITS
#define GL_BLUE_BITS
Definition: SDL_opengl.h:508
SDL_GL_CONTEXT_FLAGS
Definition: SDL_video.h:191
isAtLeastGL3
static SDL_INLINE SDL_bool isAtLeastGL3(const char *verstr)
Definition: SDL_video.c:2650
SDL_VideoDevice::major_version
int major_version
Definition: SDL_sysvideo.h:307
params
const GLfloat * params
Definition: SDL_opengl_glext.h:371
GL_STENCIL
#define GL_STENCIL
Definition: SDL_opengl.h:519
SDL_GL_STENCIL_SIZE
Definition: SDL_video.h:178
SDL_GL_CONTEXT_MAJOR_VERSION
Definition: SDL_video.h:188
value
GLsizei const GLfloat * value
Definition: SDL_opengl_glext.h:698
SDL_GL_MULTISAMPLEBUFFERS
Definition: SDL_video.h:184
SDL_VideoDevice::double_buffer
int double_buffer
Definition: SDL_sysvideo.h:298
SDL_GL_RETAINED_BACKING
Definition: SDL_video.h:187
GL_ALPHA_BITS
#define GL_ALPHA_BITS
Definition: SDL_opengl.h:505
target
GLenum target
Definition: SDL_opengl_glext.h:1551
SDL_GL_ALPHA_SIZE
Definition: SDL_video.h:174
SDL_GL_CONTEXT_RELEASE_BEHAVIOR
Definition: SDL_video.h:195
GL_DEPTH
#define GL_DEPTH
Definition: SDL_opengl.h:518
GL_ACCUM_RED_BITS
#define GL_ACCUM_RED_BITS
Definition: SDL_opengl.h:373
GL_INVALID_VALUE
#define GL_INVALID_VALUE
Definition: SDL_opengl.h:714
SDL_GL_ACCUM_GREEN_SIZE
Definition: SDL_video.h:180
SDL_VideoDevice::framebuffer_srgb_capable
int framebuffer_srgb_capable
Definition: SDL_sysvideo.h:313
GLubyte
unsigned char GLubyte
Definition: SDL_opengl.h:176
SDL_GL_DEPTH_SIZE
Definition: SDL_video.h:177
GL_ACCUM_GREEN_BITS
#define GL_ACCUM_GREEN_BITS
Definition: SDL_opengl.h:374
GL_STEREO
#define GL_STEREO
Definition: SDL_opengl.h:515
SDL_GL_CONTEXT_PROFILE_MASK
Definition: SDL_video.h:192
SDL_VideoDevice::share_with_current_context
int share_with_current_context
Definition: SDL_sysvideo.h:311
SDL_GL_CONTEXT_EGL
Definition: SDL_video.h:190
SDL_GL_DOUBLEBUFFER
Definition: SDL_video.h:176
GLenum
unsigned int GLenum
Definition: SDL_opengl.h:169
pname
GLenum pname
Definition: SDL_opengl_glext.h:530
SDL_VideoDevice::flags
int flags
Definition: SDL_sysvideo.h:309
SDL_SetError
#define SDL_SetError
Definition: SDL_dynapi_overrides.h:36
void
SDL_PRINTF_FORMAT_STRING const char int SDL_PRINTF_FORMAT_STRING const char int SDL_PRINTF_FORMAT_STRING const char int SDL_PRINTF_FORMAT_STRING const char const char SDL_SCANF_FORMAT_STRING const char return SDL_ThreadFunction const char void return Uint32 return Uint32 void
Definition: SDL_dynapi_procs.h:93
GL_ACCUM_BLUE_BITS
#define GL_ACCUM_BLUE_BITS
Definition: SDL_opengl.h:375
attachment
GLenum attachment
Definition: SDL_opengl_glext.h:1178
SDL_GL_MULTISAMPLESAMPLES
Definition: SDL_video.h:185
SDL_GL_GetProcAddress
void * SDL_GL_GetProcAddress(const char *proc)
Get the address of an OpenGL function.
Definition: SDL_video.c:2611
SDL_GL_SHARE_WITH_CURRENT_CONTEXT
Definition: SDL_video.h:193
GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE
#define GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE
Definition: SDL_opengl_glext.h:998
SDL_GL_FRAMEBUFFER_SRGB_CAPABLE
Definition: SDL_video.h:194
SDL_GL_GetAttribute
int SDL_GL_GetAttribute(SDL_GLattr attr, int *value)
Get the actual value for an attribute from the current context.
Definition: SDL_video.c:2899
GL_GREEN_BITS
#define GL_GREEN_BITS
Definition: SDL_opengl.h:507
SDL_GL_CONTEXT_PROFILE_ES
Definition: SDL_video.h:202
SDL_GL_GREEN_SIZE
Definition: SDL_video.h:172
SDL_GL_BLUE_SIZE
Definition: SDL_video.h:173
SDL_GL_BUFFER_SIZE
Definition: SDL_video.h:175
SDL_Unsupported
#define SDL_Unsupported()
Definition: SDL_error.h:53
GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE
#define GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE
Definition: SDL_opengl_glext.h:995

SDL_GLContext SDL_GL_GetCurrentContext | ( | void |  | ) |

Get the currently active OpenGL context.

Definition at line 3199 of file SDL_video.c.

References SDL_VideoDevice::current_glctx_tls, NULL, SDL_TLSGet, and SDL_UninitializedVideo().

Referenced by SDL_GL_DeleteContext(), SDL_GL_GetSwapInterval(), SDL_GL_MakeCurrent(), and SDL_GL_SetSwapInterval().

{
if (!_this) {
SDL_UninitializedVideo();
return NULL;
}
return (SDL_GLContext)SDL_TLSGet(_this->current_glctx_tls);
}
_this
static SDL_VideoDevice * _this
Definition: SDL_video.c:114
SDL_GLContext
void * SDL_GLContext
An opaque handle to an OpenGL context.
Definition: SDL_video.h:164
SDL_TLSGet
#define SDL_TLSGet
Definition: SDL_dynapi_overrides.h:485
NULL
#define NULL
Definition: begin_code.h:143
SDL_VideoDevice::current_glctx_tls
SDL_TLSID current_glctx_tls
Definition: SDL_sysvideo.h:328
SDL_UninitializedVideo
static int SDL_UninitializedVideo()
Definition: SDL_video.c:419

SDL_Window* SDL_GL_GetCurrentWindow | ( | void |  | ) |

Get the currently active OpenGL window.

Definition at line 3189 of file SDL_video.c.

References SDL_VideoDevice::current_glwin_tls, NULL, SDL_TLSGet, and SDL_UninitializedVideo().

Referenced by SDL_GL_MakeCurrent(), and SDL_GL_SwapWindow().

{
if (!_this) {
SDL_UninitializedVideo();
return NULL;
}
return (SDL_Window *)SDL_TLSGet(_this->current_glwin_tls);
}
SDL_VideoDevice::current_glwin_tls
SDL_TLSID current_glwin_tls
Definition: SDL_sysvideo.h:327
_this
static SDL_VideoDevice * _this
Definition: SDL_video.c:114
SDL_TLSGet
#define SDL_TLSGet
Definition: SDL_dynapi_overrides.h:485
NULL
#define NULL
Definition: begin_code.h:143
SDL_Window
The type used to identify a window.
Definition: SDL_sysvideo.h:71
SDL_UninitializedVideo
static int SDL_UninitializedVideo()
Definition: SDL_video.c:419

void 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

  window | Window from which the drawable size should be queried
  w | Pointer to variable for storing the width in pixels, may be NULL
  h | Pointer 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()

Definition at line 3208 of file SDL_video.c.

References CHECK_WINDOW_MAGIC, SDL_VideoDevice::GL_GetDrawableSize, and SDL_GetWindowSize().

{
CHECK_WINDOW_MAGIC(window,);
if (_this->GL_GetDrawableSize) {
_this->GL_GetDrawableSize(_this, window, w, h);
} else {
SDL_GetWindowSize(window, w, h);
}
}
SDL_VideoDevice::GL_GetDrawableSize
void(* GL_GetDrawableSize)(_THIS, SDL_Window *window, int *w, int *h)
Definition: SDL_sysvideo.h:239
_this
static SDL_VideoDevice * _this
Definition: SDL_video.c:114
SDL_GetWindowSize
void SDL_GetWindowSize(SDL_Window *window, int *w, int *h)
Get the size of a window&#39;s client area.
Definition: SDL_video.c:1851
w
GLubyte GLubyte GLubyte GLubyte w
Definition: SDL_opengl_glext.h:731
CHECK_WINDOW_MAGIC
#define CHECK_WINDOW_MAGIC(window, retval)
Definition: SDL_video.c:116
h
GLfloat GLfloat GLfloat GLfloat h
Definition: SDL_opengl_glext.h:1946

void* SDL_GL_GetProcAddress | ( | const char * | proc | ) |

Get the address of an OpenGL function.

Definition at line 2611 of file SDL_video.c.

References SDL_VideoDevice::driver_loaded, SDL_VideoDevice::gl_config, SDL_VideoDevice::GL_GetProcAddress, NULL, SDL_SetError, and SDL_UninitializedVideo().

Referenced by SDL_GL_ExtensionSupported(), SDL_GL_GetAttribute(), and ShouldUseTextureFramebuffer().

{
void *func;
if (!_this) {
SDL_UninitializedVideo();
return NULL;
}
func = NULL;
if (_this->GL_GetProcAddress) {
if (_this->gl_config.driver_loaded) {
func = _this->GL_GetProcAddress(_this, proc);
} else {
SDL_SetError("No GL driver has been loaded");
}
} else {
SDL_SetError("No dynamic GL support in video driver");
}
return func;
}
_this
static SDL_VideoDevice * _this
Definition: SDL_video.c:114
SDL_VideoDevice::gl_config
struct SDL_VideoDevice::@29 gl_config
SDL_VideoDevice::driver_loaded
int driver_loaded
Definition: SDL_sysvideo.h:315
NULL
#define NULL
Definition: begin_code.h:143
SDL_SetError
#define SDL_SetError
Definition: SDL_dynapi_overrides.h:36
func
GLenum func
Definition: SDL_opengl_glext.h:657
SDL_UninitializedVideo
static int SDL_UninitializedVideo()
Definition: SDL_video.c:419
SDL_VideoDevice::GL_GetProcAddress
void *(* GL_GetProcAddress)(_THIS, const char *proc)
Definition: SDL_sysvideo.h:235

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

Definition at line 3234 of file SDL_video.c.

References SDL_VideoDevice::GL_GetSwapInterval, NULL, and SDL_GL_GetCurrentContext().

{
if (!_this) {
return 0;
} else if (SDL_GL_GetCurrentContext() == NULL) {
return 0;
} else if (_this->GL_GetSwapInterval) {
return _this->GL_GetSwapInterval(_this);
} else {
return 0;
}
}
_this
static SDL_VideoDevice * _this
Definition: SDL_video.c:114
NULL
#define NULL
Definition: begin_code.h:143
SDL_GL_GetCurrentContext
SDL_GLContext SDL_GL_GetCurrentContext(void)
Get the currently active OpenGL context.
Definition: SDL_video.c:3199
SDL_VideoDevice::GL_GetSwapInterval
int(* GL_GetSwapInterval)(_THIS)
Definition: SDL_sysvideo.h:241

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

Definition at line 2582 of file SDL_video.c.

References SDL_VideoDevice::driver_loaded, SDL_VideoDevice::driver_path, SDL_VideoDevice::gl_config, SDL_VideoDevice::GL_LoadLibrary, SDL_VideoDevice::GL_UnloadLibrary, retval, SDL_SetError, SDL_strcmp, and SDL_UninitializedVideo().

Referenced by SDL_CreateWindow(), and SDL_RecreateWindow().

{
int retval;
if (!_this) {
return SDL_UninitializedVideo();
}
if (_this->gl_config.driver_loaded) {
if (path && SDL_strcmp(path, _this->gl_config.driver_path) != 0) {
return SDL_SetError("OpenGL library already loaded");
}
retval = 0;
} else {
if (!_this->GL_LoadLibrary) {
return SDL_SetError("No dynamic GL support in video driver");
}
retval = _this->GL_LoadLibrary(_this, path);
}
if (retval == 0) {
++_this->gl_config.driver_loaded;
} else {
if (_this->GL_UnloadLibrary) {
_this->GL_UnloadLibrary(_this);
}
}
return (retval);
}
SDL_VideoDevice::GL_LoadLibrary
int(* GL_LoadLibrary)(_THIS, const char *path)
Definition: SDL_sysvideo.h:234
_this
static SDL_VideoDevice * _this
Definition: SDL_video.c:114
SDL_VideoDevice::gl_config
struct SDL_VideoDevice::@29 gl_config
retval
SDL_bool retval
Definition: testgamecontroller.c:65
SDL_VideoDevice::driver_loaded
int driver_loaded
Definition: SDL_sysvideo.h:315
SDL_VideoDevice::driver_path
char driver_path[256]
Definition: SDL_sysvideo.h:316
SDL_VideoDevice::GL_UnloadLibrary
void(* GL_UnloadLibrary)(_THIS)
Definition: SDL_sysvideo.h:236
SDL_SetError
#define SDL_SetError
Definition: SDL_dynapi_overrides.h:36
SDL_UninitializedVideo
static int SDL_UninitializedVideo()
Definition: SDL_video.c:419
path
GLsizei const GLchar *const * path
Definition: SDL_opengl_glext.h:3730
SDL_strcmp
#define SDL_strcmp
Definition: SDL_dynapi_overrides.h:423

int 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.

Definition at line 3158 of file SDL_video.c.

References CHECK_WINDOW_MAGIC, SDL_VideoDevice::current_glctx, SDL_VideoDevice::current_glctx_tls, SDL_VideoDevice::current_glwin, SDL_VideoDevice::current_glwin_tls, SDL_Window::flags, SDL_VideoDevice::GL_MakeCurrent, NULL, retval, SDL_GL_GetCurrentContext(), SDL_GL_GetCurrentWindow(), SDL_SetError, SDL_TLSSet, SDL_WINDOW_OPENGL, and window.

Referenced by SDL_DestroyWindow(), and SDL_GL_DeleteContext().

{
int retval;
if (window == SDL_GL_GetCurrentWindow() &&
ctx == SDL_GL_GetCurrentContext()) {
/* We're already current. */
return 0;
}
if (!ctx) {
window = NULL;
} else {
CHECK_WINDOW_MAGIC(window, -1);
if (!(window->flags & SDL_WINDOW_OPENGL)) {
return SDL_SetError("The specified window isn't an OpenGL window");
}
}
retval = _this->GL_MakeCurrent(_this, window, ctx);
if (retval == 0) {
_this->current_glwin = window;
_this->current_glctx = ctx;
SDL_TLSSet(_this->current_glwin_tls, window, NULL);
SDL_TLSSet(_this->current_glctx_tls, ctx, NULL);
}
return retval;
}
SDL_TLSSet
#define SDL_TLSSet
Definition: SDL_dynapi_overrides.h:486
window
SDL_Window * window
Definition: testautomation_render.c:26
SDL_VideoDevice::current_glwin_tls
SDL_TLSID current_glwin_tls
Definition: SDL_sysvideo.h:327
_this
static SDL_VideoDevice * _this
Definition: SDL_video.c:114
retval
SDL_bool retval
Definition: testgamecontroller.c:65
SDL_VideoDevice::current_glctx
SDL_GLContext current_glctx
Definition: SDL_sysvideo.h:326
SDL_VideoDevice::GL_MakeCurrent
int(* GL_MakeCurrent)(_THIS, SDL_Window *window, SDL_GLContext context)
Definition: SDL_sysvideo.h:238
NULL
#define NULL
Definition: begin_code.h:143
SDL_SetError
#define SDL_SetError
Definition: SDL_dynapi_overrides.h:36
SDL_VideoDevice::current_glctx_tls
SDL_TLSID current_glctx_tls
Definition: SDL_sysvideo.h:328
SDL_GL_GetCurrentContext
SDL_GLContext SDL_GL_GetCurrentContext(void)
Get the currently active OpenGL context.
Definition: SDL_video.c:3199
SDL_WINDOW_OPENGL
Definition: SDL_video.h:99
CHECK_WINDOW_MAGIC
#define CHECK_WINDOW_MAGIC(window, retval)
Definition: SDL_video.c:116
SDL_Window::flags
Uint32 flags
Definition: SDL_sysvideo.h:81
SDL_GL_GetCurrentWindow
SDL_Window * SDL_GL_GetCurrentWindow(void)
Get the currently active OpenGL window.
Definition: SDL_video.c:3189
SDL_VideoDevice::current_glwin
SDL_Window * current_glwin
Definition: SDL_sysvideo.h:325

void SDL_GL_ResetAttributes | ( | void |  | ) |

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

Definition at line 2740 of file SDL_video.c.

References SDL_VideoDevice::accelerated, SDL_VideoDevice::accum_alpha_size, SDL_VideoDevice::accum_blue_size, SDL_VideoDevice::accum_green_size, SDL_VideoDevice::accum_red_size, SDL_VideoDevice::alpha_size, SDL_VideoDevice::blue_size, SDL_VideoDevice::buffer_size, SDL_VideoDevice::depth_size, SDL_VideoDevice::double_buffer, SDL_VideoDevice::flags, SDL_VideoDevice::framebuffer_srgb_capable, SDL_VideoDevice::gl_config, SDL_VideoDevice::green_size, SDL_VideoDevice::major_version, SDL_VideoDevice::minor_version, SDL_VideoDevice::multisamplebuffers, SDL_VideoDevice::multisamplesamples, SDL_VideoDevice::profile_mask, SDL_VideoDevice::red_size, SDL_VideoDevice::release_behavior, SDL_VideoDevice::retained_backing, SDL_GL_CONTEXT_PROFILE_ES, SDL_GL_CONTEXT_RELEASE_BEHAVIOR_FLUSH, SDL_VideoDevice::share_with_current_context, SDL_VideoDevice::stencil_size, and SDL_VideoDevice::stereo.

Referenced by SDL_VideoInit().

{
if (!_this) {
return;
}
_this->gl_config.red_size = 3;
_this->gl_config.green_size = 3;
_this->gl_config.blue_size = 2;
_this->gl_config.alpha_size = 0;
_this->gl_config.buffer_size = 0;
_this->gl_config.depth_size = 16;
_this->gl_config.stencil_size = 0;
_this->gl_config.double_buffer = 1;
_this->gl_config.accum_red_size = 0;
_this->gl_config.accum_green_size = 0;
_this->gl_config.accum_blue_size = 0;
_this->gl_config.accum_alpha_size = 0;
_this->gl_config.stereo = 0;
_this->gl_config.multisamplebuffers = 0;
_this->gl_config.multisamplesamples = 0;
_this->gl_config.retained_backing = 1;
_this->gl_config.accelerated = -1; /* accelerated or not, both are fine */
_this->gl_config.profile_mask = 0;
#if SDL_VIDEO_OPENGL
_this->gl_config.major_version = 2;
_this->gl_config.minor_version = 1;
#elif SDL_VIDEO_OPENGL_ES2
_this->gl_config.major_version = 2;
_this->gl_config.minor_version = 0;
_this->gl_config.profile_mask = SDL_GL_CONTEXT_PROFILE_ES;
#elif SDL_VIDEO_OPENGL_ES
_this->gl_config.major_version = 1;
_this->gl_config.minor_version = 1;
_this->gl_config.profile_mask = SDL_GL_CONTEXT_PROFILE_ES;
#endif
_this->gl_config.flags = 0;
_this->gl_config.framebuffer_srgb_capable = 0;
_this->gl_config.release_behavior = SDL_GL_CONTEXT_RELEASE_BEHAVIOR_FLUSH;
_this->gl_config.share_with_current_context = 0;
}
SDL_VideoDevice::accum_alpha_size
int accum_alpha_size
Definition: SDL_sysvideo.h:302
SDL_VideoDevice::accum_blue_size
int accum_blue_size
Definition: SDL_sysvideo.h:301
SDL_VideoDevice::buffer_size
int buffer_size
Definition: SDL_sysvideo.h:296
SDL_VideoDevice::minor_version
int minor_version
Definition: SDL_sysvideo.h:308
SDL_VideoDevice::blue_size
int blue_size
Definition: SDL_sysvideo.h:293
SDL_VideoDevice::accum_red_size
int accum_red_size
Definition: SDL_sysvideo.h:299
SDL_VideoDevice::retained_backing
int retained_backing
Definition: SDL_sysvideo.h:314
SDL_VideoDevice::profile_mask
int profile_mask
Definition: SDL_sysvideo.h:310
SDL_VideoDevice::stereo
int stereo
Definition: SDL_sysvideo.h:303
_this
static SDL_VideoDevice * _this
Definition: SDL_video.c:114
SDL_VideoDevice::gl_config
struct SDL_VideoDevice::@29 gl_config
SDL_VideoDevice::accelerated
int accelerated
Definition: SDL_sysvideo.h:306
SDL_VideoDevice::multisamplebuffers
int multisamplebuffers
Definition: SDL_sysvideo.h:304
SDL_VideoDevice::multisamplesamples
int multisamplesamples
Definition: SDL_sysvideo.h:305
SDL_VideoDevice::major_version
int major_version
Definition: SDL_sysvideo.h:307
SDL_VideoDevice::depth_size
int depth_size
Definition: SDL_sysvideo.h:295
SDL_VideoDevice::red_size
int red_size
Definition: SDL_sysvideo.h:291
SDL_VideoDevice::double_buffer
int double_buffer
Definition: SDL_sysvideo.h:298
SDL_VideoDevice::green_size
int green_size
Definition: SDL_sysvideo.h:292
SDL_VideoDevice::alpha_size
int alpha_size
Definition: SDL_sysvideo.h:294
SDL_VideoDevice::framebuffer_srgb_capable
int framebuffer_srgb_capable
Definition: SDL_sysvideo.h:313
SDL_VideoDevice::release_behavior
int release_behavior
Definition: SDL_sysvideo.h:312
SDL_VideoDevice::stencil_size
int stencil_size
Definition: SDL_sysvideo.h:297
SDL_VideoDevice::share_with_current_context
int share_with_current_context
Definition: SDL_sysvideo.h:311
SDL_VideoDevice::flags
int flags
Definition: SDL_sysvideo.h:309
SDL_VideoDevice::accum_green_size
int accum_green_size
Definition: SDL_sysvideo.h:300
SDL_GL_CONTEXT_RELEASE_BEHAVIOR_FLUSH
Definition: SDL_video.h:216
SDL_GL_CONTEXT_PROFILE_ES
Definition: SDL_video.h:202

int SDL_GL_SetAttribute | ( | SDL_GLattr | attr,
|  | int | value
| ) |  |

Set an OpenGL window attribute before window creation.

Definition at line 2784 of file SDL_video.c.

References SDL_VideoDevice::accelerated, SDL_VideoDevice::accum_alpha_size, SDL_VideoDevice::accum_blue_size, SDL_VideoDevice::accum_green_size, SDL_VideoDevice::accum_red_size, SDL_VideoDevice::alpha_size, SDL_VideoDevice::blue_size, SDL_VideoDevice::buffer_size, SDL_VideoDevice::depth_size, SDL_VideoDevice::double_buffer, SDL_VideoDevice::flags, SDL_VideoDevice::framebuffer_srgb_capable, SDL_VideoDevice::gl_config, SDL_VideoDevice::green_size, SDL_VideoDevice::major_version, SDL_VideoDevice::minor_version, SDL_VideoDevice::multisamplebuffers, SDL_VideoDevice::multisamplesamples, SDL_VideoDevice::profile_mask, SDL_VideoDevice::red_size, SDL_VideoDevice::release_behavior, SDL_VideoDevice::retained_backing, retval, SDL_GL_ACCELERATED_VISUAL, SDL_GL_ACCUM_ALPHA_SIZE, SDL_GL_ACCUM_BLUE_SIZE, SDL_GL_ACCUM_GREEN_SIZE, SDL_GL_ACCUM_RED_SIZE, SDL_GL_ALPHA_SIZE, SDL_GL_BLUE_SIZE, SDL_GL_BUFFER_SIZE, SDL_GL_CONTEXT_DEBUG_FLAG, SDL_GL_CONTEXT_EGL, SDL_GL_CONTEXT_FLAGS, SDL_GL_CONTEXT_FORWARD_COMPATIBLE_FLAG, SDL_GL_CONTEXT_MAJOR_VERSION, SDL_GL_CONTEXT_MINOR_VERSION, SDL_GL_CONTEXT_PROFILE_COMPATIBILITY, SDL_GL_CONTEXT_PROFILE_CORE, SDL_GL_CONTEXT_PROFILE_ES, SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_RELEASE_BEHAVIOR, SDL_GL_CONTEXT_RESET_ISOLATION_FLAG, SDL_GL_CONTEXT_ROBUST_ACCESS_FLAG, SDL_GL_DEPTH_SIZE, SDL_GL_DOUBLEBUFFER, SDL_GL_FRAMEBUFFER_SRGB_CAPABLE, SDL_GL_GREEN_SIZE, SDL_GL_MULTISAMPLEBUFFERS, SDL_GL_MULTISAMPLESAMPLES, SDL_GL_RED_SIZE, SDL_GL_RETAINED_BACKING, SDL_GL_SHARE_WITH_CURRENT_CONTEXT, SDL_GL_STENCIL_SIZE, SDL_GL_STEREO, SDL_SetError, SDL_UninitializedVideo(), SDL_Unsupported, SDL_VideoDevice::share_with_current_context, SDL_VideoDevice::stencil_size, and SDL_VideoDevice::stereo.

{
#if SDL_VIDEO_OPENGL || SDL_VIDEO_OPENGL_ES || SDL_VIDEO_OPENGL_ES2
int retval;
if (!_this) {
return SDL_UninitializedVideo();
}
retval = 0;
switch (attr) {
case SDL_GL_RED_SIZE:
_this->gl_config.red_size = value;
break;
case SDL_GL_GREEN_SIZE:
_this->gl_config.green_size = value;
break;
case SDL_GL_BLUE_SIZE:
_this->gl_config.blue_size = value;
break;
case SDL_GL_ALPHA_SIZE:
_this->gl_config.alpha_size = value;
break;
case SDL_GL_DOUBLEBUFFER:
_this->gl_config.double_buffer = value;
break;
case SDL_GL_BUFFER_SIZE:
_this->gl_config.buffer_size = value;
break;
case SDL_GL_DEPTH_SIZE:
_this->gl_config.depth_size = value;
break;
case SDL_GL_STENCIL_SIZE:
_this->gl_config.stencil_size = value;
break;
case SDL_GL_ACCUM_RED_SIZE:
_this->gl_config.accum_red_size = value;
break;
case SDL_GL_ACCUM_GREEN_SIZE:
_this->gl_config.accum_green_size = value;
break;
case SDL_GL_ACCUM_BLUE_SIZE:
_this->gl_config.accum_blue_size = value;
break;
case SDL_GL_ACCUM_ALPHA_SIZE:
_this->gl_config.accum_alpha_size = value;
break;
case SDL_GL_STEREO:
_this->gl_config.stereo = value;
break;
case SDL_GL_MULTISAMPLEBUFFERS:
_this->gl_config.multisamplebuffers = value;
break;
case SDL_GL_MULTISAMPLESAMPLES:
_this->gl_config.multisamplesamples = value;
break;
case SDL_GL_ACCELERATED_VISUAL:
_this->gl_config.accelerated = value;
break;
case SDL_GL_RETAINED_BACKING:
_this->gl_config.retained_backing = value;
break;
case SDL_GL_CONTEXT_MAJOR_VERSION:
_this->gl_config.major_version = value;
break;
case SDL_GL_CONTEXT_MINOR_VERSION:
_this->gl_config.minor_version = value;
break;
case SDL_GL_CONTEXT_EGL:
/* FIXME: SDL_GL_CONTEXT_EGL to be deprecated in SDL 2.1 */
if (value != 0) {
SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_ES);
} else {
SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, 0);
};
break;
case SDL_GL_CONTEXT_FLAGS:
if (value & ~(SDL_GL_CONTEXT_DEBUG_FLAG |
SDL_GL_CONTEXT_FORWARD_COMPATIBLE_FLAG |
SDL_GL_CONTEXT_ROBUST_ACCESS_FLAG |
SDL_GL_CONTEXT_RESET_ISOLATION_FLAG)) {
retval = SDL_SetError("Unknown OpenGL context flag %d", value);
break;
}
_this->gl_config.flags = value;
break;
case SDL_GL_CONTEXT_PROFILE_MASK:
if (value != 0 &&
value != SDL_GL_CONTEXT_PROFILE_CORE &&
value != SDL_GL_CONTEXT_PROFILE_COMPATIBILITY &&
value != SDL_GL_CONTEXT_PROFILE_ES) {
retval = SDL_SetError("Unknown OpenGL context profile %d", value);
break;
}
_this->gl_config.profile_mask = value;
break;
case SDL_GL_SHARE_WITH_CURRENT_CONTEXT:
_this->gl_config.share_with_current_context = value;
break;
case SDL_GL_FRAMEBUFFER_SRGB_CAPABLE:
_this->gl_config.framebuffer_srgb_capable = value;
break;
case SDL_GL_CONTEXT_RELEASE_BEHAVIOR:
_this->gl_config.release_behavior = value;
break;
default:
retval = SDL_SetError("Unknown OpenGL attribute");
break;
}
return retval;
#else
return SDL_Unsupported();
#endif /* SDL_VIDEO_OPENGL */
}
SDL_VideoDevice::accum_alpha_size
int accum_alpha_size
Definition: SDL_sysvideo.h:302
SDL_VideoDevice::accum_blue_size
int accum_blue_size
Definition: SDL_sysvideo.h:301
SDL_GL_ACCUM_RED_SIZE
Definition: SDL_video.h:179
SDL_VideoDevice::buffer_size
int buffer_size
Definition: SDL_sysvideo.h:296
SDL_GL_ACCUM_BLUE_SIZE
Definition: SDL_video.h:181
SDL_VideoDevice::minor_version
int minor_version
Definition: SDL_sysvideo.h:308
SDL_VideoDevice::blue_size
int blue_size
Definition: SDL_sysvideo.h:293
SDL_VideoDevice::accum_red_size
int accum_red_size
Definition: SDL_sysvideo.h:299
SDL_GL_ACCUM_ALPHA_SIZE
Definition: SDL_video.h:182
SDL_VideoDevice::retained_backing
int retained_backing
Definition: SDL_sysvideo.h:314
SDL_VideoDevice::profile_mask
int profile_mask
Definition: SDL_sysvideo.h:310
SDL_GL_ACCELERATED_VISUAL
Definition: SDL_video.h:186
SDL_GL_CONTEXT_FORWARD_COMPATIBLE_FLAG
Definition: SDL_video.h:208
SDL_GL_RED_SIZE
Definition: SDL_video.h:171
SDL_VideoDevice::stereo
int stereo
Definition: SDL_sysvideo.h:303
SDL_GL_STEREO
Definition: SDL_video.h:183
SDL_GL_CONTEXT_MINOR_VERSION
Definition: SDL_video.h:189
_this
static SDL_VideoDevice * _this
Definition: SDL_video.c:114
SDL_VideoDevice::gl_config
struct SDL_VideoDevice::@29 gl_config
SDL_VideoDevice::accelerated
int accelerated
Definition: SDL_sysvideo.h:306
SDL_GL_CONTEXT_FLAGS
Definition: SDL_video.h:191
SDL_VideoDevice::multisamplebuffers
int multisamplebuffers
Definition: SDL_sysvideo.h:304
retval
SDL_bool retval
Definition: testgamecontroller.c:65
SDL_VideoDevice::multisamplesamples
int multisamplesamples
Definition: SDL_sysvideo.h:305
SDL_VideoDevice::major_version
int major_version
Definition: SDL_sysvideo.h:307
SDL_GL_STENCIL_SIZE
Definition: SDL_video.h:178
SDL_GL_CONTEXT_MAJOR_VERSION
Definition: SDL_video.h:188
value
GLsizei const GLfloat * value
Definition: SDL_opengl_glext.h:698
SDL_GL_MULTISAMPLEBUFFERS
Definition: SDL_video.h:184
SDL_VideoDevice::depth_size
int depth_size
Definition: SDL_sysvideo.h:295
SDL_VideoDevice::red_size
int red_size
Definition: SDL_sysvideo.h:291
SDL_VideoDevice::double_buffer
int double_buffer
Definition: SDL_sysvideo.h:298
SDL_GL_RETAINED_BACKING
Definition: SDL_video.h:187
SDL_GL_ALPHA_SIZE
Definition: SDL_video.h:174
SDL_GL_CONTEXT_RELEASE_BEHAVIOR
Definition: SDL_video.h:195
SDL_VideoDevice::green_size
int green_size
Definition: SDL_sysvideo.h:292
SDL_GL_CONTEXT_PROFILE_COMPATIBILITY
Definition: SDL_video.h:201
SDL_VideoDevice::alpha_size
int alpha_size
Definition: SDL_sysvideo.h:294
SDL_GL_ACCUM_GREEN_SIZE
Definition: SDL_video.h:180
SDL_VideoDevice::framebuffer_srgb_capable
int framebuffer_srgb_capable
Definition: SDL_sysvideo.h:313
SDL_GL_DEPTH_SIZE
Definition: SDL_video.h:177
SDL_VideoDevice::release_behavior
int release_behavior
Definition: SDL_sysvideo.h:312
SDL_VideoDevice::stencil_size
int stencil_size
Definition: SDL_sysvideo.h:297
SDL_GL_CONTEXT_PROFILE_MASK
Definition: SDL_video.h:192
SDL_VideoDevice::share_with_current_context
int share_with_current_context
Definition: SDL_sysvideo.h:311
SDL_GL_CONTEXT_EGL
Definition: SDL_video.h:190
SDL_GL_DOUBLEBUFFER
Definition: SDL_video.h:176
SDL_VideoDevice::flags
int flags
Definition: SDL_sysvideo.h:309
SDL_SetError
#define SDL_SetError
Definition: SDL_dynapi_overrides.h:36
SDL_GL_MULTISAMPLESAMPLES
Definition: SDL_video.h:185
SDL_GL_SetAttribute
int SDL_GL_SetAttribute(SDL_GLattr attr, int value)
Set an OpenGL window attribute before window creation.
Definition: SDL_video.c:2784
SDL_UninitializedVideo
static int SDL_UninitializedVideo()
Definition: SDL_video.c:419
SDL_GL_SHARE_WITH_CURRENT_CONTEXT
Definition: SDL_video.h:193
SDL_GL_FRAMEBUFFER_SRGB_CAPABLE
Definition: SDL_video.h:194
SDL_VideoDevice::accum_green_size
int accum_green_size
Definition: SDL_sysvideo.h:300
SDL_GL_CONTEXT_DEBUG_FLAG
Definition: SDL_video.h:207
SDL_GL_CONTEXT_PROFILE_ES
Definition: SDL_video.h:202
SDL_GL_GREEN_SIZE
Definition: SDL_video.h:172
SDL_GL_CONTEXT_RESET_ISOLATION_FLAG
Definition: SDL_video.h:210
SDL_GL_BLUE_SIZE
Definition: SDL_video.h:173
SDL_GL_BUFFER_SIZE
Definition: SDL_video.h:175
SDL_Unsupported
#define SDL_Unsupported()
Definition: SDL_error.h:53
SDL_GL_CONTEXT_PROFILE_CORE
Definition: SDL_video.h:200
SDL_GL_CONTEXT_ROBUST_ACCESS_FLAG
Definition: SDL_video.h:209

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

Definition at line 3220 of file SDL_video.c.

References SDL_VideoDevice::GL_SetSwapInterval, NULL, SDL_GL_GetCurrentContext(), SDL_SetError, and SDL_UninitializedVideo().

{
if (!_this) {
return SDL_UninitializedVideo();
} else if (SDL_GL_GetCurrentContext() == NULL) {
return SDL_SetError("No OpenGL context has been made current");
} else if (_this->GL_SetSwapInterval) {
return _this->GL_SetSwapInterval(_this, interval);
} else {
return SDL_SetError("Setting the swap interval is not supported");
}
}
SDL_VideoDevice::GL_SetSwapInterval
int(* GL_SetSwapInterval)(_THIS, int interval)
Definition: SDL_sysvideo.h:240
_this
static SDL_VideoDevice * _this
Definition: SDL_video.c:114
NULL
#define NULL
Definition: begin_code.h:143
SDL_SetError
#define SDL_SetError
Definition: SDL_dynapi_overrides.h:36
SDL_GL_GetCurrentContext
SDL_GLContext SDL_GL_GetCurrentContext(void)
Get the currently active OpenGL context.
Definition: SDL_video.c:3199
SDL_UninitializedVideo
static int SDL_UninitializedVideo()
Definition: SDL_video.c:419

void SDL_GL_SwapWindow | ( | SDL_Window * | window | ) |

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

Definition at line 3248 of file SDL_video.c.

References CHECK_WINDOW_MAGIC, SDL_Window::flags, SDL_VideoDevice::GL_SwapWindow, SDL_GL_GetCurrentWindow(), SDL_SetError, and SDL_WINDOW_OPENGL.

{
CHECK_WINDOW_MAGIC(window,);
if (!(window->flags & SDL_WINDOW_OPENGL)) {
SDL_SetError("The specified window isn't an OpenGL window");
return;
}
if (SDL_GL_GetCurrentWindow() != window) {
SDL_SetError("The specified window has not been made current");
return;
}
_this->GL_SwapWindow(_this, window);
}
SDL_VideoDevice::GL_SwapWindow
void(* GL_SwapWindow)(_THIS, SDL_Window *window)
Definition: SDL_sysvideo.h:242
_this
static SDL_VideoDevice * _this
Definition: SDL_video.c:114
SDL_SetError
#define SDL_SetError
Definition: SDL_dynapi_overrides.h:36
SDL_WINDOW_OPENGL
Definition: SDL_video.h:99
CHECK_WINDOW_MAGIC
#define CHECK_WINDOW_MAGIC(window, retval)
Definition: SDL_video.c:116
SDL_Window::flags
Uint32 flags
Definition: SDL_sysvideo.h:81
SDL_GL_GetCurrentWindow
SDL_Window * SDL_GL_GetCurrentWindow(void)
Get the currently active OpenGL window.
Definition: SDL_video.c:3189

void SDL_GL_UnloadLibrary | ( | void |  | ) |

Unload the OpenGL library previously loaded by SDL_GL_LoadLibrary().

See also
  SDL_GL_LoadLibrary()

Definition at line 2633 of file SDL_video.c.

References SDL_VideoDevice::driver_loaded, SDL_VideoDevice::gl_config, SDL_VideoDevice::GL_UnloadLibrary, SDL_INLINE, and SDL_UninitializedVideo().

Referenced by SDL_DestroyWindow(), and SDL_RecreateWindow().

{
if (!_this) {
SDL_UninitializedVideo();
return;
}
if (_this->gl_config.driver_loaded > 0) {
if (--_this->gl_config.driver_loaded > 0) {
return;
}
if (_this->GL_UnloadLibrary) {
_this->GL_UnloadLibrary(_this);
}
}
}
_this
static SDL_VideoDevice * _this
Definition: SDL_video.c:114
SDL_VideoDevice::gl_config
struct SDL_VideoDevice::@29 gl_config
SDL_VideoDevice::driver_loaded
int driver_loaded
Definition: SDL_sysvideo.h:315
SDL_VideoDevice::GL_UnloadLibrary
void(* GL_UnloadLibrary)(_THIS)
Definition: SDL_sysvideo.h:236
SDL_UninitializedVideo
static int SDL_UninitializedVideo()
Definition: SDL_video.c:419

void SDL_HideWindow | ( | SDL_Window * | window | ) |

Hide a window.

See also
  SDL_ShowWindow()

Definition at line 1950 of file SDL_video.c.

References CHECK_WINDOW_MAGIC, SDL_Window::flags, SDL_VideoDevice::HideWindow, SDL_Window::is_hiding, SDL_FALSE, SDL_SendWindowEvent(), SDL_TRUE, SDL_UpdateFullscreenMode(), SDL_WINDOW_SHOWN, and SDL_WINDOWEVENT_HIDDEN.

Referenced by SDL_DestroyWindow(), and SDL_RecreateWindow().

{
CHECK_WINDOW_MAGIC(window,);
if (!(window->flags & SDL_WINDOW_SHOWN)) {
return;
}
window->is_hiding = SDL_TRUE;
SDL_UpdateFullscreenMode(window, SDL_FALSE);
if (_this->HideWindow) {
_this->HideWindow(_this, window);
}
window->is_hiding = SDL_FALSE;
SDL_SendWindowEvent(window, SDL_WINDOWEVENT_HIDDEN, 0, 0);
}
SDL_SendWindowEvent
int SDL_SendWindowEvent(SDL_Window *window, Uint8 windowevent, int data1, int data2)
Definition: SDL_windowevents.c:74
SDL_WINDOWEVENT_HIDDEN
Definition: SDL_video.h:140
SDL_WINDOW_SHOWN
Definition: SDL_video.h:100
_this
static SDL_VideoDevice * _this
Definition: SDL_video.c:114
SDL_VideoDevice::HideWindow
void(* HideWindow)(_THIS, SDL_Window *window)
Definition: SDL_sysvideo.h:204
SDL_UpdateFullscreenMode
static int SDL_UpdateFullscreenMode(SDL_Window *window, SDL_bool fullscreen)
Definition: SDL_video.c:1133
SDL_TRUE
Definition: SDL_stdinc.h:129
SDL_FALSE
Definition: SDL_stdinc.h:128
CHECK_WINDOW_MAGIC
#define CHECK_WINDOW_MAGIC(window, retval)
Definition: SDL_video.c:116
SDL_Window::flags
Uint32 flags
Definition: SDL_sysvideo.h:81
SDL_Window::is_hiding
SDL_bool is_hiding
Definition: SDL_sysvideo.h:96

SDL_bool SDL_IsScreenSaverEnabled | ( | void |  | ) |

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

See also
  SDL_EnableScreenSaver()
  SDL_DisableScreenSaver()

Definition at line 2493 of file SDL_video.c.

References SDL_FALSE, SDL_TRUE, and SDL_VideoDevice::suspend_screensaver.

{
if (!_this) {
return SDL_TRUE;
}
return _this->suspend_screensaver ? SDL_FALSE : SDL_TRUE;
}
_this
static SDL_VideoDevice * _this
Definition: SDL_video.c:114
SDL_TRUE
Definition: SDL_stdinc.h:129
SDL_FALSE
Definition: SDL_stdinc.h:128
SDL_VideoDevice::suspend_screensaver
SDL_bool suspend_screensaver
Definition: SDL_sysvideo.h:278

void SDL_MaximizeWindow | ( | SDL_Window * | window | ) |

Make a window as large as possible.

See also
  SDL_RestoreWindow()

Definition at line 1982 of file SDL_video.c.

References CHECK_WINDOW_MAGIC, SDL_Window::flags, SDL_VideoDevice::MaximizeWindow, and SDL_WINDOW_MAXIMIZED.

Referenced by SDL_FinishWindowCreation().

{
CHECK_WINDOW_MAGIC(window,);
if (window->flags & SDL_WINDOW_MAXIMIZED) {
return;
}
/* !!! FIXME: should this check if the window is resizable? */
if (_this->MaximizeWindow) {
_this->MaximizeWindow(_this, window);
}
}
_this
static SDL_VideoDevice * _this
Definition: SDL_video.c:114
SDL_WINDOW_MAXIMIZED
Definition: SDL_video.h:105
CHECK_WINDOW_MAGIC
#define CHECK_WINDOW_MAGIC(window, retval)
Definition: SDL_video.c:116
SDL_VideoDevice::MaximizeWindow
void(* MaximizeWindow)(_THIS, SDL_Window *window)
Definition: SDL_sysvideo.h:206
SDL_Window::flags
Uint32 flags
Definition: SDL_sysvideo.h:81

void SDL_MinimizeWindow | ( | SDL_Window * | window | ) |

Minimize a window to an iconic representation.

See also
  SDL_RestoreWindow()

Definition at line 1998 of file SDL_video.c.

References CHECK_WINDOW_MAGIC, SDL_Window::flags, SDL_VideoDevice::MinimizeWindow, SDL_FALSE, SDL_UpdateFullscreenMode(), and SDL_WINDOW_MINIMIZED.

Referenced by SDL_FinishWindowCreation(), SDL_OnWindowFocusLost(), and SDL_UpdateFullscreenMode().

{
CHECK_WINDOW_MAGIC(window,);
if (window->flags & SDL_WINDOW_MINIMIZED) {
return;
}
SDL_UpdateFullscreenMode(window, SDL_FALSE);
if (_this->MinimizeWindow) {
_this->MinimizeWindow(_this, window);
}
}
_this
static SDL_VideoDevice * _this
Definition: SDL_video.c:114
SDL_WINDOW_MINIMIZED
Definition: SDL_video.h:104
SDL_UpdateFullscreenMode
static int SDL_UpdateFullscreenMode(SDL_Window *window, SDL_bool fullscreen)
Definition: SDL_video.c:1133
SDL_VideoDevice::MinimizeWindow
void(* MinimizeWindow)(_THIS, SDL_Window *window)
Definition: SDL_sysvideo.h:207
SDL_FALSE
Definition: SDL_stdinc.h:128
CHECK_WINDOW_MAGIC
#define CHECK_WINDOW_MAGIC(window, retval)
Definition: SDL_video.c:116
SDL_Window::flags
Uint32 flags
Definition: SDL_sysvideo.h:81

void SDL_RaiseWindow | ( | SDL_Window * | window | ) |

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

Definition at line 1969 of file SDL_video.c.

References CHECK_WINDOW_MAGIC, SDL_Window::flags, SDL_VideoDevice::RaiseWindow, and SDL_WINDOW_SHOWN.

Referenced by SDL_ShowMessageBox().

{
CHECK_WINDOW_MAGIC(window,);
if (!(window->flags & SDL_WINDOW_SHOWN)) {
return;
}
if (_this->RaiseWindow) {
_this->RaiseWindow(_this, window);
}
}
SDL_WINDOW_SHOWN
Definition: SDL_video.h:100
_this
static SDL_VideoDevice * _this
Definition: SDL_video.c:114
SDL_VideoDevice::RaiseWindow
void(* RaiseWindow)(_THIS, SDL_Window *window)
Definition: SDL_sysvideo.h:205
CHECK_WINDOW_MAGIC
#define CHECK_WINDOW_MAGIC(window, retval)
Definition: SDL_video.c:116
SDL_Window::flags
Uint32 flags
Definition: SDL_sysvideo.h:81

void SDL_RestoreWindow | ( | SDL_Window * | window | ) |

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

See also
  SDL_MaximizeWindow()
  SDL_MinimizeWindow()

Definition at line 2014 of file SDL_video.c.

References CHECK_WINDOW_MAGIC, SDL_Window::flags, SDL_VideoDevice::RestoreWindow, SDL_WINDOW_MAXIMIZED, and SDL_WINDOW_MINIMIZED.

{
CHECK_WINDOW_MAGIC(window,);
if (!(window->flags & (SDL_WINDOW_MAXIMIZED | SDL_WINDOW_MINIMIZED))) {
return;
}
if (_this->RestoreWindow) {
_this->RestoreWindow(_this, window);
}
}
SDL_VideoDevice::RestoreWindow
void(* RestoreWindow)(_THIS, SDL_Window *window)
Definition: SDL_sysvideo.h:208
_this
static SDL_VideoDevice * _this
Definition: SDL_video.c:114
SDL_WINDOW_MINIMIZED
Definition: SDL_video.h:104
SDL_WINDOW_MAXIMIZED
Definition: SDL_video.h:105
CHECK_WINDOW_MAGIC
#define CHECK_WINDOW_MAGIC(window, retval)
Definition: SDL_video.c:116
SDL_Window::flags
Uint32 flags
Definition: SDL_sysvideo.h:81

void 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

  window | The window of which to change the border state.
  bordered | SDL_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()

Definition at line 1781 of file SDL_video.c.

References CHECK_WINDOW_MAGIC, SDL_Window::flags, SDL_FALSE, SDL_WINDOW_BORDERLESS, SDL_WINDOW_FULLSCREEN, and SDL_VideoDevice::SetWindowBordered.

{
CHECK_WINDOW_MAGIC(window,);
if (!(window->flags & SDL_WINDOW_FULLSCREEN)) {
const int want = (bordered != SDL_FALSE); /* normalize the flag. */
const int have = ((window->flags & SDL_WINDOW_BORDERLESS) == 0);
if ((want != have) && (_this->SetWindowBordered)) {
if (want) {
window->flags &= ~SDL_WINDOW_BORDERLESS;
} else {
window->flags |= SDL_WINDOW_BORDERLESS;
}
_this->SetWindowBordered(_this, window, (SDL_bool) want);
}
}
}
SDL_VideoDevice::SetWindowBordered
void(* SetWindowBordered)(_THIS, SDL_Window *window, SDL_bool bordered)
Definition: SDL_sysvideo.h:209
_this
static SDL_VideoDevice * _this
Definition: SDL_video.c:114
SDL_bool
SDL_bool
Definition: SDL_stdinc.h:126
SDL_WINDOW_BORDERLESS
Definition: SDL_video.h:102
SDL_FALSE
Definition: SDL_stdinc.h:128
SDL_WINDOW_FULLSCREEN
Definition: SDL_video.h:98
CHECK_WINDOW_MAGIC
#define CHECK_WINDOW_MAGIC(window, retval)
Definition: SDL_video.c:116
SDL_Window::flags
Uint32 flags
Definition: SDL_sysvideo.h:81

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

Definition at line 2124 of file SDL_video.c.

References SDL_Window::brightness, CHECK_WINDOW_MAGIC, SDL_CalculateGammaRamp, and SDL_SetWindowGammaRamp().

{
Uint16 ramp[256];
int status;
CHECK_WINDOW_MAGIC(window, -1);
SDL_CalculateGammaRamp(brightness, ramp);
status = SDL_SetWindowGammaRamp(window, ramp, ramp, ramp);
if (status == 0) {
window->brightness = brightness;
}
return status;
}
SDL_SetWindowGammaRamp
int SDL_SetWindowGammaRamp(SDL_Window *window, const Uint16 *red, const Uint16 *green, const Uint16 *blue)
Set the gamma ramp for a window.
Definition: SDL_video.c:2148
SDL_Window::brightness
float brightness
Definition: SDL_sysvideo.h:89
Uint16
uint16_t Uint16
An unsigned 16-bit integer type.
Definition: SDL_stdinc.h:147
SDL_CalculateGammaRamp
#define SDL_CalculateGammaRamp
Definition: SDL_dynapi_overrides.h:296
CHECK_WINDOW_MAGIC
#define CHECK_WINDOW_MAGIC(window, retval)
Definition: SDL_video.c:116

void* SDL_SetWindowData | ( | SDL_Window * | window,
|  | const char * | name,
|  | void * | userdata
| ) |  |

Associate an arbitrary named pointer with a window.

Parameters

  window | The window to associate with the pointer.
  name | The name of the pointer.
  userdata | The associated pointer.

Returns
  The previous value associated with 'name'

Note
  The name is case-sensitive.

See also
  SDL_GetWindowData()

Definition at line 1626 of file SDL_video.c.

References CHECK_WINDOW_MAGIC, SDL_WindowUserData::data, SDL_Window::data, SDL_WindowUserData::name, SDL_WindowUserData::next, NULL, SDL_free(), SDL_InvalidParamError, SDL_malloc, SDL_strcmp, and SDL_strdup.

Referenced by SDL_CreateWindowTexture(), and SDL_DestroyWindowTexture().

{
SDL_WindowUserData *prev, *data;
CHECK_WINDOW_MAGIC(window, NULL);
/* Input validation */
if (name == NULL || name[0] == '\0') {
SDL_InvalidParamError("name");
return NULL;
}
/* See if the named data already exists */
prev = NULL;
for (data = window->data; data; prev = data, data = data->next) {
if (data->name && SDL_strcmp(data->name, name) == 0) {
void *last_value = data->data;
if (userdata) {
/* Set the new value */
data->data = userdata;
} else {
/* Delete this value */
if (prev) {
prev->next = data->next;
} else {
window->data = data->next;
}
SDL_free(data->name);
SDL_free(data);
}
return last_value;
}
}
/* Add new data to the window */
if (userdata) {
data = (SDL_WindowUserData *)SDL_malloc(sizeof(*data));
data->name = SDL_strdup(name);
data->data = userdata;
data->next = window->data;
window->data = data;
}
return NULL;
}
SDL_WindowUserData
Definition: SDL_sysvideo.h:63
SDL_WindowUserData::data
void * data
Definition: SDL_sysvideo.h:66
data
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: SDL_opengl.h:1967
name
GLuint const GLchar * name
Definition: SDL_opengl_glext.h:660
SDL_InvalidParamError
#define SDL_InvalidParamError(param)
Definition: SDL_error.h:54
SDL_WindowUserData::next
struct SDL_WindowUserData * next
Definition: SDL_sysvideo.h:67
SDL_WindowUserData::name
char * name
Definition: SDL_sysvideo.h:65
SDL_free
void SDL_free(void *mem)
NULL
#define NULL
Definition: begin_code.h:143
SDL_strdup
#define SDL_strdup
Definition: SDL_dynapi_overrides.h:403
SDL_malloc
#define SDL_malloc
Definition: SDL_dynapi_overrides.h:380
SDL_strcmp
#define SDL_strcmp
Definition: SDL_dynapi_overrides.h:423
CHECK_WINDOW_MAGIC
#define CHECK_WINDOW_MAGIC(window, retval)
Definition: SDL_video.c:116
SDL_Window::data
SDL_WindowUserData * data
Definition: SDL_sysvideo.h:104

int 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

  window | The window for which the display mode should be set.
  mode | The 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()

Definition at line 1050 of file SDL_video.c.

References CHECK_WINDOW_MAGIC, SDL_Window::flags, SDL_Window::fullscreen_mode, FULLSCREEN_VISIBLE, SDL_GetDisplayForWindow(), SDL_GetWindowDisplayMode(), SDL_SetDisplayModeForDisplay(), SDL_WINDOW_FULLSCREEN_DESKTOP, and SDL_zero.

{
CHECK_WINDOW_MAGIC(window, -1);
if (mode) {
window->fullscreen_mode = *mode;
} else {
SDL_zero(window->fullscreen_mode);
}
if (FULLSCREEN_VISIBLE(window) && (window->flags & SDL_WINDOW_FULLSCREEN_DESKTOP) != SDL_WINDOW_FULLSCREEN_DESKTOP) {
SDL_DisplayMode fullscreen_mode;
if (SDL_GetWindowDisplayMode(window, &fullscreen_mode) == 0) {
SDL_SetDisplayModeForDisplay(SDL_GetDisplayForWindow(window), &fullscreen_mode);
}
}
return 0;
}
SDL_Window::fullscreen_mode
SDL_DisplayMode fullscreen_mode
Definition: SDL_sysvideo.h:87
FULLSCREEN_VISIBLE
#define FULLSCREEN_VISIBLE(W)
Definition: SDL_sysvideo.h:111
SDL_DisplayMode
The structure that defines a display mode.
Definition: SDL_video.h:53
SDL_GetWindowDisplayMode
int SDL_GetWindowDisplayMode(SDL_Window *window, SDL_DisplayMode *mode)
Fill in information about the display mode used when a fullscreen window is visible.
Definition: SDL_video.c:1070
SDL_GetDisplayForWindow
SDL_VideoDisplay * SDL_GetDisplayForWindow(SDL_Window *window)
Definition: SDL_video.c:1039
mode
GLenum mode
Definition: SDL_opengl_glext.h:1122
SDL_zero
#define SDL_zero(x)
Definition: SDL_stdinc.h:357
SDL_SetDisplayModeForDisplay
static int SDL_SetDisplayModeForDisplay(SDL_VideoDisplay *display, const SDL_DisplayMode *mode)
Definition: SDL_video.c:930
CHECK_WINDOW_MAGIC
#define CHECK_WINDOW_MAGIC(window, retval)
Definition: SDL_video.c:116
SDL_Window::flags
Uint32 flags
Definition: SDL_sysvideo.h:81
SDL_WINDOW_FULLSCREEN_DESKTOP
Definition: SDL_video.h:109

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

Definition at line 2028 of file SDL_video.c.

References CHECK_WINDOW_MAGIC, SDL_Window::flags, FULLSCREEN_MASK, FULLSCREEN_VISIBLE, and SDL_UpdateFullscreenMode().

Referenced by SDL_FinishWindowCreation().

{
Uint32 oldflags;
CHECK_WINDOW_MAGIC(window, -1);
flags &= FULLSCREEN_MASK;
if (flags == (window->flags & FULLSCREEN_MASK)) {
return 0;
}
/* clear the previous flags and OR in the new ones */
oldflags = window->flags & FULLSCREEN_MASK;
window->flags &= ~FULLSCREEN_MASK;
window->flags |= flags;
if (SDL_UpdateFullscreenMode(window, FULLSCREEN_VISIBLE(window)) == 0) {
return 0;
}
window->flags &= ~FULLSCREEN_MASK;
window->flags |= oldflags;
return -1;
}
Uint32
uint32_t Uint32
An unsigned 32-bit integer type.
Definition: SDL_stdinc.h:157
FULLSCREEN_VISIBLE
#define FULLSCREEN_VISIBLE(W)
Definition: SDL_sysvideo.h:111
SDL_UpdateFullscreenMode
static int SDL_UpdateFullscreenMode(SDL_Window *window, SDL_bool fullscreen)
Definition: SDL_video.c:1133
flags
GLbitfield flags
Definition: SDL_opengl_glext.h:1480
FULLSCREEN_MASK
#define FULLSCREEN_MASK
Definition: SDL_video.c:138
CHECK_WINDOW_MAGIC
#define CHECK_WINDOW_MAGIC(window, retval)
Definition: SDL_video.c:116
SDL_Window::flags
Uint32 flags
Definition: SDL_sysvideo.h:81

int SDL_SetWindowGammaRamp | ( | SDL_Window * | window,
|  | const Uint16 * | red,
|  | const Uint16 * | green,
|  | const Uint16 * | blue
| ) |  |

Set the gamma ramp for a window.

Parameters

  window | The window for which the gamma ramp should be set.
  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_GetWindowGammaRamp()

Definition at line 2148 of file SDL_video.c.

References CHECK_WINDOW_MAGIC, SDL_Window::flags, SDL_Window::gamma, NULL, SDL_assert, SDL_GetWindowGammaRamp(), SDL_memcpy, SDL_Unsupported, SDL_WINDOW_INPUT_FOCUS, and SDL_VideoDevice::SetWindowGammaRamp.

Referenced by SDL_SetWindowBrightness().

{
CHECK_WINDOW_MAGIC(window, -1);
if (!_this->SetWindowGammaRamp) {
return SDL_Unsupported();
}
if (!window->gamma) {
if (SDL_GetWindowGammaRamp(window, NULL, NULL, NULL) < 0) {
return -1;
}
SDL_assert(window->gamma != NULL);
}
if (red) {
SDL_memcpy(&window->gamma[0*256], red, 256*sizeof(Uint16));
}
if (green) {
SDL_memcpy(&window->gamma[1*256], green, 256*sizeof(Uint16));
}
if (blue) {
SDL_memcpy(&window->gamma[2*256], blue, 256*sizeof(Uint16));
}
if (window->flags & SDL_WINDOW_INPUT_FOCUS) {
return _this->SetWindowGammaRamp(_this, window, window->gamma);
} else {
return 0;
}
}
red
const GLubyte GLuint red
Definition: SDL_glfuncs.h:78
_this
static SDL_VideoDevice * _this
Definition: SDL_video.c:114
SDL_memcpy
#define SDL_memcpy
Definition: SDL_dynapi_overrides.h:393
blue
GLbyte GLbyte blue
Definition: SDL_opengl_glext.h:379
SDL_assert
#define SDL_assert(condition)
Definition: SDL_assert.h:167
NULL
#define NULL
Definition: begin_code.h:143
SDL_WINDOW_INPUT_FOCUS
Definition: SDL_video.h:107
green
GLbyte green
Definition: SDL_opengl_glext.h:379
Uint16
uint16_t Uint16
An unsigned 16-bit integer type.
Definition: SDL_stdinc.h:147
SDL_GetWindowGammaRamp
int SDL_GetWindowGammaRamp(SDL_Window *window, Uint16 *red, Uint16 *green, Uint16 *blue)
Get the gamma ramp for a window.
Definition: SDL_video.c:2182
SDL_Window::gamma
Uint16 * gamma
Definition: SDL_sysvideo.h:90
CHECK_WINDOW_MAGIC
#define CHECK_WINDOW_MAGIC(window, retval)
Definition: SDL_video.c:116
SDL_Window::flags
Uint32 flags
Definition: SDL_sysvideo.h:81
SDL_VideoDevice::SetWindowGammaRamp
int(* SetWindowGammaRamp)(_THIS, SDL_Window *window, const Uint16 *ramp)
Definition: SDL_sysvideo.h:211
SDL_Unsupported
#define SDL_Unsupported()
Definition: SDL_error.h:53

void SDL_SetWindowGrab | ( | SDL_Window * | window,
|  | SDL_bool | grabbed
| ) |  |

Set a window's input grab mode.

Parameters

  window | The window for which the input grab mode should be set.
  grabbed | This 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()

Definition at line 2258 of file SDL_video.c.

References CHECK_WINDOW_MAGIC, SDL_Window::flags, SDL_UpdateWindowGrab(), and SDL_WINDOW_INPUT_GRABBED.

Referenced by SDL_FinishWindowCreation().

{
CHECK_WINDOW_MAGIC(window,);
if (!!grabbed == !!(window->flags & SDL_WINDOW_INPUT_GRABBED)) {
return;
}
if (grabbed) {
window->flags |= SDL_WINDOW_INPUT_GRABBED;
} else {
window->flags &= ~SDL_WINDOW_INPUT_GRABBED;
}
SDL_UpdateWindowGrab(window);
}
SDL_UpdateWindowGrab
void SDL_UpdateWindowGrab(SDL_Window *window)
Definition: SDL_video.c:2227
CHECK_WINDOW_MAGIC
#define CHECK_WINDOW_MAGIC(window, retval)
Definition: SDL_video.c:116
SDL_Window::flags
Uint32 flags
Definition: SDL_sysvideo.h:81
SDL_WINDOW_INPUT_GRABBED
Definition: SDL_video.h:106

int 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

  window | The window to set hit-testing on.
  callback | The callback to call when doing a hit-test.
  callback_data | An app-defined void pointer passed to the callback.

Returns
  0 on success, -1 on error (including unsupported).

Definition at line 3633 of file SDL_video.c.

References callback(), CHECK_WINDOW_MAGIC, SDL_Window::hit_test, SDL_Window::hit_test_data, NULL, SDL_Unsupported, and SDL_VideoDevice::SetWindowHitTest.

{
CHECK_WINDOW_MAGIC(window, -1);
if (!_this->SetWindowHitTest) {
return SDL_Unsupported();
} else if (_this->SetWindowHitTest(window, callback != NULL) == -1) {
return -1;
}
window->hit_test = callback;
window->hit_test_data = userdata;
return 0;
}
SDL_VideoDevice::SetWindowHitTest
int(* SetWindowHitTest)(SDL_Window *window, SDL_bool enabled)
Definition: SDL_sysvideo.h:274
SDL_Window::hit_test_data
void * hit_test_data
Definition: SDL_sysvideo.h:102
_this
static SDL_VideoDevice * _this
Definition: SDL_video.c:114
callback
static Uint32 callback(Uint32 interval, void *param)
Definition: testtimer.c:34
NULL
#define NULL
Definition: begin_code.h:143
SDL_Window::hit_test
SDL_HitTest hit_test
Definition: SDL_sysvideo.h:101
CHECK_WINDOW_MAGIC
#define CHECK_WINDOW_MAGIC(window, retval)
Definition: SDL_video.c:116
SDL_Unsupported
#define SDL_Unsupported()
Definition: SDL_error.h:53

void SDL_SetWindowIcon | ( | SDL_Window * | window,
|  | SDL_Surface * | icon
| ) |  |

Set the icon for a window.

Parameters

  window | The window for which the icon should be set.
  icon | The icon for the window.

Definition at line 1604 of file SDL_video.c.

References CHECK_WINDOW_MAGIC, SDL_Window::icon, SDL_ConvertSurfaceFormat, SDL_FreeSurface, SDL_PIXELFORMAT_ARGB8888, and SDL_VideoDevice::SetWindowIcon.

{
CHECK_WINDOW_MAGIC(window,);
if (!icon) {
return;
}
SDL_FreeSurface(window->icon);
/* Convert the icon into ARGB8888 */
window->icon = SDL_ConvertSurfaceFormat(icon, SDL_PIXELFORMAT_ARGB8888, 0);
if (!window->icon) {
return;
}
if (_this->SetWindowIcon) {
_this->SetWindowIcon(_this, window, window->icon);
}
}
SDL_PIXELFORMAT_ARGB8888
Definition: SDL_pixels.h:247
SDL_ConvertSurfaceFormat
#define SDL_ConvertSurfaceFormat
Definition: SDL_dynapi_overrides.h:468
_this
static SDL_VideoDevice * _this
Definition: SDL_video.c:114
SDL_FreeSurface
#define SDL_FreeSurface
Definition: SDL_dynapi_overrides.h:450
SDL_VideoDevice::SetWindowIcon
void(* SetWindowIcon)(_THIS, SDL_Window *window, SDL_Surface *icon)
Definition: SDL_sysvideo.h:198
SDL_Window::icon
SDL_Surface * icon
Definition: SDL_sysvideo.h:76
CHECK_WINDOW_MAGIC
#define CHECK_WINDOW_MAGIC(window, retval)
Definition: SDL_video.c:116

void SDL_SetWindowMaximumSize | ( | SDL_Window * | window,
|  | int | max_w,
|  | int | max_h
| ) |  |

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

Parameters

  window | The window to set a new maximum size.
  max_w | The maximum width of the window, must be >0
  max_h | The 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()

Definition at line 1899 of file SDL_video.c.

References CHECK_WINDOW_MAGIC, SDL_Window::flags, SDL_Window::h, SDL_Window::max_h, SDL_Window::max_w, SDL_InvalidParamError, SDL_min, SDL_SetWindowSize(), SDL_WINDOW_FULLSCREEN, SDL_VideoDevice::SetWindowMaximumSize, and SDL_Window::w.

{
CHECK_WINDOW_MAGIC(window,);
if (max_w <= 0) {
SDL_InvalidParamError("max_w");
return;
}
if (max_h <= 0) {
SDL_InvalidParamError("max_h");
return;
}
if (!(window->flags & SDL_WINDOW_FULLSCREEN)) {
window->max_w = max_w;
window->max_h = max_h;
if (_this->SetWindowMaximumSize) {
_this->SetWindowMaximumSize(_this, window);
}
/* Ensure that window is not larger than maximal size */
SDL_SetWindowSize(window, SDL_min(window->w, window->max_w), SDL_min(window->h, window->max_h));
}
}
SDL_min
#define SDL_min(x, y)
Definition: SDL_stdinc.h:347
SDL_SetWindowSize
void SDL_SetWindowSize(SDL_Window *window, int w, int h)
Set the size of a window&#39;s client area.
Definition: SDL_video.c:1799
SDL_Window::w
int w
Definition: SDL_sysvideo.h:78
SDL_InvalidParamError
#define SDL_InvalidParamError(param)
Definition: SDL_error.h:54
_this
static SDL_VideoDevice * _this
Definition: SDL_video.c:114
SDL_Window::h
int h
Definition: SDL_sysvideo.h:78
SDL_VideoDevice::SetWindowMaximumSize
void(* SetWindowMaximumSize)(_THIS, SDL_Window *window)
Definition: SDL_sysvideo.h:202
SDL_Window::max_w
int max_w
Definition: SDL_sysvideo.h:80
SDL_WINDOW_FULLSCREEN
Definition: SDL_video.h:98
SDL_Window::max_h
int max_h
Definition: SDL_sysvideo.h:80
CHECK_WINDOW_MAGIC
#define CHECK_WINDOW_MAGIC(window, retval)
Definition: SDL_video.c:116
SDL_Window::flags
Uint32 flags
Definition: SDL_sysvideo.h:81

void SDL_SetWindowMinimumSize | ( | SDL_Window * | window,
|  | int | min_w,
|  | int | min_h
| ) |  |

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

Parameters

  window | The window to set a new minimum size.
  min_w | The minimum width of the window, must be >0
  min_h | The 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()

Definition at line 1863 of file SDL_video.c.

References CHECK_WINDOW_MAGIC, SDL_Window::flags, SDL_Window::h, SDL_Window::min_h, SDL_Window::min_w, SDL_InvalidParamError, SDL_max, SDL_SetWindowSize(), SDL_WINDOW_FULLSCREEN, SDL_VideoDevice::SetWindowMinimumSize, and SDL_Window::w.

{
CHECK_WINDOW_MAGIC(window,);
if (min_w <= 0) {
SDL_InvalidParamError("min_w");
return;
}
if (min_h <= 0) {
SDL_InvalidParamError("min_h");
return;
}
if (!(window->flags & SDL_WINDOW_FULLSCREEN)) {
window->min_w = min_w;
window->min_h = min_h;
if (_this->SetWindowMinimumSize) {
_this->SetWindowMinimumSize(_this, window);
}
/* Ensure that window is not smaller than minimal size */
SDL_SetWindowSize(window, SDL_max(window->w, window->min_w), SDL_max(window->h, window->min_h));
}
}
SDL_SetWindowSize
void SDL_SetWindowSize(SDL_Window *window, int w, int h)
Set the size of a window&#39;s client area.
Definition: SDL_video.c:1799
SDL_Window::w
int w
Definition: SDL_sysvideo.h:78
SDL_InvalidParamError
#define SDL_InvalidParamError(param)
Definition: SDL_error.h:54
SDL_max
#define SDL_max(x, y)
Definition: SDL_stdinc.h:348
_this
static SDL_VideoDevice * _this
Definition: SDL_video.c:114
SDL_Window::min_w
int min_w
Definition: SDL_sysvideo.h:79
SDL_VideoDevice::SetWindowMinimumSize
void(* SetWindowMinimumSize)(_THIS, SDL_Window *window)
Definition: SDL_sysvideo.h:201
SDL_Window::h
int h
Definition: SDL_sysvideo.h:78
SDL_Window::min_h
int min_h
Definition: SDL_sysvideo.h:79
SDL_WINDOW_FULLSCREEN
Definition: SDL_video.h:98
CHECK_WINDOW_MAGIC
#define CHECK_WINDOW_MAGIC(window, retval)
Definition: SDL_video.c:116
SDL_Window::flags
Uint32 flags
Definition: SDL_sysvideo.h:81

void SDL_SetWindowPosition | ( | SDL_Window * | window,
|  | int | x,
|  | int | y
| ) |  |

Set the position of a window.

Parameters

  window | The window to reposition.
  x | The x coordinate of the window in screen coordinates, or SDL_WINDOWPOS_CENTERED or SDL_WINDOWPOS_UNDEFINED.
  y | The 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()

Definition at line 1694 of file SDL_video.c.

References CHECK_WINDOW_MAGIC, SDL_Window::flags, SDL_Rect::h, SDL_Window::h, SDL_VideoDevice::num_displays, SDL_GetDisplayBounds(), SDL_SendWindowEvent(), SDL_WINDOW_FULLSCREEN, SDL_WINDOWEVENT_MOVED, SDL_WINDOWPOS_ISCENTERED, SDL_WINDOWPOS_ISUNDEFINED, SDL_zero, SDL_VideoDevice::SetWindowPosition, SDL_Rect::w, SDL_Window::w, SDL_Window::windowed, SDL_Rect::x, SDL_Window::x, SDL_Rect::y, and SDL_Window::y.

{
CHECK_WINDOW_MAGIC(window,);
if (SDL_WINDOWPOS_ISCENTERED(x) || SDL_WINDOWPOS_ISCENTERED(y)) {
int displayIndex = (x & 0xFFFF);
SDL_Rect bounds;
if (displayIndex > _this->num_displays) {
displayIndex = 0;
}
SDL_zero(bounds);
SDL_GetDisplayBounds(displayIndex, &bounds);
if (SDL_WINDOWPOS_ISCENTERED(x)) {
x = bounds.x + (bounds.w - window->w) / 2;
}
if (SDL_WINDOWPOS_ISCENTERED(y)) {
y = bounds.y + (bounds.h - window->h) / 2;
}
}
if ((window->flags & SDL_WINDOW_FULLSCREEN)) {
if (!SDL_WINDOWPOS_ISUNDEFINED(x)) {
window->windowed.x = x;
}
if (!SDL_WINDOWPOS_ISUNDEFINED(y)) {
window->windowed.y = y;
}
} else {
if (!SDL_WINDOWPOS_ISUNDEFINED(x)) {
window->x = x;
}
if (!SDL_WINDOWPOS_ISUNDEFINED(y)) {
window->y = y;
}
if (_this->SetWindowPosition) {
_this->SetWindowPosition(_this, window);
}
SDL_SendWindowEvent(window, SDL_WINDOWEVENT_MOVED, x, y);
}
}
SDL_WINDOWPOS_ISUNDEFINED
#define SDL_WINDOWPOS_ISUNDEFINED(X)
Definition: SDL_video.h:121
SDL_Window::w
int w
Definition: SDL_sysvideo.h:78
x
GLint GLint GLint GLint GLint x
Definition: SDL_opengl.h:1567
SDL_Window::x
int x
Definition: SDL_sysvideo.h:77
SDL_WINDOWPOS_ISCENTERED
#define SDL_WINDOWPOS_ISCENTERED(X)
Definition: SDL_video.h:130
SDL_SendWindowEvent
int SDL_SendWindowEvent(SDL_Window *window, Uint8 windowevent, int data1, int data2)
Definition: SDL_windowevents.c:74
SDL_Window::windowed
SDL_Rect windowed
Definition: SDL_sysvideo.h:85
_this
static SDL_VideoDevice * _this
Definition: SDL_video.c:114
y
GLint GLint GLint GLint GLint GLint y
Definition: SDL_opengl.h:1567
SDL_VideoDevice::num_displays
int num_displays
Definition: SDL_sysvideo.h:279
SDL_zero
#define SDL_zero(x)
Definition: SDL_stdinc.h:357
SDL_Window::y
int y
Definition: SDL_sysvideo.h:77
SDL_Rect::x
int x
Definition: SDL_rect.h:66
SDL_GetDisplayBounds
int SDL_GetDisplayBounds(int displayIndex, SDL_Rect *rect)
Get the desktop area represented by a display, with the primary display located at 0...
Definition: SDL_video.c:663
SDL_Rect::w
int w
Definition: SDL_rect.h:67
SDL_Window::h
int h
Definition: SDL_sysvideo.h:78
SDL_VideoDevice::SetWindowPosition
void(* SetWindowPosition)(_THIS, SDL_Window *window)
Definition: SDL_sysvideo.h:199
SDL_Rect::h
int h
Definition: SDL_rect.h:67
SDL_WINDOW_FULLSCREEN
Definition: SDL_video.h:98
CHECK_WINDOW_MAGIC
#define CHECK_WINDOW_MAGIC(window, retval)
Definition: SDL_video.c:116
SDL_Window::flags
Uint32 flags
Definition: SDL_sysvideo.h:81
SDL_WINDOWEVENT_MOVED
Definition: SDL_video.h:143
SDL_Rect::y
int y
Definition: SDL_rect.h:66
SDL_Rect
A rectangle, with the origin at the upper left.
Definition: SDL_rect.h:64

void SDL_SetWindowSize | ( | SDL_Window * | window,
|  | int | w,
|  | int | h
| ) |  |

Set the size of a window's client area.

Parameters

  window | The window to resize.
  w | The width of the window, in screen coordinates. Must be >0.
  h | The height of the window, in screen coordinates. Must be >0.

Note
  You can't change the size of a fullscreen window, it automatically matches the size of the display mode.

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

Definition at line 1799 of file SDL_video.c.

References CHECK_WINDOW_MAGIC, SDL_Window::flags, FULLSCREEN_VISIBLE, SDL_Rect::h, SDL_Window::h, SDL_Window::last_fullscreen_flags, SDL_Window::max_h, SDL_Window::max_w, SDL_Window::min_h, SDL_Window::min_w, SDL_InvalidParamError, SDL_OnWindowResized(), SDL_TRUE, SDL_UpdateFullscreenMode(), SDL_WINDOW_FULLSCREEN, SDL_WINDOW_FULLSCREEN_DESKTOP, SDL_VideoDevice::SetWindowSize, SDL_Rect::w, SDL_Window::w, and SDL_Window::windowed.

Referenced by SDL_SetWindowMaximumSize(), and SDL_SetWindowMinimumSize().

{
CHECK_WINDOW_MAGIC(window,);
if (w <= 0) {
SDL_InvalidParamError("w");
return;
}
if (h <= 0) {
SDL_InvalidParamError("h");
return;
}
/* Make sure we don't exceed any window size limits */
if (window->min_w && w < window->min_w)
{
w = window->min_w;
}
if (window->max_w && w > window->max_w)
{
w = window->max_w;
}
if (window->min_h && h < window->min_h)
{
h = window->min_h;
}
if (window->max_h && h > window->max_h)
{
h = window->max_h;
}
window->windowed.w = w;
window->windowed.h = h;
if (window->flags & SDL_WINDOW_FULLSCREEN) {
if (FULLSCREEN_VISIBLE(window) && (window->flags & SDL_WINDOW_FULLSCREEN_DESKTOP) != SDL_WINDOW_FULLSCREEN_DESKTOP) {
window->last_fullscreen_flags = 0;
SDL_UpdateFullscreenMode(window, SDL_TRUE);
}
} else {
window->w = w;
window->h = h;
if (_this->SetWindowSize) {
_this->SetWindowSize(_this, window);
}
if (window->w == w && window->h == h) {
/* We didn't get a SDL_WINDOWEVENT_RESIZED event (by design) */
SDL_OnWindowResized(window);
}
}
}
SDL_Window::w
int w
Definition: SDL_sysvideo.h:78
FULLSCREEN_VISIBLE
#define FULLSCREEN_VISIBLE(W)
Definition: SDL_sysvideo.h:111
SDL_VideoDevice::SetWindowSize
void(* SetWindowSize)(_THIS, SDL_Window *window)
Definition: SDL_sysvideo.h:200
SDL_InvalidParamError
#define SDL_InvalidParamError(param)
Definition: SDL_error.h:54
SDL_Window::windowed
SDL_Rect windowed
Definition: SDL_sysvideo.h:85
_this
static SDL_VideoDevice * _this
Definition: SDL_video.c:114
SDL_Window::min_w
int min_w
Definition: SDL_sysvideo.h:79
SDL_UpdateFullscreenMode
static int SDL_UpdateFullscreenMode(SDL_Window *window, SDL_bool fullscreen)
Definition: SDL_video.c:1133
SDL_TRUE
Definition: SDL_stdinc.h:129
SDL_Rect::w
int w
Definition: SDL_rect.h:67
SDL_Window::h
int h
Definition: SDL_sysvideo.h:78
SDL_Window::last_fullscreen_flags
Uint32 last_fullscreen_flags
Definition: SDL_sysvideo.h:82
SDL_Window::min_h
int min_h
Definition: SDL_sysvideo.h:79
SDL_Window::max_w
int max_w
Definition: SDL_sysvideo.h:80
SDL_Rect::h
int h
Definition: SDL_rect.h:67
SDL_WINDOW_FULLSCREEN
Definition: SDL_video.h:98
SDL_Window::max_h
int max_h
Definition: SDL_sysvideo.h:80
w
GLubyte GLubyte GLubyte GLubyte w
Definition: SDL_opengl_glext.h:731
CHECK_WINDOW_MAGIC
#define CHECK_WINDOW_MAGIC(window, retval)
Definition: SDL_video.c:116
SDL_Window::flags
Uint32 flags
Definition: SDL_sysvideo.h:81
h
GLfloat GLfloat GLfloat GLfloat h
Definition: SDL_opengl_glext.h:1946
SDL_WINDOW_FULLSCREEN_DESKTOP
Definition: SDL_video.h:109
SDL_OnWindowResized
void SDL_OnWindowResized(SDL_Window *window)
Definition: SDL_video.c:2301

void SDL_SetWindowTitle | ( | SDL_Window * | window,
|  | const char * | title
| ) |  |

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

See also
  SDL_GetWindowTitle()

Definition at line 1579 of file SDL_video.c.

References CHECK_WINDOW_MAGIC, SDL_free(), SDL_strdup, SDL_VideoDevice::SetWindowTitle, and SDL_Window::title.

Referenced by SDL_CreateWindow().

{
CHECK_WINDOW_MAGIC(window,);
if (title == window->title) {
return;
}
SDL_free(window->title);
window->title = SDL_strdup(title ? title : "");
if (_this->SetWindowTitle) {
_this->SetWindowTitle(_this, window);
}
}
_this
static SDL_VideoDevice * _this
Definition: SDL_video.c:114
SDL_free
void SDL_free(void *mem)
SDL_Window::title
char * title
Definition: SDL_sysvideo.h:75
SDL_strdup
#define SDL_strdup
Definition: SDL_dynapi_overrides.h:403
CHECK_WINDOW_MAGIC
#define CHECK_WINDOW_MAGIC(window, retval)
Definition: SDL_video.c:116
SDL_VideoDevice::SetWindowTitle
void(* SetWindowTitle)(_THIS, SDL_Window *window)
Definition: SDL_sysvideo.h:197

void SDL_ShowWindow | ( | SDL_Window * | window | ) |

Show a window.

See also
  SDL_HideWindow()

Definition at line 1935 of file SDL_video.c.

References CHECK_WINDOW_MAGIC, SDL_Window::flags, SDL_SendWindowEvent(), SDL_WINDOW_SHOWN, SDL_WINDOWEVENT_SHOWN, and SDL_VideoDevice::ShowWindow.

Referenced by SDL_FinishWindowCreation().

{
CHECK_WINDOW_MAGIC(window,);
if (window->flags & SDL_WINDOW_SHOWN) {
return;
}
if (_this->ShowWindow) {
_this->ShowWindow(_this, window);
}
SDL_SendWindowEvent(window, SDL_WINDOWEVENT_SHOWN, 0, 0);
}
SDL_VideoDevice::ShowWindow
void(* ShowWindow)(_THIS, SDL_Window *window)
Definition: SDL_sysvideo.h:203
SDL_SendWindowEvent
int SDL_SendWindowEvent(SDL_Window *window, Uint8 windowevent, int data1, int data2)
Definition: SDL_windowevents.c:74
SDL_WINDOW_SHOWN
Definition: SDL_video.h:100
_this
static SDL_VideoDevice * _this
Definition: SDL_video.c:114
SDL_WINDOWEVENT_SHOWN
Definition: SDL_video.h:139
CHECK_WINDOW_MAGIC
#define CHECK_WINDOW_MAGIC(window, retval)
Definition: SDL_video.c:116
SDL_Window::flags
Uint32 flags
Definition: SDL_sysvideo.h:81

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

Definition at line 2097 of file SDL_video.c.

References CHECK_WINDOW_MAGIC, SDL_Rect::h, SDL_Window::h, SDL_UpdateWindowSurfaceRects(), SDL_Rect::w, SDL_Window::w, SDL_Rect::x, and SDL_Rect::y.

{
SDL_Rect full_rect;
CHECK_WINDOW_MAGIC(window, -1);
full_rect.x = 0;
full_rect.y = 0;
full_rect.w = window->w;
full_rect.h = window->h;
return SDL_UpdateWindowSurfaceRects(window, &full_rect, 1);
}
SDL_Window::w
int w
Definition: SDL_sysvideo.h:78
SDL_UpdateWindowSurfaceRects
int SDL_UpdateWindowSurfaceRects(SDL_Window *window, const SDL_Rect *rects, int numrects)
Copy a number of rectangles on the window surface to the screen.
Definition: SDL_video.c:2111
SDL_Rect::x
int x
Definition: SDL_rect.h:66
SDL_Rect::w
int w
Definition: SDL_rect.h:67
SDL_Window::h
int h
Definition: SDL_sysvideo.h:78
SDL_Rect::h
int h
Definition: SDL_rect.h:67
CHECK_WINDOW_MAGIC
#define CHECK_WINDOW_MAGIC(window, retval)
Definition: SDL_video.c:116
SDL_Rect::y
int y
Definition: SDL_rect.h:66
SDL_Rect
A rectangle, with the origin at the upper left.
Definition: SDL_rect.h:64

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

Definition at line 2111 of file SDL_video.c.

References CHECK_WINDOW_MAGIC, SDL_SetError, SDL_Window::surface_valid, and SDL_VideoDevice::UpdateWindowFramebuffer.

Referenced by SDL_UpdateWindowSurface().

{
CHECK_WINDOW_MAGIC(window, -1);
if (!window->surface_valid) {
return SDL_SetError("Window surface is invalid, please call SDL_GetWindowSurface() to get a new surface");
}
return _this->UpdateWindowFramebuffer(_this, window, rects, numrects);
}
_this
static SDL_VideoDevice * _this
Definition: SDL_video.c:114
SDL_SetError
#define SDL_SetError
Definition: SDL_dynapi_overrides.h:36
SDL_VideoDevice::UpdateWindowFramebuffer
int(* UpdateWindowFramebuffer)(_THIS, SDL_Window *window, const SDL_Rect *rects, int numrects)
Definition: SDL_sysvideo.h:216
CHECK_WINDOW_MAGIC
#define CHECK_WINDOW_MAGIC(window, retval)
Definition: SDL_video.c:116
SDL_Window::surface_valid
SDL_bool surface_valid
Definition: SDL_sysvideo.h:94

int SDL_VideoInit | ( | const char * | driver_name | ) |

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.

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

Definition at line 443 of file SDL_video.c.

References VideoBootStrap::create, SDL_VideoDevice::CreateWindowFramebuffer, SDL_VideoDevice::current_glctx_tls, SDL_VideoDevice::current_glwin_tls, SDL_VideoDevice::DestroyWindowFramebuffer, SDL_VideoDevice::dll_handle, SDL_VideoDevice::driver_loaded, SDL_VideoDevice::gl_config, i, SDL_VideoDevice::name, VideoBootStrap::name, SDL_VideoDevice::next_object_id, NULL, SDL_VideoDevice::num_displays, SDL_atoi, SDL_CreateWindowTexture(), SDL_DestroyWindowTexture(), SDL_DisableScreenSaver(), SDL_FALSE, SDL_getenv, SDL_GetHint, SDL_GL_ResetAttributes(), SDL_HasScreenKeyboardSupport(), SDL_HINT_VIDEO_ALLOW_SCREENSAVER, SDL_INIT_EVENTS, SDL_InitSubSystem, SDL_KeyboardInit(), SDL_MouseInit(), SDL_SetError, SDL_StartTextInput(), SDL_strlen, SDL_strncasecmp, SDL_TicksInit(), SDL_TLSCreate, SDL_TouchInit(), SDL_TRUE, SDL_UpdateWindowTexture(), SDL_VideoQuit(), ShouldUseTextureFramebuffer(), SDL_VideoDevice::UpdateWindowFramebuffer, and SDL_VideoDevice::VideoInit.

Referenced by SDL_CreateWindow().

{
SDL_VideoDevice *video;
const char *hint;
int index;
int i;
SDL_bool allow_screensaver;
/* Check to make sure we don't overwrite '_this' */
if (_this != NULL) {
SDL_VideoQuit();
}
#if !SDL_TIMERS_DISABLED
SDL_TicksInit();
#endif
/* Start the event loop */
if (SDL_InitSubSystem(SDL_INIT_EVENTS) < 0 ||
SDL_KeyboardInit() < 0 ||
SDL_MouseInit() < 0 ||
SDL_TouchInit() < 0) {
return -1;
}
/* Select the proper video driver */
index = 0;
video = NULL;
if (driver_name == NULL) {
driver_name = SDL_getenv("SDL_VIDEODRIVER");
}
if (driver_name != NULL) {
for (i = 0; bootstrap[i]; ++i) {
if (SDL_strncasecmp(bootstrap[i]->name, driver_name, SDL_strlen(driver_name)) == 0) {
if (bootstrap[i]->available()) {
video = bootstrap[i]->create(index);
break;
}
}
}
} else {
for (i = 0; bootstrap[i]; ++i) {
if (bootstrap[i]->available()) {
video = bootstrap[i]->create(index);
if (video != NULL) {
break;
}
}
}
}
if (video == NULL) {
if (driver_name) {
return SDL_SetError("%s not available", driver_name);
}
return SDL_SetError("No available video device");
}
_this = video;
_this->name = bootstrap[i]->name;
_this->next_object_id = 1;
/* Set some very sane GL defaults */
_this->gl_config.driver_loaded = 0;
_this->gl_config.dll_handle = NULL;
SDL_GL_ResetAttributes();
_this->current_glwin_tls = SDL_TLSCreate();
_this->current_glctx_tls = SDL_TLSCreate();
/* Initialize the video subsystem */
if (_this->VideoInit(_this) < 0) {
SDL_VideoQuit();
return -1;
}
/* Make sure some displays were added */
if (_this->num_displays == 0) {
SDL_VideoQuit();
return SDL_SetError("The video driver did not add any displays");
}
/* Add the renderer framebuffer emulation if desired */
if (ShouldUseTextureFramebuffer()) {
_this->CreateWindowFramebuffer = SDL_CreateWindowTexture;
_this->UpdateWindowFramebuffer = SDL_UpdateWindowTexture;
_this->DestroyWindowFramebuffer = SDL_DestroyWindowTexture;
}
/* Disable the screen saver by default. This is a change from <= 2.0.1,
but most things using SDL are games or media players; you wouldn't
want a screensaver to trigger if you're playing exclusively with a
joystick, or passively watching a movie. Things that use SDL but
function more like a normal desktop app should explicitly reenable the
screensaver. */
hint = SDL_GetHint(SDL_HINT_VIDEO_ALLOW_SCREENSAVER);
if (hint) {
allow_screensaver = SDL_atoi(hint) ? SDL_TRUE : SDL_FALSE;
} else {
allow_screensaver = SDL_FALSE;
}
if (!allow_screensaver) {
SDL_DisableScreenSaver();
}
/* If we don't use a screen keyboard, turn on text input by default,
otherwise programs that expect to get text events without enabling
UNICODE input won't get any events.
Actually, come to think of it, you needed to call SDL_EnableUNICODE(1)
in SDL 1.2 before you got text input events. Hmm...
*/
if (!SDL_HasScreenKeyboardSupport()) {
SDL_StartTextInput();
}
/* We're ready to go! */
return 0;
}
SDL_GL_ResetAttributes
void SDL_GL_ResetAttributes()
Reset all previously set OpenGL context attributes to their default values.
Definition: SDL_video.c:2740
SDL_VideoDevice::name
const char * name
Definition: SDL_sysvideo.h:146
SDL_INIT_EVENTS
#define SDL_INIT_EVENTS
Definition: SDL.h:81
SDL_VideoQuit
void SDL_VideoQuit(void)
Shuts down the video subsystem.
Definition: SDL_video.c:2532
SDL_VideoDevice::current_glwin_tls
SDL_TLSID current_glwin_tls
Definition: SDL_sysvideo.h:327
SDL_HINT_VIDEO_ALLOW_SCREENSAVER
#define SDL_HINT_VIDEO_ALLOW_SCREENSAVER
A variable controlling whether the screensaver is enabled.
Definition: SDL_hints.h:153
SDL_GetHint
#define SDL_GetHint
Definition: SDL_dynapi_overrides.h:197
SDL_InitSubSystem
#define SDL_InitSubSystem
Definition: SDL_dynapi_overrides.h:61
name
GLuint const GLchar * name
Definition: SDL_opengl_glext.h:660
SDL_KeyboardInit
int SDL_KeyboardInit(void)
Definition: SDL_keyboard.c:554
SDL_strncasecmp
#define SDL_strncasecmp
Definition: SDL_dynapi_overrides.h:426
SDL_MouseInit
int SDL_MouseInit(void)
Definition: SDL_mouse.c:45
_this
static SDL_VideoDevice * _this
Definition: SDL_video.c:114
SDL_bool
SDL_bool
Definition: SDL_stdinc.h:126
SDL_VideoDevice::gl_config
struct SDL_VideoDevice::@29 gl_config
SDL_UpdateWindowTexture
static int SDL_UpdateWindowTexture(SDL_VideoDevice *unused, SDL_Window *window, const SDL_Rect *rects, int numrects)
Definition: SDL_video.c:348
SDL_VideoDevice::driver_loaded
int driver_loaded
Definition: SDL_sysvideo.h:315
SDL_VideoDevice::num_displays
int num_displays
Definition: SDL_sysvideo.h:279
SDL_VideoDevice::dll_handle
void * dll_handle
Definition: SDL_sysvideo.h:317
SDL_TLSCreate
#define SDL_TLSCreate
Definition: SDL_dynapi_overrides.h:484
SDL_TRUE
Definition: SDL_stdinc.h:129
SDL_CreateWindowTexture
static int SDL_CreateWindowTexture(SDL_VideoDevice *unused, SDL_Window *window, Uint32 *format, void **pixels, int *pitch)
Definition: SDL_video.c:245
SDL_DestroyWindowTexture
static void SDL_DestroyWindowTexture(SDL_VideoDevice *unused, SDL_Window *window)
Definition: SDL_video.c:378
SDL_atoi
#define SDL_atoi
Definition: SDL_dynapi_overrides.h:416
index
GLuint index
Definition: SDL_opengl_glext.h:660
SDL_StartTextInput
void SDL_StartTextInput(void)
Start accepting Unicode text input events. This function will show the on-screen keyboard if supporte...
Definition: SDL_video.c:3397
SDL_getenv
#define SDL_getenv
Definition: SDL_dynapi_overrides.h:384
SDL_VideoDevice::DestroyWindowFramebuffer
void(* DestroyWindowFramebuffer)(_THIS, SDL_Window *window)
Definition: SDL_sysvideo.h:217
i
return Display return Display Bool Bool int int int return Display XEvent Bool(*) XPointer return Display return Display Drawable _Xconst char unsigned int unsigned int return Display Pixmap Pixmap XColor XColor unsigned int unsigned int return Display _Xconst char char int char return Display Visual unsigned int int int char unsigned int unsigned int in i)
Definition: SDL_x11sym.h:42
NULL
#define NULL
Definition: begin_code.h:143
SDL_SetError
#define SDL_SetError
Definition: SDL_dynapi_overrides.h:36
ShouldUseTextureFramebuffer
static SDL_bool ShouldUseTextureFramebuffer()
Definition: SDL_video.c:160
SDL_strlen
#define SDL_strlen
Definition: SDL_dynapi_overrides.h:399
SDL_VideoDevice::current_glctx_tls
SDL_TLSID current_glctx_tls
Definition: SDL_sysvideo.h:328
SDL_FALSE
Definition: SDL_stdinc.h:128
VideoBootStrap::create
SDL_VideoDevice *(* create)(int devindex)
Definition: SDL_sysvideo.h:353
bootstrap
static VideoBootStrap * bootstrap[]
Definition: SDL_video.c:59
VideoBootStrap::name
const char * name
Definition: SDL_sysvideo.h:350
SDL_VideoDevice
Definition: SDL_sysvideo.h:142
SDL_TicksInit
void SDL_TicksInit(void)
SDL_VideoDevice::VideoInit
int(* VideoInit)(_THIS)
Definition: SDL_sysvideo.h:155
SDL_VideoDevice::UpdateWindowFramebuffer
int(* UpdateWindowFramebuffer)(_THIS, SDL_Window *window, const SDL_Rect *rects, int numrects)
Definition: SDL_sysvideo.h:216
SDL_VideoDevice::next_object_id
Uint32 next_object_id
Definition: SDL_sysvideo.h:284
SDL_HasScreenKeyboardSupport
SDL_bool SDL_HasScreenKeyboardSupport(void)
Returns whether the platform has some screen keyboard support.
Definition: SDL_video.c:3453
SDL_VideoDevice::CreateWindowFramebuffer
int(* CreateWindowFramebuffer)(_THIS, SDL_Window *window, Uint32 *format, void **pixels, int *pitch)
Definition: SDL_sysvideo.h:215
SDL_TouchInit
int SDL_TouchInit(void)
Definition: SDL_touch.c:36
SDL_DisableScreenSaver
void SDL_DisableScreenSaver()
Prevent the screen from being blanked by a screensaver.
Definition: SDL_video.c:2517

void SDL_VideoQuit | ( | void |  | ) |

Shuts down the video subsystem.

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

See also
  SDL_VideoInit()

Definition at line 2532 of file SDL_video.c.

References SDL_VideoDevice::clipboard_text, SDL_VideoDisplay::desktop_mode, SDL_VideoDisplay::display_modes, SDL_VideoDevice::displays, SDL_DisplayMode::driverdata, SDL_VideoDisplay::driverdata, SDL_VideoDevice::free, i, j, SDL_VideoDisplay::name, NULL, SDL_VideoDisplay::num_display_modes, SDL_VideoDevice::num_displays, SDL_DestroyWindow(), SDL_EnableScreenSaver(), SDL_free(), SDL_INIT_EVENTS, SDL_KeyboardQuit(), SDL_MouseQuit(), SDL_QuitSubSystem, SDL_TouchQuit(), SDL_VideoDevice::VideoQuit, and SDL_VideoDevice::windows.

Referenced by SDL_VideoInit().

{
int i, j;
if (!_this) {
return;
}
/* Halt event processing before doing anything else */
SDL_TouchQuit();
SDL_MouseQuit();
SDL_KeyboardQuit();
SDL_QuitSubSystem(SDL_INIT_EVENTS);
SDL_EnableScreenSaver();
/* Clean up the system video */
while (_this->windows) {
SDL_DestroyWindow(_this->windows);
}
_this->VideoQuit(_this);
for (i = 0; i < _this->num_displays; ++i) {
SDL_VideoDisplay *display = &_this->displays[i];
for (j = display->num_display_modes; j--;) {
SDL_free(display->display_modes[j].driverdata);
display->display_modes[j].driverdata = NULL;
}
SDL_free(display->display_modes);
display->display_modes = NULL;
SDL_free(display->desktop_mode.driverdata);
display->desktop_mode.driverdata = NULL;
SDL_free(display->driverdata);
display->driverdata = NULL;
}
if (_this->displays) {
for (i = 0; i < _this->num_displays; ++i) {
SDL_free(_this->displays[i].name);
}
SDL_free(_this->displays);
_this->displays = NULL;
_this->num_displays = 0;
}
SDL_free(_this->clipboard_text);
_this->clipboard_text = NULL;
_this->free(_this);
_this = NULL;
}
SDL_INIT_EVENTS
#define SDL_INIT_EVENTS
Definition: SDL.h:81
SDL_VideoDevice::free
void(* free)(_THIS)
Definition: SDL_sysvideo.h:345
SDL_VideoDisplay::name
char * name
Definition: SDL_sysvideo.h:122
SDL_QuitSubSystem
#define SDL_QuitSubSystem
Definition: SDL_dynapi_overrides.h:62
SDL_MouseQuit
void SDL_MouseQuit(void)
Definition: SDL_mouse.c:435
_this
static SDL_VideoDevice * _this
Definition: SDL_video.c:114
SDL_VideoDisplay::num_display_modes
int num_display_modes
Definition: SDL_sysvideo.h:124
SDL_free
void SDL_free(void *mem)
SDL_DisplayMode::driverdata
void * driverdata
Definition: SDL_video.h:59
SDL_DestroyWindow
void SDL_DestroyWindow(SDL_Window *window)
Destroy a window.
Definition: SDL_video.c:2419
SDL_VideoDevice::num_displays
int num_displays
Definition: SDL_sysvideo.h:279
SDL_VideoDisplay::display_modes
SDL_DisplayMode * display_modes
Definition: SDL_sysvideo.h:125
SDL_VideoDevice::displays
SDL_VideoDisplay * displays
Definition: SDL_sysvideo.h:280
SDL_VideoDevice::windows
SDL_Window * windows
Definition: SDL_sysvideo.h:281
SDL_KeyboardQuit
void SDL_KeyboardQuit(void)
Definition: SDL_keyboard.c:817
SDL_VideoDisplay
Definition: SDL_sysvideo.h:120
i
return Display return Display Bool Bool int int int return Display XEvent Bool(*) XPointer return Display return Display Drawable _Xconst char unsigned int unsigned int return Display Pixmap Pixmap XColor XColor unsigned int unsigned int return Display _Xconst char char int char return Display Visual unsigned int int int char unsigned int unsigned int in i)
Definition: SDL_x11sym.h:42
NULL
#define NULL
Definition: begin_code.h:143
SDL_VideoDisplay::desktop_mode
SDL_DisplayMode desktop_mode
Definition: SDL_sysvideo.h:126
SDL_VideoDevice::VideoQuit
void(* VideoQuit)(_THIS)
Definition: SDL_sysvideo.h:161
SDL_EnableScreenSaver
void SDL_EnableScreenSaver()
Allow the screen to be blanked by a screensaver.
Definition: SDL_video.c:2502
SDL_TouchQuit
void SDL_TouchQuit(void)
Definition: SDL_touch.c:352
SDL_VideoDisplay::driverdata
void * driverdata
Definition: SDL_sysvideo.h:133
SDL_VideoDevice::clipboard_text
char * clipboard_text
Definition: SDL_sysvideo.h:285
j
return Display return Display Bool Bool int int int return Display XEvent Bool(*) XPointer return Display return Display Drawable _Xconst char unsigned int unsigned int return Display Pixmap Pixmap XColor XColor unsigned int unsigned int return Display _Xconst char char int char return Display Visual unsigned int int int char unsigned int unsigned int int in j)
Definition: SDL_x11sym.h:42