SDL3pp
A slim C++ wrapper for SDL3
Loading...
Searching...
No Matches
Display and Window Management

SDL's video subsystem is largely interested in abstracting window management from the underlying operating system. More...

Namespaces

namespace  SDL::prop
 Constants for Properties keys.
namespace  SDL::prop::Display
 Properties for Display.
namespace  SDL::prop::Window
 Properties for Window.
namespace  SDL::prop::Window::Create
 Properties for Window creation.

Classes

class  SDL::Display
 This is a unique ID for a display for the time it is connected to the system, and is never reused for the lifetime of the application. More...
struct  SDL::Window
 The struct used as an opaque handle to a window. More...
struct  SDL::GLContext
 An opaque handle to an OpenGL context. More...
struct  SDL::GLContextScoped
 RAII owning version GLContext. More...

Typedefs

using SDL::DisplayID = SDL_DisplayID
 Alias to raw representation for Display.
using SDL::WindowRaw = SDL_Window*
 Alias to raw representation for Window.
using SDL::WindowRef = ResourceRef<Window>
 Reference for Window.
using SDL::GLContextRaw = SDL_GLContext
 Alias to raw representation for GLContext.
using SDL::GLContextRef = GLContext
 Alias to GLContext for non owning parameters.
using SDL::RendererRef = ResourceRef<Renderer>
 Reference for Renderer.
using SDL::DisplayOrientation = SDL_DisplayOrientation
 Display orientation values; the way a display is rotated.
using SDL::DisplayMode = SDL_DisplayMode
 The structure that defines a display mode.
using SDL::WindowID = SDL_WindowID
 This is a unique ID for a window.
using SDL::SystemTheme = SDL_SystemTheme
 System theme.
using SDL::DisplayModeData = SDL_DisplayModeData
 Internal display mode data.
using SDL::WindowFlags = Uint64
 The flags on a window.
using SDL::FlashOperation = SDL_FlashOperation
 Window flash operation.
using SDL::HitTestResult = SDL_HitTestResult
 Possible return values from the HitTest callback.
using SDL::HitTest
 Callback used for hit-testing.
using SDL::HitTestCB
 Callback used for hit-testing.
using SDL::EGLSurface = SDL_EGLSurface
 Opaque type for an EGL surface.
using SDL::ProgressState = SDL_ProgressState
 Window progress state.
using SDL::EGLDisplay = SDL_EGLDisplay
 Opaque type for an EGL display.
using SDL::EGLConfig = SDL_EGLConfig
 Opaque type for an EGL config.
using SDL::EGLAttrib = SDL_EGLAttrib
 An EGL attribute, used when creating an EGL context.
using SDL::EGLint = SDL_EGLint
 An EGL integer attribute, used when creating an EGL surface.
using SDL::EGLAttribArrayCallback = EGLAttrib*(SDLCALL*)(void* userdata)
 EGL platform attribute initialization callback.
using SDL::EGLIntArrayCallback
 EGL surface/context attribute initialization callback types.
using SDL::GLAttr = SDL_GLAttr
 An enumeration of OpenGL configuration attributes.
using SDL::GLProfile = Uint32
 Possible values to be set for the GL_CONTEXT_PROFILE_MASK attribute.
using SDL::GLContextFlag = Uint32
 Possible flags to be set for the GL_CONTEXT_FLAGS attribute.
using SDL::GLContextReleaseFlag = Uint32
 Possible values to be set for the GL_CONTEXT_RELEASE_BEHAVIOR attribute.
using SDL::GLContextResetNotification = Uint32
 Possible values to be set GL_CONTEXT_RESET_NOTIFICATION attribute.

Functions

constexpr int SDL::WINDOWPOS_UNDEFINED_DISPLAY (int X)
 Used to indicate that you don't care what the window position is.
constexpr bool SDL::WINDOWPOS_ISUNDEFINED (int X)
 A macro to test if the window position is marked as "undefined.".
constexpr int SDL::WINDOWPOS_CENTERED_DISPLAY (int X)
 Used to indicate that the window position should be centered.
constexpr bool SDL::WINDOWPOS_ISCENTERED (int X)
 A macro to test if the window position is marked as "centered.".
int SDL::GetNumVideoDrivers ()
 Get the number of video drivers compiled into SDL.
const char * SDL::GetVideoDriver (int index)
 Get the name of a built in video driver.
const char * SDL::GetCurrentVideoDriver ()
 Get the name of the currently initialized video driver.
SystemTheme SDL::GetSystemTheme ()
 Get the current system theme.
OwnArray< DisplayIDSDL::GetDisplays ()
 Get a list of currently connected displays.
Display SDL::GetPrimaryDisplay ()
 Return the primary display.
PropertiesRef SDL::GetDisplayProperties (DisplayID displayID)
 Get the properties associated with a display.
const char * SDL::GetDisplayName (DisplayID displayID)
 Get the name of a display in UTF-8 encoding.
Rect SDL::GetDisplayBounds (Display displayID)
 Get the desktop area represented by a display.
Rect SDL::GetDisplayUsableBounds (Display displayID)
 Get the usable desktop area represented by a display, in screen coordinates.
DisplayOrientation SDL::GetNaturalDisplayOrientation (DisplayID displayID)
 Get the orientation of a display when it is unrotated.
DisplayOrientation SDL::GetCurrentDisplayOrientation (DisplayID displayID)
 Get the orientation of a display.
float SDL::GetDisplayContentScale (DisplayID displayID)
 Get the content scale of a display.
OwnArray< DisplayMode * > SDL::GetFullscreenDisplayModes (Display displayID)
 Get a list of fullscreen display modes available on a display.
DisplayMode SDL::GetClosestFullscreenDisplayMode (Display displayID, const PointRaw &size, float refresh_rate, bool include_high_density_modes)
 Get the closest match to the requested display mode.
const DisplayModeSDL::GetDesktopDisplayMode (DisplayID displayID)
 Get information about the desktop's display mode.
const DisplayModeSDL::GetCurrentDisplayMode (DisplayID displayID)
 Get information about the current display mode.
Display SDL::GetDisplayForPoint (const PointRaw &point)
 Get the display containing a point.
Display SDL::GetDisplayForRect (const RectRaw &rect)
 Get the display primarily containing a rect.
Display SDL::GetDisplayForWindow (WindowRef window)
 Get the display associated with a window.
float SDL::GetWindowPixelDensity (WindowRef window)
 Get the pixel density of a window.
float SDL::GetWindowDisplayScale (WindowRef window)
 Get the content display scale relative to a window's pixel size.
void SDL::SetWindowFullscreenMode (WindowRef window, OptionalRef< const DisplayMode > mode)
 Set the display mode to use when a window is visible and fullscreen.
const DisplayModeSDL::GetWindowFullscreenMode (WindowRef window)
 Query the display mode to use when a window is visible at fullscreen.
OwnPtr< void > SDL::GetWindowICCProfile (WindowRef window)
 Get the raw ICC profile data for the screen the window is currently on.
PixelFormat SDL::GetWindowPixelFormat (WindowRef window)
 Get the pixel format associated with the window.
OwnArray< WindowRefSDL::GetWindows ()
 Get a list of valid windows.
Window SDL::CreateWindow (StringParam title, const PointRaw &size, WindowFlags flags)
 Create a window with the specified dimensions and flags.
Window SDL::CreatePopupWindow (WindowRef parent, const PointRaw &offset, const PointRaw &size, WindowFlags flags)
 Create a child popup window of the specified parent window.
Window SDL::CreateWindowWithProperties (PropertiesRef props)
 Create a window with the specified properties.
WindowID SDL::GetWindowID (WindowRef window)
 Get the numeric ID of a window.
WindowRef SDL::GetWindowFromID (WindowID id)
 Get a window from a stored ID.
WindowRef SDL::GetWindowParent (WindowRef window)
 Get parent of a window.
PropertiesRef SDL::GetWindowProperties (WindowRef window)
 Get the properties associated with a window.
WindowFlags SDL::GetWindowFlags (WindowRef window)
 Get the window flags.
void SDL::SetWindowTitle (WindowRef window, StringParam title)
 Set the title of a window.
const char * SDL::GetWindowTitle (WindowRef window)
 Get the title of a window.
void SDL::SetWindowIcon (WindowRef window, SurfaceRef icon)
 Set the icon for a window.
void SDL::SetWindowPosition (WindowRef window, const PointRaw &p)
 Request that the window's position be set.
void SDL::GetWindowPosition (WindowRef window, int *x, int *y)
 Get the position of a window.
Point SDL::GetWindowPosition (WindowRef window)
 Get the position of a window.
void SDL::SetWindowSize (WindowRef window, const PointRaw &size)
 Request that the size of a window's client area be set.
void SDL::GetWindowSize (WindowRef window, int *w, int *h)
 Get the size of a window's client area.
Point SDL::GetWindowSize (WindowRef window)
 Get the size of a window's client area.
void SDL::SetWindowRect (WindowRef window, Rect rect)
 Request the window's position and size to be set.
Rect SDL::GetWindowRect (WindowRef window)
 Get the position and client size of a window.
Rect SDL::GetWindowSafeArea (WindowRef window)
 Get the safe area for this window.
void SDL::SetWindowAspectRatio (WindowRef window, float min_aspect, float max_aspect)
 Request that the aspect ratio of a window's client area be set.
void SDL::GetWindowAspectRatio (WindowRef window, float *min_aspect, float *max_aspect)
 Get the aspect ratio of a window's client area.
void SDL::GetWindowBordersSize (WindowRef window, int *top, int *left, int *bottom, int *right)
 Get the size of a window's borders (decorations) around the client area.
void SDL::GetWindowSizeInPixels (WindowRef window, int *w, int *h)
 Get the size of a window's client area, in pixels.
Point SDL::GetWindowSizeInPixels (WindowRef window)
 Get the size of a window's client area, in pixels.
void SDL::SetWindowMinimumSize (WindowRef window, const PointRaw &p)
 Set the minimum size of a window's client area.
void SDL::GetWindowMinimumSize (WindowRef window, int *w, int *h)
 Get the minimum size of a window's client area.
void SDL::SetWindowMaximumSize (WindowRef window, const PointRaw &p)
 Set the maximum size of a window's client area.
void SDL::GetWindowMaximumSize (WindowRef window, int *w, int *h)
 Get the maximum size of a window's client area.
void SDL::SetWindowBordered (WindowRef window, bool bordered)
 Set the border state of a window.
void SDL::SetWindowResizable (WindowRef window, bool resizable)
 Set the user-resizable state of a window.
void SDL::SetWindowAlwaysOnTop (WindowRef window, bool on_top)
 Set the window to always be above the others.
void SDL::SetWindowFillDocument (WindowRef window, bool fill)
 Set the window to fill the current document space (Emscripten only).
void SDL::ShowWindow (WindowRef window)
 Show a window.
void SDL::HideWindow (WindowRef window)
 Hide a window.
void SDL::RaiseWindow (WindowRef window)
 Request that a window be raised above other windows and gain the input focus.
void SDL::MaximizeWindow (WindowRef window)
 Request that the window be made as large as possible.
void SDL::MinimizeWindow (WindowRef window)
 Request that the window be minimized to an iconic representation.
void SDL::RestoreWindow (WindowRef window)
 Request that the size and position of a minimized or maximized window be restored.
void SDL::SetWindowFullscreen (WindowRef window, bool fullscreen)
 Request that the window's fullscreen state be changed.
bool SDL::SyncWindow (WindowRef window)
 Block until any pending window state is finalized.
bool SDL::WindowHasSurface (WindowRef window)
 Return whether the window has a surface associated with it.
Surface SDL::GetWindowSurface (WindowRef window)
 Get the SDL surface associated with the window.
void SDL::SetWindowSurfaceVSync (WindowRef window, int vsync)
 Toggle VSync for the window surface.
int SDL::GetWindowSurfaceVSync (WindowRef window)
 Get VSync for the window surface.
void SDL::UpdateWindowSurface (WindowRef window)
 Copy the window surface to the screen.
void SDL::UpdateWindowSurfaceRects (WindowRef window, SpanRef< const RectRaw > rects)
 Copy areas of the window surface to the screen.
void SDL::DestroyWindowSurface (WindowRef window)
 Destroy the surface associated with the window.
void SDL::SetWindowKeyboardGrab (WindowRef window, bool grabbed)
 Set a window's keyboard grab mode.
void SDL::SetWindowMouseGrab (WindowRef window, bool grabbed)
 Set a window's mouse grab mode.
bool SDL::GetWindowKeyboardGrab (WindowRef window)
 Get a window's keyboard grab mode.
bool SDL::GetWindowMouseGrab (WindowRef window)
 Get a window's mouse grab mode.
WindowRef SDL::GetGrabbedWindow ()
 Get the window that currently has an input grab enabled.
void SDL::SetWindowMouseRect (WindowRef window, const RectRaw &rect)
 Confines the cursor to the specified area of a window.
const RectRawSDL::GetWindowMouseRect (WindowRef window)
 Get the mouse confinement rectangle of a window.
void SDL::SetWindowOpacity (WindowRef window, float opacity)
 Set the opacity for a window.
float SDL::GetWindowOpacity (WindowRef window)
 Get the opacity of a window.
void SDL::SetWindowParent (WindowRef window, WindowRef parent)
 Set the window as a child of a parent window.
void SDL::SetWindowModal (WindowRef window, bool modal)
 Toggle the state of the window as modal.
void SDL::SetWindowFocusable (WindowRef window, bool focusable)
 Set whether the window may have input focus.
void SDL::ShowWindowSystemMenu (WindowRef window, const PointRaw &p)
 Display the system-level window menu.
void SDL::SetWindowHitTest (WindowRef window, HitTest callback, void *callback_data)
 Provide a callback that decides if a window region has special properties.
void SDL::SetWindowHitTest (WindowRef window, HitTestCB callback)
 Provide a callback that decides if a window region has special properties.
void SDL::SetWindowShape (WindowRef window, SurfaceRef shape)
 Set the shape of a transparent window.
void SDL::FlashWindow (WindowRef window, FlashOperation operation)
 Request a window to demand attention from the user.
void SDL::SetWindowProgressState (WindowRef window, ProgressState state)
 Sets the state of the progress bar for the given window’s taskbar icon.
ProgressState SDL::GetWindowProgressState (WindowRef window)
 Get the state of the progress bar for the given window’s taskbar icon.
void SDL::SetWindowProgressValue (WindowRef window, float value)
 Sets the value of the progress bar for the given window’s taskbar icon.
float SDL::GetWindowProgressValue (WindowRef window)
 Get the value of the progress bar for the given window’s taskbar icon.
void SDL::DestroyWindow (WindowRaw window)
 Destroy a window.
bool SDL::ScreenSaverEnabled ()
 Check whether the screensaver is currently enabled.
void SDL::EnableScreenSaver ()
 Allow the screen to be blanked by a screen saver.
void SDL::DisableScreenSaver ()
 Prevent the screen from being blanked by a screen saver.
void SDL::GL_LoadLibrary (StringParam path)
 Dynamically load an OpenGL library.
FunctionPointer SDL::GL_GetProcAddress (StringParam proc)
 Get an OpenGL function by name.
FunctionPointer SDL::EGL_GetProcAddress (StringParam proc)
 Get an EGL library function by name.
void SDL::GL_UnloadLibrary ()
 Unload the OpenGL library previously loaded by GL_LoadLibrary().
bool SDL::GL_ExtensionSupported (StringParam extension)
 Check if an OpenGL extension is supported for the current context.
void SDL::GL_ResetAttributes ()
 Reset all previously set OpenGL context attributes to their default values.
void SDL::GL_SetAttribute (GLAttr attr, int value)
 Set an OpenGL window attribute before window creation.
void SDL::GL_GetAttribute (GLAttr attr, int *value)
 Get the actual value for an attribute from the current context.
GLContext SDL::GL_CreateContext (WindowRef window)
 Create an OpenGL context for an OpenGL window, and make it current.
void SDL::GL_MakeCurrent (WindowRef window, GLContext context)
 Set up an OpenGL context for rendering into an OpenGL window.
WindowRef SDL::GL_GetCurrentWindow ()
 Get the currently active OpenGL window.
GLContext SDL::GL_GetCurrentContext ()
 Get the currently active OpenGL context.
EGLDisplay SDL::EGL_GetCurrentDisplay ()
 Get the currently active EGL display.
EGLConfig SDL::EGL_GetCurrentConfig ()
 Get the currently active EGL config.
EGLSurface SDL::EGL_GetWindowSurface (WindowRef window)
 Get the EGL surface associated with the window.
void SDL::EGL_SetAttributeCallbacks (EGLAttribArrayCallback platformAttribCallback, EGLIntArrayCallback surfaceAttribCallback, EGLIntArrayCallback contextAttribCallback, void *userdata)
 Sets the callbacks for defining custom EGLAttrib arrays for EGL initialization.
void SDL::GL_SetSwapInterval (int interval)
 Set the swap interval for the current OpenGL context.
void SDL::GL_GetSwapInterval (int *interval)
 Get the swap interval for the current OpenGL context.
void SDL::GL_SwapWindow (WindowRef window)
 Update a window with OpenGL rendering.
void SDL::GL_DestroyContext (GLContextRaw context)
 Delete an OpenGL context.
static Display SDL::Display::GetPrimary ()
 Return the primary display.
PropertiesRef SDL::Display::GetProperties () const
 Get the properties associated with a display.
const char * SDL::Display::GetName () const
 Get the name of a display in UTF-8 encoding.
Rect SDL::Display::GetBounds () const
 Get the desktop area represented by a display.
Rect SDL::Display::GetUsableBounds () const
 Get the usable desktop area represented by a display, in screen coordinates.
DisplayOrientation SDL::Display::GetNaturalOrientation () const
 Get the orientation of a display when it is unrotated.
DisplayOrientation SDL::Display::GetCurrentOrientation () const
 Get the orientation of a display.
float SDL::Display::GetContentScale () const
 Get the content scale of a display.
OwnArray< DisplayMode * > SDL::Display::GetFullscreenModes () const
 Get a list of fullscreen display modes available on a display.
DisplayMode SDL::Display::GetClosestFullscreenMode (const PointRaw &size, float refresh_rate, bool include_high_density_modes) const
 Get the closest match to the requested display mode.
const DisplayModeSDL::Display::GetDesktopMode () const
 Get information about the desktop's display mode.
const DisplayModeSDL::Display::GetCurrentMode () const
 Get information about the current display mode.
static Display SDL::Display::GetForPoint (const PointRaw &point)
 Get the display containing a point.
static Display SDL::Display::GetForRect (const RectRaw &rect)
 Get the display primarily containing a rect.
Display SDL::Window::GetDisplay () const
 Get the display associated with a window.
float SDL::Window::GetPixelDensity () const
 Get the pixel density of a window.
float SDL::Window::GetDisplayScale () const
 Get the content display scale relative to a window's pixel size.
void SDL::Window::SetFullscreenMode (OptionalRef< const DisplayMode > mode)
 Set the display mode to use when a window is visible and fullscreen.
const DisplayModeSDL::Window::GetFullscreenMode () const
 Query the display mode to use when a window is visible at fullscreen.
OwnPtr< void > SDL::Window::GetICCProfile () const
 Get the raw ICC profile data for the screen the window is currently on.
PixelFormat SDL::Window::GetPixelFormat () const
 Get the pixel format associated with the window.
 SDL::Window::Window (StringParam title, const PointRaw &size, WindowFlags flags=0)
 Create a window with the specified dimensions and flags.
 SDL::Window::Window (WindowRef parent, const PointRaw &offset, const PointRaw &size, WindowFlags flags=0)
 Create a child popup window of the specified parent window.
 SDL::Window::Window (PropertiesRef props)
 Create a window with the specified properties.
WindowID SDL::Window::GetID () const
 Get the numeric ID of a window.
static WindowRef SDL::Window::FromID (WindowID id)
 Get a window from a stored ID.
WindowRef SDL::Window::GetParent () const
 Get parent of a window.
PropertiesRef SDL::Window::GetProperties () const
 Get the properties associated with a window.
WindowFlags SDL::Window::GetFlags () const
 Get the window flags.
void SDL::Window::SetTitle (StringParam title)
 Set the title of a window.
const char * SDL::Window::GetTitle () const
 Get the title of a window.
void SDL::Window::SetIcon (SurfaceRef icon)
 Set the icon for a window.
void SDL::Window::SetPosition (const PointRaw &p)
 Request that the window's position be set.
void SDL::Window::GetPosition (int *x, int *y) const
 Get the position of a window.
Point SDL::Window::GetPosition () const
 Get the position of a window.
void SDL::Window::SetSize (const PointRaw &size)
 Request that the size of a window's client area be set.
void SDL::Window::GetSize (int *w, int *h) const
 Get the size of a window's client area.
Point SDL::Window::GetSize () const
 Get the size of a window's client area.
void SDL::Window::SetRect (Rect rect)
 Request the window's position and size to be set.
Rect SDL::Window::GetRect () const
 Get the position and client size of a window.
Rect SDL::Window::GetSafeArea () const
 Get the safe area for this window.
void SDL::Window::SetAspectRatio (float min_aspect, float max_aspect)
 Request that the aspect ratio of a window's client area be set.
void SDL::Window::GetAspectRatio (float *min_aspect, float *max_aspect) const
 Get the aspect ratio of a window's client area.
void SDL::Window::GetBordersSize (int *top, int *left, int *bottom, int *right) const
 Get the size of a window's borders (decorations) around the client area.
void SDL::Window::GetSizeInPixels (int *w, int *h) const
 Get the size of a window's client area, in pixels.
Point SDL::Window::GetSizeInPixels () const
 Get the size of a window's client area, in pixels.
void SDL::Window::SetMinimumSize (const PointRaw &p)
 Set the minimum size of a window's client area.
void SDL::Window::GetMinimumSize (int *w, int *h) const
 Get the minimum size of a window's client area.
void SDL::Window::SetMaximumSize (const PointRaw &p)
 Set the maximum size of a window's client area.
void SDL::Window::GetMaximumSize (int *w, int *h) const
 Get the maximum size of a window's client area.
void SDL::Window::SetBordered (bool bordered)
 Set the border state of a window.
void SDL::Window::SetResizable (bool resizable)
 Set the user-resizable state of a window.
void SDL::Window::SetAlwaysOnTop (bool on_top)
 Set the window to always be above the others.
void SDL::Window::SetFillDocument (bool fill)
 Set the window to fill the current document space (Emscripten only).
void SDL::Window::Show ()
 Show a window.
void SDL::Window::Hide ()
 Hide a window.
void SDL::Window::Raise ()
 Request that a window be raised above other windows and gain the input focus.
void SDL::Window::Maximize ()
 Request that the window be made as large as possible.
void SDL::Window::Minimize ()
 Request that the window be minimized to an iconic representation.
void SDL::Window::Restore ()
 Request that the size and position of a minimized or maximized window be restored.
void SDL::Window::SetFullscreen (bool fullscreen)
 Request that the window's fullscreen state be changed.
bool SDL::Window::Sync ()
 Block until any pending window state is finalized.
bool SDL::Window::HasSurface () const
 Return whether the window has a surface associated with it.
Surface SDL::Window::GetSurface ()
 Get the SDL surface associated with the window.
void SDL::Window::SetSurfaceVSync (int vsync)
 Toggle VSync for the window surface.
int SDL::Window::GetSurfaceVSync () const
 Get VSync for the window surface.
void SDL::Window::UpdateSurface ()
 Copy the window surface to the screen.
void SDL::Window::UpdateSurfaceRects (SpanRef< const RectRaw > rects)
 Copy areas of the window surface to the screen.
void SDL::Window::DestroySurface ()
 Destroy the surface associated with the window.
void SDL::Window::SetKeyboardGrab (bool grabbed)
 Set a window's keyboard grab mode.
void SDL::Window::SetMouseGrab (bool grabbed)
 Set a window's mouse grab mode.
bool SDL::Window::GetKeyboardGrab () const
 Get a window's keyboard grab mode.
bool SDL::Window::GetMouseGrab () const
 Get a window's mouse grab mode.
static WindowRef SDL::Window::GetGrabbed ()
 Get the window that currently has an input grab enabled.
void SDL::Window::SetMouseRect (const RectRaw &rect)
 Confines the cursor to the specified area of a window.
const RectRawSDL::Window::GetMouseRect () const
 Get the mouse confinement rectangle of a window.
void SDL::Window::SetOpacity (float opacity)
 Set the opacity for a window.
float SDL::Window::GetOpacity () const
 Get the opacity of a window.
void SDL::Window::SetParent (WindowRef parent)
 Set the window as a child of a parent window.
void SDL::Window::SetModal (bool modal)
 Toggle the state of the window as modal.
void SDL::Window::SetFocusable (bool focusable)
 Set whether the window may have input focus.
void SDL::Window::ShowSystemMenu (const PointRaw &p)
 Display the system-level window menu.
void SDL::Window::SetHitTest (HitTest callback, void *callback_data)
 Provide a callback that decides if a window region has special properties.
void SDL::Window::SetHitTest (HitTestCB callback)
 Provide a callback that decides if a window region has special properties.
void SDL::Window::SetShape (SurfaceRef shape)
 Set the shape of a transparent window.
void SDL::Window::Flash (FlashOperation operation)
 Request a window to demand attention from the user.
void SDL::Window::SetProgressState (ProgressState state)
 Sets the state of the progress bar for the given window’s taskbar icon.
ProgressState SDL::Window::GetProgressState ()
 Get the state of the progress bar for the given window’s taskbar icon.
void SDL::Window::SetProgressValue (float value)
 Sets the value of the progress bar for the given window’s taskbar icon.
float SDL::Window::GetProgressValue ()
 Get the value of the progress bar for the given window’s taskbar icon.
void SDL::Window::Destroy ()
 Destroy a window.
GLContext SDL::Window::CreateGLContext ()
 Create an OpenGL context for an OpenGL window, and make it current.
 SDL::GLContext::GLContext (WindowRef window)
 Create an OpenGL context for an OpenGL window, and make it current.
void SDL::Window::MakeCurrent (GLContext context)
 Set up an OpenGL context for rendering into an OpenGL window.
void SDL::GLContext::MakeCurrent (WindowRef window)
 Set up an OpenGL context for rendering into an OpenGL window.
EGLSurface SDL::Window::GetEGLSurface ()
 Get the EGL surface associated with the window.
void SDL::Window::GL_Swap ()
 Update a window with OpenGL rendering.
void SDL::GLContext::Destroy ()
 Delete an OpenGL context.

Variables

constexpr DisplayOrientation SDL::ORIENTATION_UNKNOWN
 The display orientation can't be determined.
constexpr DisplayOrientation SDL::ORIENTATION_LANDSCAPE = SDL_ORIENTATION_LANDSCAPE
 The display is in landscape mode, with the right side up, relative to portrait mode.
constexpr DisplayOrientation SDL::ORIENTATION_LANDSCAPE_FLIPPED
 The display is in landscape mode, with the left side up, relative to portrait mode.
constexpr DisplayOrientation SDL::ORIENTATION_PORTRAIT
 The display is in portrait mode.
constexpr DisplayOrientation SDL::ORIENTATION_PORTRAIT_FLIPPED
 The display is in portrait mode, upside down.
constexpr SystemTheme SDL::SYSTEM_THEME_UNKNOWN
 Unknown system theme.
constexpr SystemTheme SDL::SYSTEM_THEME_LIGHT
 Light colored system theme.
constexpr SystemTheme SDL::SYSTEM_THEME_DARK
 Dark colored system theme.
constexpr WindowFlags SDL::WINDOW_FULLSCREEN
 window is in fullscreen mode
constexpr WindowFlags SDL::WINDOW_OPENGL
 window usable with OpenGL context
constexpr WindowFlags SDL::WINDOW_OCCLUDED
 window is occluded
constexpr WindowFlags SDL::WINDOW_HIDDEN = SDL_WINDOW_HIDDEN
 window is neither mapped onto the desktop nor shown in the taskbar/dock/window list; Window.Show() is required for it to become visible
constexpr WindowFlags SDL::WINDOW_BORDERLESS
 no window decoration
constexpr WindowFlags SDL::WINDOW_RESIZABLE
 window can be resized
constexpr WindowFlags SDL::WINDOW_MINIMIZED
 window is minimized
constexpr WindowFlags SDL::WINDOW_MAXIMIZED
 window is maximized
constexpr WindowFlags SDL::WINDOW_MOUSE_GRABBED
 window has grabbed mouse input
constexpr WindowFlags SDL::WINDOW_INPUT_FOCUS
 window has input focus
constexpr WindowFlags SDL::WINDOW_MOUSE_FOCUS
 window has mouse focus
constexpr WindowFlags SDL::WINDOW_EXTERNAL
 window not created by SDL
constexpr WindowFlags SDL::WINDOW_MODAL = SDL_WINDOW_MODAL
 window is modal
constexpr WindowFlags SDL::WINDOW_HIGH_PIXEL_DENSITY = SDL_WINDOW_HIGH_PIXEL_DENSITY
 window uses high pixel density back buffer if possible
constexpr WindowFlags SDL::WINDOW_MOUSE_CAPTURE = SDL_WINDOW_MOUSE_CAPTURE
 window has mouse captured (unrelated to MOUSE_GRABBED)
constexpr WindowFlags SDL::WINDOW_MOUSE_RELATIVE_MODE
 window has relative mode enabled
constexpr WindowFlags SDL::WINDOW_ALWAYS_ON_TOP
 window should always be above others
constexpr WindowFlags SDL::WINDOW_UTILITY = SDL_WINDOW_UTILITY
 window should be treated as a utility window, not showing in the task bar and window list
constexpr WindowFlags SDL::WINDOW_TOOLTIP = SDL_WINDOW_TOOLTIP
 window should be treated as a tooltip and does not get mouse or keyboard focus, requires a parent window
constexpr WindowFlags SDL::WINDOW_POPUP_MENU = SDL_WINDOW_POPUP_MENU
 window should be treated as a popup menu, requires a parent window
constexpr WindowFlags SDL::WINDOW_KEYBOARD_GRABBED
 window has grabbed keyboard input
constexpr WindowFlags SDL::WINDOW_FILL_DOCUMENT = SDL_WINDOW_FILL_DOCUMENT
 window is in fill-document mode (Emscripten only), since SDL 3.4.0
constexpr WindowFlags SDL::WINDOW_VULKAN
 window usable for Vulkan surface
constexpr WindowFlags SDL::WINDOW_METAL
 window usable for Metal view
constexpr WindowFlags SDL::WINDOW_TRANSPARENT
 window with transparent buffer
constexpr WindowFlags SDL::WINDOW_NOT_FOCUSABLE
 window should not be focusable
constexpr FlashOperation SDL::FLASH_CANCEL
 Cancel any window flash state.
constexpr FlashOperation SDL::FLASH_BRIEFLY
 Flash the window briefly to get attention.
constexpr FlashOperation SDL::FLASH_UNTIL_FOCUSED
 Flash the window until it gets focus.
constexpr HitTestResult SDL::HITTEST_NORMAL
 Region is normal. No special properties.
constexpr HitTestResult SDL::HITTEST_DRAGGABLE
 Region can drag entire window.
constexpr HitTestResult SDL::HITTEST_RESIZE_TOPLEFT
 Region is the resizable top-left corner border.
constexpr HitTestResult SDL::HITTEST_RESIZE_TOP
 Region is the resizable top border.
constexpr HitTestResult SDL::HITTEST_RESIZE_TOPRIGHT
 Region is the resizable top-right corner border.
constexpr HitTestResult SDL::HITTEST_RESIZE_RIGHT
 Region is the resizable right border.
constexpr HitTestResult SDL::HITTEST_RESIZE_BOTTOMRIGHT
 Region is the resizable bottom-right corner border.
constexpr HitTestResult SDL::HITTEST_RESIZE_BOTTOM
 Region is the resizable bottom border.
constexpr HitTestResult SDL::HITTEST_RESIZE_BOTTOMLEFT
 Region is the resizable bottom-left corner border.
constexpr HitTestResult SDL::HITTEST_RESIZE_LEFT
 Region is the resizable left border.
constexpr ProgressState SDL::PROGRESS_STATE_INVALID = SDL_PROGRESS_STATE_INVALID
 An invalid progress state indicating an error; check GetError().
constexpr ProgressState SDL::PROGRESS_STATE_NONE
 No progress bar is shown.
constexpr ProgressState SDL::PROGRESS_STATE_INDETERMINATE
 The progress bar is shown in a indeterminate state.
constexpr ProgressState SDL::PROGRESS_STATE_NORMAL
 The progress bar is shown in a normal state.
constexpr ProgressState SDL::PROGRESS_STATE_PAUSED
 The progress bar is shown in a paused state.
constexpr ProgressState SDL::PROGRESS_STATE_ERROR = SDL_PROGRESS_STATE_ERROR
 The progress bar is shown in a state indicating the application had an error.
constexpr int SDL::WINDOWPOS_UNDEFINED_MASK = SDL_WINDOWPOS_UNDEFINED_MASK
 A magic value used with WINDOWPOS_UNDEFINED.
constexpr int SDL::WINDOWPOS_UNDEFINED = SDL_WINDOWPOS_UNDEFINED
 Used to indicate that you don't care what the window position/display is.
constexpr int SDL::WINDOWPOS_CENTERED_MASK = SDL_WINDOWPOS_CENTERED_MASK
 A magic value used with WINDOWPOS_CENTERED.
constexpr int SDL::WINDOWPOS_CENTERED = SDL_WINDOWPOS_CENTERED
 Used to indicate that the window position should be centered.
constexpr GLAttr SDL::GL_RED_SIZE = SDL_GL_RED_SIZE
 the minimum number of bits for the red channel of the color buffer; defaults to 8.
constexpr GLAttr SDL::GL_GREEN_SIZE = SDL_GL_GREEN_SIZE
 the minimum number of bits for the green channel of the color buffer; defaults to 8.
constexpr GLAttr SDL::GL_BLUE_SIZE = SDL_GL_BLUE_SIZE
 the minimum number of bits for the blue channel of the color buffer; defaults to 8.
constexpr GLAttr SDL::GL_ALPHA_SIZE = SDL_GL_ALPHA_SIZE
 the minimum number of bits for the alpha channel of the color buffer; defaults to 8.
constexpr GLAttr SDL::GL_BUFFER_SIZE = SDL_GL_BUFFER_SIZE
 the minimum number of bits for frame buffer size; defaults to 0.
constexpr GLAttr SDL::GL_DOUBLEBUFFER = SDL_GL_DOUBLEBUFFER
 whether the output is single or double buffered; defaults to double buffering on.
constexpr GLAttr SDL::GL_DEPTH_SIZE = SDL_GL_DEPTH_SIZE
 the minimum number of bits in the depth buffer; defaults to 16.
constexpr GLAttr SDL::GL_STENCIL_SIZE = SDL_GL_STENCIL_SIZE
 the minimum number of bits in the stencil buffer; defaults to 0.
constexpr GLAttr SDL::GL_ACCUM_RED_SIZE = SDL_GL_ACCUM_RED_SIZE
 the minimum number of bits for the red channel of the accumulation buffer; defaults to 0.
constexpr GLAttr SDL::GL_ACCUM_GREEN_SIZE = SDL_GL_ACCUM_GREEN_SIZE
 the minimum number of bits for the green channel of the accumulation buffer; defaults to 0.
constexpr GLAttr SDL::GL_ACCUM_BLUE_SIZE = SDL_GL_ACCUM_BLUE_SIZE
 the minimum number of bits for the blue channel of the accumulation buffer; defaults to 0.
constexpr GLAttr SDL::GL_ACCUM_ALPHA_SIZE = SDL_GL_ACCUM_ALPHA_SIZE
 the minimum number of bits for the alpha channel of the accumulation buffer; defaults to 0.
constexpr GLAttr SDL::GL_STEREO
 whether the output is stereo 3D; defaults to off.
constexpr GLAttr SDL::GL_MULTISAMPLEBUFFERS = SDL_GL_MULTISAMPLEBUFFERS
 the number of buffers used for multisample anti-aliasing; defaults to 0.
constexpr GLAttr SDL::GL_MULTISAMPLESAMPLES = SDL_GL_MULTISAMPLESAMPLES
 the number of samples used around the current pixel used for multisample anti-aliasing.
constexpr GLAttr SDL::GL_ACCELERATED_VISUAL = SDL_GL_ACCELERATED_VISUAL
 set to 1 to require hardware acceleration, set to 0 to force software rendering; defaults to allow either.
constexpr GLAttr SDL::GL_RETAINED_BACKING
 not used (deprecated).
constexpr GLAttr SDL::GL_CONTEXT_MAJOR_VERSION
 OpenGL context major version.
constexpr GLAttr SDL::GL_CONTEXT_MINOR_VERSION
 OpenGL context minor version.
constexpr GLAttr SDL::GL_CONTEXT_FLAGS = SDL_GL_CONTEXT_FLAGS
 some combination of 0 or more of elements of the GLContextFlag enumeration; defaults to 0.
constexpr GLAttr SDL::GL_CONTEXT_PROFILE_MASK = SDL_GL_CONTEXT_PROFILE_MASK
 type of GL context (Core, Compatibility, ES).
constexpr GLAttr SDL::GL_SHARE_WITH_CURRENT_CONTEXT
 OpenGL context sharing; defaults to 0.
constexpr GLAttr SDL::GL_FRAMEBUFFER_SRGB_CAPABLE = SDL_GL_FRAMEBUFFER_SRGB_CAPABLE
 requests sRGB-capable visual if 1.
constexpr GLAttr SDL::GL_CONTEXT_RELEASE_BEHAVIOR = SDL_GL_CONTEXT_RELEASE_BEHAVIOR
 sets context the release behavior.
constexpr GLAttr SDL::GL_CONTEXT_RESET_NOTIFICATION
 set context reset notification.
constexpr GLAttr SDL::GL_CONTEXT_NO_ERROR
 GL_CONTEXT_NO_ERROR.
constexpr GLAttr SDL::GL_FLOATBUFFERS = SDL_GL_FLOATBUFFERS
 GL_FLOATBUFFERS.
constexpr GLAttr SDL::GL_EGL_PLATFORM = SDL_GL_EGL_PLATFORM
 GL_EGL_PLATFORM.
constexpr GLProfile SDL::GL_CONTEXT_PROFILE_CORE
 OpenGL Core Profile context.
constexpr GLProfile SDL::GL_CONTEXT_PROFILE_COMPATIBILITY
 OpenGL Compatibility Profile context.
constexpr GLProfile SDL::GL_CONTEXT_PROFILE_ES
 GLX_CONTEXT_ES2_PROFILE_BIT_EXT.
constexpr GLContextFlag SDL::GL_CONTEXT_DEBUG_FLAG
 DEBUG_FLAG.
constexpr GLContextFlag SDL::GL_CONTEXT_FORWARD_COMPATIBLE_FLAG
 FORWARD_COMPATIBLE_FLAG.
constexpr GLContextFlag SDL::GL_CONTEXT_ROBUST_ACCESS_FLAG
 ROBUST_ACCESS_FLAG.
constexpr GLContextFlag SDL::GL_CONTEXT_RESET_ISOLATION_FLAG
 RESET_ISOLATION_FLAG.
constexpr GLContextReleaseFlag SDL::GL_CONTEXT_RELEASE_BEHAVIOR_NONE
 BEHAVIOR_NONE.
constexpr GLContextReleaseFlag SDL::GL_CONTEXT_RELEASE_BEHAVIOR_FLUSH
 BEHAVIOR_FLUSH.
constexpr GLContextResetNotification SDL::GL_CONTEXT_RESET_NO_NOTIFICATION
 NO_NOTIFICATION.
constexpr GLContextResetNotification SDL::GL_CONTEXT_RESET_LOSE_CONTEXT
 LOSE_CONTEXT.
constexpr int SDL::WINDOW_SURFACE_VSYNC_DISABLED = SDL_WINDOW_SURFACE_VSYNC_DISABLED
 Constant to disable vsync.
constexpr int SDL::WINDOW_SURFACE_VSYNC_ADAPTIVE = SDL_WINDOW_SURFACE_VSYNC_ADAPTIVE
 Constant to enable adaptive vsync.

Detailed Description

SDL's video subsystem is largely interested in abstracting window management from the underlying operating system.

You can create windows, manage them in various ways, set them fullscreen, and get events when interesting things happen with them, such as the mouse or keyboard interacting with a window.

The video subsystem is also interested in abstracting away some platform-specific differences in OpenGL: context creation, swapping buffers, etc. This may be crucial to your app, but also you are not required to use OpenGL at all. In fact, SDL can provide rendering to those windows as well, either with an easy-to-use 2D API or with a more-powerful GPU API . Of course, it can simply get out of your way and give you the window handles you need to use Vulkan, Direct3D, Metal, or whatever else you like directly, too.

The video subsystem covers a lot of functionality, out of necessity, so it is worth perusing the list of functions just to see what's available, but most apps can get by with simply creating a window and listening for events, so start with CreateWindow() and PollEvent().

Typedef Documentation

◆ DisplayMode

using SDL::DisplayMode = SDL_DisplayMode

The structure that defines a display mode.

Since
This struct is available since SDL 3.2.0.
See also
Display.GetFullscreenModes
Display.GetDesktopMode
Display.GetCurrentMode
Window.SetFullscreenMode
Window.GetFullscreenMode

◆ DisplayModeData

using SDL::DisplayModeData = SDL_DisplayModeData

Internal display mode data.

This lives as a field in DisplayMode, as opaque data.

Since
This struct is available since SDL 3.2.0.
See also
DisplayMode

◆ DisplayOrientation

using SDL::DisplayOrientation = SDL_DisplayOrientation

Display orientation values; the way a display is rotated.

Since
This enum is available since SDL 3.2.0.

◆ EGLAttrib

using SDL::EGLAttrib = SDL_EGLAttrib

An EGL attribute, used when creating an EGL context.

Since
This datatype is available since SDL 3.2.0.

◆ EGLAttribArrayCallback

using SDL::EGLAttribArrayCallback = EGLAttrib*(SDLCALL*)(void* userdata)

EGL platform attribute initialization callback.

This is called when SDL is attempting to create an EGL context, to let the app add extra attributes to its eglGetPlatformDisplay() call.

The callback should return a pointer to an EGL attribute array terminated with EGL_NONE. If this function returns nullptr, the CreateWindow process will fail gracefully.

The returned pointer should be allocated with malloc() and will be passed to free().

The arrays returned by each callback will be appended to the existing attribute arrays defined by SDL.

Parameters
userdataan app-controlled pointer that is passed to the callback.
Returns
a newly-allocated array of attributes, terminated with EGL_NONE.
Since
This datatype is available since SDL 3.2.0.
See also
EGL_SetAttributeCallbacks

◆ EGLConfig

using SDL::EGLConfig = SDL_EGLConfig

Opaque type for an EGL config.

Since
This datatype is available since SDL 3.2.0.

◆ EGLDisplay

using SDL::EGLDisplay = SDL_EGLDisplay

Opaque type for an EGL display.

Since
This datatype is available since SDL 3.2.0.

◆ EGLint

using SDL::EGLint = SDL_EGLint

An EGL integer attribute, used when creating an EGL surface.

Since
This datatype is available since SDL 3.2.0.

◆ EGLIntArrayCallback

Initial value:
EGLint*(SDLCALL*)(void* userdata,
EGLDisplay display,
EGLConfig config)
SDL_EGLint EGLint
An EGL integer attribute, used when creating an EGL surface.
Definition SDL3pp_video.h:3314
SDL_EGLConfig EGLConfig
Opaque type for an EGL config.
Definition SDL3pp_video.h:3300
SDL_EGLDisplay EGLDisplay
Opaque type for an EGL display.
Definition SDL3pp_video.h:3293

EGL surface/context attribute initialization callback types.

This is called when SDL is attempting to create an EGL surface, to let the app add extra attributes to its eglCreateWindowSurface() or eglCreateContext calls.

For convenience, the EGLDisplay and EGLConfig to use are provided to the callback.

The callback should return a pointer to an EGL attribute array terminated with EGL_NONE. If this function returns nullptr, the CreateWindow process will fail gracefully.

The returned pointer should be allocated with malloc() and will be passed to free().

The arrays returned by each callback will be appended to the existing attribute arrays defined by SDL.

Parameters
userdataan app-controlled pointer that is passed to the callback.
displaythe EGL display to be used.
configthe EGL config to be used.
Returns
a newly-allocated array of attributes, terminated with EGL_NONE.
Since
This datatype is available since SDL 3.2.0.
See also
EGL_SetAttributeCallbacks

◆ EGLSurface

using SDL::EGLSurface = SDL_EGLSurface

Opaque type for an EGL surface.

Since
This datatype is available since SDL 3.2.0.

◆ FlashOperation

using SDL::FlashOperation = SDL_FlashOperation

Window flash operation.

Since
This enum is available since SDL 3.2.0.

◆ GLAttr

using SDL::GLAttr = SDL_GLAttr

An enumeration of OpenGL configuration attributes.

While you can set most OpenGL attributes normally, the attributes listed above must be known before SDL creates the window that will be used with the OpenGL context. These attributes are set and read with GL_SetAttribute() and GL_GetAttribute().

In some cases, these attributes are minimum requests; the GL does not promise to give you exactly what you asked for. It's possible to ask for a 16-bit depth buffer and get a 24-bit one instead, for example, or to ask for no stencil buffer and still have one available. Context creation should fail if the GL can't provide your requested attributes at a minimum, but you should check to see exactly what you got.

Since
This enum is available since SDL 3.2.0.

◆ GLContextFlag

Possible flags to be set for the GL_CONTEXT_FLAGS attribute.

Since
This datatype is available since SDL 3.2.0.

◆ GLContextReleaseFlag

Possible values to be set for the GL_CONTEXT_RELEASE_BEHAVIOR attribute.

Since
This datatype is available since SDL 3.2.0.

◆ GLContextResetNotification

Possible values to be set GL_CONTEXT_RESET_NOTIFICATION attribute.

Since
This datatype is available since SDL 3.2.0.

◆ GLProfile

Possible values to be set for the GL_CONTEXT_PROFILE_MASK attribute.

Since
This datatype is available since SDL 3.2.0.

◆ HitTest

using SDL::HitTest
Initial value:
HitTestResult(SDLCALL*)(WindowRaw win,
const PointRaw* area,
void* data)
SDL_Point PointRaw
Alias to raw representation for Point.
Definition SDL3pp_rect.h:22
SDL_Window * WindowRaw
Alias to raw representation for Window.
Definition SDL3pp_video.h:47
SDL_HitTestResult HitTestResult
Possible return values from the HitTest callback.
Definition SDL3pp_video.h:633

Callback used for hit-testing.

Parameters
winthe Window where hit-testing was set on.
areaan Point which should be hit-tested.
datawhat was passed as callback_data to Window.SetHitTest().
Returns
an HitTestResult value.
See also
Window.SetHitTest

◆ HitTestCB

Initial value:
Definition SDL3pp_callbackWrapper.h:197

Callback used for hit-testing.

Parameters
winthe Window where hit-testing was set on.
areaan Point which should be hit-tested.
Returns
an HitTestResult value.
Category:
Listener callback
See also
Window.SetHitTest
HitTest

◆ HitTestResult

using SDL::HitTestResult = SDL_HitTestResult

Possible return values from the HitTest callback.

Thread safety:
This function should only be called on the main thread.
Since
This enum is available since SDL 3.2.0.
See also
HitTest
HitTestCB

◆ ProgressState

using SDL::ProgressState = SDL_ProgressState

Window progress state.

Since
This enum is available since SDL 3.2.8.

◆ RendererRef

Reference for Renderer.

This does not take ownership!

◆ SystemTheme

using SDL::SystemTheme = SDL_SystemTheme

System theme.

Since
This enum is available since SDL 3.2.0.

◆ WindowFlags

The flags on a window.

These cover a lot of true/false, or on/off, window state. Some of it is immutable after being set through CreateWindow(), some of it can be changed on existing windows by the app, and some of it might be altered by the user or system outside of the app's control.

When creating windows with WINDOW_RESIZABLE, SDL will constrain resizable windows to the dimensions recommended by the compositor to fit it within the usable desktop space, although some compositors will do this automatically without intervention as well. Use Window.SetResizable after creation instead if you wish to create a window with a specific size.

Since
This datatype is available since SDL 3.2.0.
See also
Window.GetFlags

◆ WindowID

using SDL::WindowID = SDL_WindowID

This is a unique ID for a window.

The value 0 is an invalid ID.

Since
This datatype is available since SDL 3.2.0.

◆ WindowRef

Reference for Window.

This does not take ownership!

Function Documentation

◆ CreateGLContext()

GLContext SDL::Window::CreateGLContext ( )
inline

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

The OpenGL context will be created with the current states set through GL_SetAttribute().

The Window specified must have been created with the WINDOW_OPENGL flag, or context creation will fail.

Windows users new to OpenGL should note that, for historical reasons, GL functions added after OpenGL version 1.1 are not available by default. Those functions must be loaded at run-time, either with an OpenGL extension-handling library or with GL_GetProcAddress() and its related functions.

GLContext is opaque to the application.

Returns
the OpenGL context associated with window or nullptr on failure; call GetError() for more information.
Thread safety:
This function should only be called on the main thread.
Since
This function is available since SDL 3.2.0.
See also
GLContext.Destroy
GLContext.MakeCurrent

◆ CreatePopupWindow()

Window SDL::CreatePopupWindow ( WindowRef parent,
const PointRaw & offset,
const PointRaw & size,
WindowFlags flags )
inline

Create a child popup window of the specified parent window.

The window size is a request and may be different than expected based on the desktop layout and window manager policies. Your application should be prepared to handle a window of any size.

The flags parameter must contain at least one of the following:

  • WINDOW_TOOLTIP: The popup window is a tooltip and will not pass any input events.
  • WINDOW_POPUP_MENU: The popup window is a popup menu. The topmost popup menu will implicitly gain the keyboard focus.

The following flags are not relevant to popup window creation and will be ignored:

The following flags are incompatible with popup window creation and will cause it to fail:

The parent parameter must be non-null and a valid window. The parent of a popup window can be either a regular, toplevel window, or another popup window.

Popup windows cannot be minimized, maximized, made fullscreen, raised, flash, be made a modal window, be the parent of a toplevel window, or grab the mouse and/or keyboard. Attempts to do so will fail.

Popup windows implicitly do not have a border/decorations and do not appear on the taskbar/dock or in lists of windows such as alt-tab menus.

By default, popup window positions will automatically be constrained to keep the entire window within display bounds. This can be overridden with the prop.Window.Create.CONSTRAIN_POPUP_BOOLEAN property.

By default, popup menus will automatically grab keyboard focus from the parent when shown. This behavior can be overridden by setting the WINDOW_NOT_FOCUSABLE flag, setting the prop.Window.Create.FOCUSABLE_BOOLEAN property to false, or toggling it after creation via the Window.SetFocusable() function.

If a parent window is hidden or destroyed, any child popup windows will be recursively hidden or destroyed as well. Child popup windows not explicitly hidden will be restored when the parent is shown.

Parameters
parentthe parent of the window, must not be nullptr.
offsetthe x, y position of the popup window relative to the origin of the parent.
sizethe width and height of the window.
flagsWINDOW_TOOLTIP or WINDOW_POPUP_MENU, and zero or more additional WindowFlags OR'd together.
Returns
the window that was created or nullptr on failure; call GetError() for more information.
Thread safety:
This function should only be called on the main thread.
Since
This function is available since SDL 3.2.0.
See also
CreateWindow
CreateWindowWithProperties
Window.Destroy
Window.GetParent

◆ CreateWindow()

Window SDL::CreateWindow ( StringParam title,
const PointRaw & size,
WindowFlags flags )
inline

Create a window with the specified dimensions and flags.

The window size is a request and may be different than expected based on the desktop layout and window manager policies. Your application should be prepared to handle a window of any size.

flags may be any of the following OR'd together:

The Window will be shown if WINDOW_HIDDEN is not set. If hidden at creation time, Window.Show() can be used to show it later.

On Apple's macOS, you must set the NSHighResolutionCapable Info.plist property to YES, otherwise you will not receive a High-DPI OpenGL canvas.

The window pixel size may differ from its window coordinate size if the window is on a high pixel density display. Use Window.GetSize() to query the client area's size in window coordinates, and Window.GetSizeInPixels() or Renderer.GetOutputSize() to query the drawable size in pixels. Note that the drawable size can vary after the window is created and should be queried again if you get an EVENT_WINDOW_PIXEL_SIZE_CHANGED event.

If the window is created with any of the WINDOW_OPENGL or WINDOW_VULKAN flags, then the corresponding LoadLibrary function (GL_LoadLibrary or Vulkan_LoadLibrary) is called and the corresponding UnloadLibrary function is called by Window.Destroy().

If WINDOW_VULKAN is specified and there isn't a working Vulkan driver, CreateWindow() will fail, because Vulkan_LoadLibrary() will fail.

If WINDOW_METAL is specified on an OS that does not support Metal, CreateWindow() will fail.

If you intend to use this window with an Renderer, you should use CreateWindowAndRenderer() instead of this function, to avoid window flicker.

On non-Apple devices, SDL requires you to either not link to the Vulkan loader or link to a dynamic library version. This limitation may be removed in a future version of SDL.

Parameters
titlethe title of the window, in UTF-8 encoding.
sizethe width and height of the window.
flags0, or one or more WindowFlags OR'd together.
Returns
the window that was created or nullptr on failure; call GetError() for more information.
Thread safety:
This function should only be called on the main thread.
Since
This function is available since SDL 3.2.0.
See also
CreateWindowAndRenderer
CreatePopupWindow
CreateWindowWithProperties
Window.Destroy

◆ CreateWindowWithProperties()

Window SDL::CreateWindowWithProperties ( PropertiesRef props)
inline

Create a window with the specified properties.

The window size is a request and may be different than expected based on the desktop layout and window manager policies. Your application should be prepared to handle a window of any size.

These are the supported properties:

These are additional supported properties on macOS:

These are additional supported properties on iOS, tvOS, and visionOS:

These are additional supported properties on Wayland:

These are additional supported properties on Windows:

These are additional supported properties with X11:

The window is implicitly shown if the "hidden" property is not set.

These are additional supported properties with Emscripten:

  • prop.Window.Create.EMSCRIPTEN_CANVAS_ID_STRING: the id given to the canvas element. This should start with a '#' sign
  • prop.Window.Create.EMSCRIPTEN_KEYBOARD_ELEMENT_STRING: override the binding element for keyboard inputs for this canvas. The variable can be one of:
  • "#window": the javascript window object (default)
  • "#document": the javascript document object
  • "#screen": the javascript window.screen object
  • "#canvas": the WebGL canvas element
  • "#none": Don't bind anything at all
  • any other string without a leading # sign applies to the element on the page with that ID. Windows with the "tooltip" and "menu" properties are popup windows and have the behaviors and guidelines outlined in CreatePopupWindow().

If this window is being created to be used with an Renderer, you should not add a graphics API specific property (prop.Window.Create.OPENGL_BOOLEAN, etc), as SDL will handle that internally when it chooses a renderer. However, SDL might need to recreate your window at that point, which may cause the window to appear briefly, and then flicker as it is recreated. The correct approach to this is to create the window with the prop.Window.Create.HIDDEN_BOOLEAN property set to true, then create the renderer, then show the window with Window.Show().

Parameters
propsthe properties to use.
Returns
the window that was created or nullptr on failure; call GetError() for more information.
Thread safety:
This function should only be called on the main thread.
Since
This function is available since SDL 3.2.0.
See also
Properties.Create
CreateWindow
Window.Destroy

◆ Destroy() [1/2]

void SDL::GLContext::Destroy ( )
inline

Delete an OpenGL context.

Thread safety:
This function should only be called on the main thread.
Since
This function is available since SDL 3.2.0.
See also
Window.CreateGLContext

◆ Destroy() [2/2]

void SDL::Window::Destroy ( )
inline

Destroy a window.

Any child windows owned by the window will be recursively destroyed as well.

Note that on some platforms, the visible window may not actually be removed from the screen until the SDL event loop is pumped again, even though the Window is no longer valid after this call.

Thread safety:
This function should only be called on the main thread.
Since
This function is available since SDL 3.2.0.
See also
CreatePopupWindow
CreateWindow
CreateWindowWithProperties

◆ DestroySurface()

void SDL::Window::DestroySurface ( )
inline

Destroy the surface associated with the window.

Exceptions
Erroron failure.
Thread safety:
This function should only be called on the main thread.
Since
This function is available since SDL 3.2.0.
See also
Window.GetSurface
Window.HasSurface

◆ DestroyWindow()

void SDL::DestroyWindow ( WindowRaw window)
inline

Destroy a window.

Any child windows owned by the window will be recursively destroyed as well.

Note that on some platforms, the visible window may not actually be removed from the screen until the SDL event loop is pumped again, even though the Window is no longer valid after this call.

Parameters
windowthe window to destroy.
Thread safety:
This function should only be called on the main thread.
Since
This function is available since SDL 3.2.0.
See also
CreatePopupWindow
CreateWindow
CreateWindowWithProperties

◆ DestroyWindowSurface()

void SDL::DestroyWindowSurface ( WindowRef window)
inline

Destroy the surface associated with the window.

Parameters
windowthe window to update.
Exceptions
Erroron failure.
Thread safety:
This function should only be called on the main thread.
Since
This function is available since SDL 3.2.0.
See also
Window.GetSurface
Window.HasSurface

◆ DisableScreenSaver()

void SDL::DisableScreenSaver ( )
inline

Prevent the screen from being blanked by a screen saver.

If you disable the screensaver, it is automatically re-enabled when SDL quits.

The screensaver is disabled by default, but this may by changed by SDL_HINT_VIDEO_ALLOW_SCREENSAVER.

Exceptions
Erroron failure.
Thread safety:
This function should only be called on the main thread.
Since
This function is available since SDL 3.2.0.
See also
EnableScreenSaver
ScreenSaverEnabled

◆ EGL_GetCurrentConfig()

EGLConfig SDL::EGL_GetCurrentConfig ( )
inline

Get the currently active EGL config.

Returns
the currently active EGL config or nullptr on failure; call GetError() for more information.
Thread safety:
This function should only be called on the main thread.
Since
This function is available since SDL 3.2.0.

◆ EGL_GetCurrentDisplay()

EGLDisplay SDL::EGL_GetCurrentDisplay ( )
inline

Get the currently active EGL display.

Returns
the currently active EGL display or nullptr on failure; call GetError() for more information.
Thread safety:
This function should only be called on the main thread.
Since
This function is available since SDL 3.2.0.

◆ EGL_GetProcAddress()

FunctionPointer SDL::EGL_GetProcAddress ( StringParam proc)
inline

Get an EGL library function by name.

If an EGL library is loaded, this function allows applications to get entry points for EGL functions. This is useful to provide to an EGL API and extension loader.

Parameters
procthe name of an EGL function.
Returns
a pointer to the named EGL function. The returned pointer should be cast to the appropriate function signature.
Thread safety:
This function should only be called on the main thread.
Since
This function is available since SDL 3.2.0.
See also
EGL_GetCurrentDisplay

◆ EGL_GetWindowSurface()

EGLSurface SDL::EGL_GetWindowSurface ( WindowRef window)
inline

Get the EGL surface associated with the window.

Parameters
windowthe window to query.
Returns
the EGLSurface pointer associated with the window, or nullptr on failure.
Thread safety:
This function should only be called on the main thread.
Since
This function is available since SDL 3.2.0.

◆ EGL_SetAttributeCallbacks()

void SDL::EGL_SetAttributeCallbacks ( EGLAttribArrayCallback platformAttribCallback,
EGLIntArrayCallback surfaceAttribCallback,
EGLIntArrayCallback contextAttribCallback,
void * userdata )
inline

Sets the callbacks for defining custom EGLAttrib arrays for EGL initialization.

Callbacks that aren't needed can be set to nullptr.

NOTE: These callback pointers will be reset after GL_ResetAttributes.

Parameters
platformAttribCallbackcallback for attributes to pass to eglGetPlatformDisplay. May be nullptr.
surfaceAttribCallbackcallback for attributes to pass to eglCreateSurface. May be nullptr.
contextAttribCallbackcallback for attributes to pass to eglCreateContext. May be nullptr.
userdataa pointer that is passed to the callbacks.
Thread safety:
This function should only be called on the main thread.
Since
This function is available since SDL 3.2.0.

◆ EnableScreenSaver()

void SDL::EnableScreenSaver ( )
inline

Allow the screen to be blanked by a screen saver.

Exceptions
Erroron failure.
Thread safety:
This function should only be called on the main thread.
Since
This function is available since SDL 3.2.0.
See also
DisableScreenSaver
ScreenSaverEnabled

◆ Flash()

void SDL::Window::Flash ( FlashOperation operation)
inline

Request a window to demand attention from the user.

Parameters
operationthe operation to perform.
Exceptions
Erroron failure.
Thread safety:
This function should only be called on the main thread.
Since
This function is available since SDL 3.2.0.

◆ FlashWindow()

void SDL::FlashWindow ( WindowRef window,
FlashOperation operation )
inline

Request a window to demand attention from the user.

Parameters
windowthe window to be flashed.
operationthe operation to perform.
Exceptions
Erroron failure.
Thread safety:
This function should only be called on the main thread.
Since
This function is available since SDL 3.2.0.

◆ FromID()

WindowRef SDL::Window::FromID ( WindowID id)
inlinestatic

Get a window from a stored ID.

The numeric ID is what WindowEvent references, and is necessary to map these events to specific Window objects.

Parameters
idthe ID of the window.
Returns
the window associated with id or nullptr if it doesn't exist; call GetError() for more information.
Thread safety:
This function should only be called on the main thread.
Since
This function is available since SDL 3.2.0.
See also
Window.GetID

◆ GetAspectRatio()

void SDL::Window::GetAspectRatio ( float * min_aspect,
float * max_aspect ) const
inline

Get the aspect ratio of a window's client area.

Parameters
min_aspecta pointer filled in with the minimum aspect ratio of the window, may be nullptr.
max_aspecta pointer filled in with the maximum aspect ratio of the window, may be nullptr.
Exceptions
Erroron failure.
Thread safety:
This function should only be called on the main thread.
Since
This function is available since SDL 3.2.0.
See also
Window.SetAspectRatio

◆ GetBordersSize()

void SDL::Window::GetBordersSize ( int * top,
int * left,
int * bottom,
int * right ) const
inline

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

Note: If this function fails (returns false), the size values will be initialized to 0, 0, 0, 0 (if a non-nullptr pointer is provided), as if the window in question was borderless.

Note: This function may fail on systems where the window has not yet been decorated by the display server (for example, immediately after calling CreateWindow). It is recommended that you wait at least until the window has been presented and composited, so that the window system has a chance to decorate the window and provide the border dimensions to SDL.

This function also returns false if getting the information is not supported.

Parameters
toppointer to variable for storing the size of the top border; nullptr is permitted.
leftpointer to variable for storing the size of the left border; nullptr is permitted.
bottompointer to variable for storing the size of the bottom border; nullptr is permitted.
rightpointer to variable for storing the size of the right border; nullptr is permitted.
Exceptions
Erroron failure.
Thread safety:
This function should only be called on the main thread.
Since
This function is available since SDL 3.2.0.
See also
Window.GetSize

◆ GetBounds()

Rect SDL::Display::GetBounds ( ) const
inline

Get the desktop area represented by a display.

The primary display is often located at (0,0), but may be placed at a different location depending on monitor layout.

Returns
the Rect structure filled in with the display bounds.
Exceptions
Erroron failure.
Thread safety:
This function should only be called on the main thread.
Since
This function is available since SDL 3.2.0.
See also
Display.GetUsableBounds
GetDisplays

◆ GetClosestFullscreenDisplayMode()

DisplayMode SDL::GetClosestFullscreenDisplayMode ( Display displayID,
const PointRaw & size,
float refresh_rate,
bool include_high_density_modes )
inline

Get the closest match to the requested display mode.

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 set to 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 false is returned.

Parameters
displayIDthe instance ID of the display to query.
sizethe width and height in pixels of the desired display mode.
refresh_ratethe refresh rate of the desired display mode, or 0.0f for the desktop refresh rate.
include_high_density_modesboolean to include high density modes in the search.
Returns
the closest display mode equal to or larger than the desired mode.
Exceptions
Erroron failure.
Thread safety:
This function should only be called on the main thread.
Since
This function is available since SDL 3.2.0.
See also
GetDisplays
Display.GetFullscreenModes

◆ GetClosestFullscreenMode()

DisplayMode SDL::Display::GetClosestFullscreenMode ( const PointRaw & size,
float refresh_rate,
bool include_high_density_modes ) const
inline

Get the closest match to the requested display mode.

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 set to 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 false is returned.

Parameters
sizethe width and height in pixels of the desired display mode.
refresh_ratethe refresh rate of the desired display mode, or 0.0f for the desktop refresh rate.
include_high_density_modesboolean to include high density modes in the search.
Returns
the closest display mode equal to or larger than the desired mode.
Exceptions
Erroron failure.
Thread safety:
This function should only be called on the main thread.
Since
This function is available since SDL 3.2.0.
See also
GetDisplays
Display.GetFullscreenModes

◆ GetContentScale()

float SDL::Display::GetContentScale ( ) const
inline

Get the content scale of a display.

The content scale is the expected scale for content based on the DPI settings of the display. For example, a 4K display might have a 2.0 (200%) display scale, which means that the user expects UI elements to be twice as big on this display, to aid in readability.

After window creation, Window.GetDisplayScale() should be used to query the content scale factor for individual windows instead of querying the display for a window and calling this function, as the per-window content scale factor may differ from the base value of the display it is on, particularly on high-DPI and/or multi-monitor desktop configurations.

Returns
the content scale of the display, or 0.0f on failure; call GetError() for more information.
Thread safety:
This function should only be called on the main thread.
Since
This function is available since SDL 3.2.0.
See also
Window.GetDisplayScale
GetDisplays

◆ GetCurrentDisplayMode()

const DisplayMode & SDL::GetCurrentDisplayMode ( DisplayID displayID)
inline

Get information about the current display mode.

There's a difference between this function and Display.GetDesktopMode() when SDL runs fullscreen and has changed the resolution. In that case this function will return the current display mode, and not the previous native display mode.

Parameters
displayIDthe instance ID of the display to query.
Returns
a pointer to the desktop display mode or nullptr on failure; call GetError() for more information.
Thread safety:
This function should only be called on the main thread.
Since
This function is available since SDL 3.2.0.
See also
Display.GetDesktopMode
GetDisplays

◆ GetCurrentDisplayOrientation()

DisplayOrientation SDL::GetCurrentDisplayOrientation ( DisplayID displayID)
inline

Get the orientation of a display.

Parameters
displayIDthe instance ID of the display to query.
Returns
the DisplayOrientation enum value of the display, or ORIENTATION_UNKNOWN if it isn't available.
Thread safety:
This function should only be called on the main thread.
Since
This function is available since SDL 3.2.0.
See also
GetDisplays

◆ GetCurrentMode()

const DisplayMode & SDL::Display::GetCurrentMode ( ) const
inline

Get information about the current display mode.

There's a difference between this function and Display.GetDesktopMode() when SDL runs fullscreen and has changed the resolution. In that case this function will return the current display mode, and not the previous native display mode.

Returns
a pointer to the desktop display mode or nullptr on failure; call GetError() for more information.
Thread safety:
This function should only be called on the main thread.
Since
This function is available since SDL 3.2.0.
See also
Display.GetDesktopMode
GetDisplays

◆ GetCurrentOrientation()

DisplayOrientation SDL::Display::GetCurrentOrientation ( ) const
inline

Get the orientation of a display.

Returns
the DisplayOrientation enum value of the display, or ORIENTATION_UNKNOWN if it isn't available.
Thread safety:
This function should only be called on the main thread.
Since
This function is available since SDL 3.2.0.
See also
GetDisplays

◆ GetCurrentVideoDriver()

const char * SDL::GetCurrentVideoDriver ( )
inline

Get the name of the currently initialized video driver.

The names of drivers are all simple, low-ASCII identifiers, like "cocoa", "x11" or "windows". These never have Unicode characters, and are not meant to be proper names.

Returns
the name of the current video driver or nullptr if no driver has been initialized.
Thread safety:
This function should only be called on the main thread.
Since
This function is available since SDL 3.2.0.
See also
GetNumVideoDrivers
GetVideoDriver

◆ GetDesktopDisplayMode()

const DisplayMode & SDL::GetDesktopDisplayMode ( DisplayID displayID)
inline

Get information about the desktop's display mode.

There's a difference between this function and Display.GetCurrentMode() when SDL runs fullscreen and has changed the resolution. In that case this function will return the previous native display mode, and not the current display mode.

Parameters
displayIDthe instance ID of the display to query.
Returns
a pointer to the desktop display mode or nullptr on failure; call GetError() for more information.
Thread safety:
This function should only be called on the main thread.
Since
This function is available since SDL 3.2.0.
See also
Display.GetCurrentMode
GetDisplays

◆ GetDesktopMode()

const DisplayMode & SDL::Display::GetDesktopMode ( ) const
inline

Get information about the desktop's display mode.

There's a difference between this function and Display.GetCurrentMode() when SDL runs fullscreen and has changed the resolution. In that case this function will return the previous native display mode, and not the current display mode.

Returns
a pointer to the desktop display mode or nullptr on failure; call GetError() for more information.
Thread safety:
This function should only be called on the main thread.
Since
This function is available since SDL 3.2.0.
See also
Display.GetCurrentMode
GetDisplays

◆ GetDisplay()

Display SDL::Window::GetDisplay ( ) const
inline

Get the display associated with a window.

Returns
the instance ID of the display containing the center of the window on success.
Exceptions
Erroron failure.
Thread safety:
This function should only be called on the main thread.
Since
This function is available since SDL 3.2.0.
See also
Display.GetBounds
GetDisplays

◆ GetDisplayBounds()

Rect SDL::GetDisplayBounds ( Display displayID)
inline

Get the desktop area represented by a display.

The primary display is often located at (0,0), but may be placed at a different location depending on monitor layout.

Parameters
displayIDthe instance ID of the display to query.
Returns
the Rect structure filled in with the display bounds.
Exceptions
Erroron failure.
Thread safety:
This function should only be called on the main thread.
Since
This function is available since SDL 3.2.0.
See also
Display.GetUsableBounds
GetDisplays

◆ GetDisplayContentScale()

float SDL::GetDisplayContentScale ( DisplayID displayID)
inline

Get the content scale of a display.

The content scale is the expected scale for content based on the DPI settings of the display. For example, a 4K display might have a 2.0 (200%) display scale, which means that the user expects UI elements to be twice as big on this display, to aid in readability.

After window creation, Window.GetDisplayScale() should be used to query the content scale factor for individual windows instead of querying the display for a window and calling this function, as the per-window content scale factor may differ from the base value of the display it is on, particularly on high-DPI and/or multi-monitor desktop configurations.

Parameters
displayIDthe instance ID of the display to query.
Returns
the content scale of the display, or 0.0f on failure; call GetError() for more information.
Thread safety:
This function should only be called on the main thread.
Since
This function is available since SDL 3.2.0.
See also
Window.GetDisplayScale
GetDisplays

◆ GetDisplayForPoint()

Display SDL::GetDisplayForPoint ( const PointRaw & point)
inline

Get the display containing a point.

Parameters
pointthe point to query.
Returns
the instance ID of the display containing the point or 0 on failure; call GetError() for more information.
Thread safety:
This function should only be called on the main thread.
Since
This function is available since SDL 3.2.0.
See also
Display.GetBounds
GetDisplays

◆ GetDisplayForRect()

Display SDL::GetDisplayForRect ( const RectRaw & rect)
inline

Get the display primarily containing a rect.

Parameters
rectthe rect to query.
Returns
the instance ID of the display entirely containing the rect or closest to the center of the rect on success.
Exceptions
Erroron failure.
Thread safety:
This function should only be called on the main thread.
Since
This function is available since SDL 3.2.0.
See also
Display.GetBounds
GetDisplays

◆ GetDisplayForWindow()

Display SDL::GetDisplayForWindow ( WindowRef window)
inline

Get the display associated with a window.

Parameters
windowthe window to query.
Returns
the instance ID of the display containing the center of the window on success.
Exceptions
Erroron failure.
Thread safety:
This function should only be called on the main thread.
Since
This function is available since SDL 3.2.0.
See also
Display.GetBounds
GetDisplays

◆ GetDisplayName()

const char * SDL::GetDisplayName ( DisplayID displayID)
inline

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

Parameters
displayIDthe instance ID of the display to query.
Returns
the name of a display or nullptr on failure; call GetError() for more information.
Thread safety:
This function should only be called on the main thread.
Since
This function is available since SDL 3.2.0.
See also
GetDisplays

◆ GetDisplayProperties()

PropertiesRef SDL::GetDisplayProperties ( DisplayID displayID)
inline

Get the properties associated with a display.

The following read-only properties are provided by SDL:

  • prop.Display.HDR_ENABLED_BOOLEAN: true if the display has HDR headroom above the SDR white point. This is for informational and diagnostic purposes only, as not all platforms provide this information at the display level.

On KMS/DRM:

  • prop.Display.KMSDRM_PANEL_ORIENTATION_NUMBER: the "panel orientation" property for the display in degrees of clockwise rotation. Note that this is provided only as a hint, and the application is responsible for any coordinate transformations needed to conform to the requested display orientation.

On Wayland:

On Windows:

Parameters
displayIDthe instance ID of the display to query.
Returns
a valid property ID on success.
Exceptions
Erroron failure.
Thread safety:
This function should only be called on the main thread.
Since
This function is available since SDL 3.2.0.

◆ GetDisplays()

OwnArray< DisplayID > SDL::GetDisplays ( )
inline

Get a list of currently connected displays.

Returns
a 0 terminated array of display instance IDs or nullptr on failure; call GetError() for more information.
Thread safety:
This function should only be called on the main thread.
Since
This function is available since SDL 3.2.0.

◆ GetDisplayScale()

float SDL::Window::GetDisplayScale ( ) const
inline

Get the content display scale relative to a window's pixel size.

This is a combination of the window pixel density and the display content scale, and is the expected scale for displaying content in this window. For example, if a 3840x2160 window had a display scale of 2.0, the user expects the content to take twice as many pixels and be the same physical size as if it were being displayed in a 1920x1080 window with a display scale of 1.0.

Conceptually this value corresponds to the scale display setting, and is updated when that setting is changed, or the window moves to a display with a different scale setting.

Returns
the display scale, or 0.0f on failure; call GetError() for more information.
Thread safety:
This function should only be called on the main thread.
Since
This function is available since SDL 3.2.0.

◆ GetDisplayUsableBounds()

Rect SDL::GetDisplayUsableBounds ( Display displayID)
inline

Get the usable desktop area represented by a display, in screen coordinates.

This is the same area as Display.GetBounds() reports, but with portions reserved by the system removed. For example, on Apple's macOS, this subtracts the area occupied by the menu bar and dock.

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

Parameters
displayIDthe instance ID of the display to query.
Returns
the Rect structure filled in with the display bounds.
Exceptions
Erroron failure.
Thread safety:
This function should only be called on the main thread.
Since
This function is available since SDL 3.2.0.
See also
Display.GetBounds
GetDisplays

◆ GetEGLSurface()

EGLSurface SDL::Window::GetEGLSurface ( )
inline

Get the EGL surface associated with the window.

Returns
the EGLSurface pointer associated with the window, or nullptr on failure.
Thread safety:
This function should only be called on the main thread.
Since
This function is available since SDL 3.2.0.

◆ GetFlags()

WindowFlags SDL::Window::GetFlags ( ) const
inline

Get the window flags.

Returns
a mask of the WindowFlags associated with window.
Thread safety:
This function should only be called on the main thread.
Since
This function is available since SDL 3.2.0.
See also
CreateWindow
Window.Hide
Window.Maximize
Window.Minimize
Window.SetFullscreen
Window.SetMouseGrab
Window.SetFillDocument
Window.Show

◆ GetForPoint()

Display SDL::Display::GetForPoint ( const PointRaw & point)
inlinestatic

Get the display containing a point.

Parameters
pointthe point to query.
Returns
the instance ID of the display containing the point or 0 on failure; call GetError() for more information.
Thread safety:
This function should only be called on the main thread.
Since
This function is available since SDL 3.2.0.
See also
Display.GetBounds
GetDisplays

◆ GetForRect()

Display SDL::Display::GetForRect ( const RectRaw & rect)
inlinestatic

Get the display primarily containing a rect.

Parameters
rectthe rect to query.
Returns
the instance ID of the display entirely containing the rect or closest to the center of the rect on success.
Exceptions
Erroron failure.
Thread safety:
This function should only be called on the main thread.
Since
This function is available since SDL 3.2.0.
See also
Display.GetBounds
GetDisplays

◆ GetFullscreenDisplayModes()

OwnArray< DisplayMode * > SDL::GetFullscreenDisplayModes ( Display displayID)
inline

Get a list of fullscreen display modes available on a display.

The display modes are sorted in this priority:

  • w -> largest to smallest
  • h -> largest to smallest
  • bits per pixel -> more colors to fewer colors
  • packed pixel layout -> largest to smallest
  • refresh rate -> highest to lowest
  • pixel density -> lowest to highest
Parameters
displayIDthe instance ID of the display to query.
Returns
a nullptr terminated array of display mode pointers or nullptr on failure; call GetError() for more information.
Thread safety:
This function should only be called on the main thread.
Since
This function is available since SDL 3.2.0.
See also
GetDisplays

◆ GetFullscreenMode()

const DisplayMode & SDL::Window::GetFullscreenMode ( ) const
inline

Query the display mode to use when a window is visible at fullscreen.

Returns
a pointer to the exclusive fullscreen mode to use or nullptr for borderless fullscreen desktop mode.
Thread safety:
This function should only be called on the main thread.
Since
This function is available since SDL 3.2.0.
See also
Window.SetFullscreenMode
Window.SetFullscreen

◆ GetFullscreenModes()

OwnArray< DisplayMode * > SDL::Display::GetFullscreenModes ( ) const
inline

Get a list of fullscreen display modes available on a display.

The display modes are sorted in this priority:

  • w -> largest to smallest
  • h -> largest to smallest
  • bits per pixel -> more colors to fewer colors
  • packed pixel layout -> largest to smallest
  • refresh rate -> highest to lowest
  • pixel density -> lowest to highest
Returns
a nullptr terminated array of display mode pointers or nullptr on failure; call GetError() for more information.
Thread safety:
This function should only be called on the main thread.
Since
This function is available since SDL 3.2.0.
See also
GetDisplays

◆ GetGrabbed()

WindowRef SDL::Window::GetGrabbed ( )
inlinestatic

Get the window that currently has an input grab enabled.

Returns
the window if input is grabbed or nullptr otherwise.
Thread safety:
This function should only be called on the main thread.
Since
This function is available since SDL 3.2.0.
See also
Window.SetMouseGrab
Window.SetKeyboardGrab

◆ GetGrabbedWindow()

WindowRef SDL::GetGrabbedWindow ( )
inline

Get the window that currently has an input grab enabled.

Returns
the window if input is grabbed or nullptr otherwise.
Thread safety:
This function should only be called on the main thread.
Since
This function is available since SDL 3.2.0.
See also
Window.SetMouseGrab
Window.SetKeyboardGrab

◆ GetICCProfile()

OwnPtr< void > SDL::Window::GetICCProfile ( ) const
inline

Get the raw ICC profile data for the screen the window is currently on.

Returns
the raw ICC profile data on success.
Exceptions
Erroron failure.
Thread safety:
This function should only be called on the main thread.
Since
This function is available since SDL 3.2.0.

◆ GetID()

WindowID SDL::Window::GetID ( ) const
inline

Get the numeric ID of a window.

The numeric ID is what WindowEvent references, and is necessary to map these events to specific Window objects.

Returns
the ID of the window on success.
Exceptions
Erroron failure.
Thread safety:
This function should only be called on the main thread.
Since
This function is available since SDL 3.2.0.
See also
Window.FromID

◆ GetKeyboardGrab()

bool SDL::Window::GetKeyboardGrab ( ) const
inline

Get a window's keyboard grab mode.

Returns
true if keyboard is grabbed, and false otherwise.
Thread safety:
This function should only be called on the main thread.
Since
This function is available since SDL 3.2.0.
See also
Window.SetKeyboardGrab

◆ GetMaximumSize()

void SDL::Window::GetMaximumSize ( int * w,
int * h ) const
inline

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

Parameters
wa pointer filled in with the maximum width of the window, may be nullptr.
ha pointer filled in with the maximum height of the window, may be nullptr.
Exceptions
Erroron failure.
Thread safety:
This function should only be called on the main thread.
Since
This function is available since SDL 3.2.0.
See also
Window.GetMinimumSize
Window.SetMaximumSize

◆ GetMinimumSize()

void SDL::Window::GetMinimumSize ( int * w,
int * h ) const
inline

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

Parameters
wa pointer filled in with the minimum width of the window, may be nullptr.
ha pointer filled in with the minimum height of the window, may be nullptr.
Exceptions
Erroron failure.
Thread safety:
This function should only be called on the main thread.
Since
This function is available since SDL 3.2.0.
See also
Window.GetMaximumSize
Window.SetMinimumSize

◆ GetMouseGrab()

bool SDL::Window::GetMouseGrab ( ) const
inline

Get a window's mouse grab mode.

Returns
true if mouse is grabbed, and false otherwise.
Thread safety:
This function should only be called on the main thread.
Since
This function is available since SDL 3.2.0.
See also
Window.GetMouseRect
Window.SetMouseRect
Window.SetMouseGrab
Window.SetKeyboardGrab

◆ GetMouseRect()

const RectRaw * SDL::Window::GetMouseRect ( ) const
inline

Get the mouse confinement rectangle of a window.

Returns
a pointer to the mouse confinement rectangle of a window, or nullptr if there isn't one.
Thread safety:
This function should only be called on the main thread.
Since
This function is available since SDL 3.2.0.
See also
Window.SetMouseRect
Window.GetMouseGrab
Window.SetMouseGrab

◆ GetName()

const char * SDL::Display::GetName ( ) const
inline

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

Returns
the name of a display or nullptr on failure; call GetError() for more information.
Thread safety:
This function should only be called on the main thread.
Since
This function is available since SDL 3.2.0.
See also
GetDisplays

◆ GetNaturalDisplayOrientation()

DisplayOrientation SDL::GetNaturalDisplayOrientation ( DisplayID displayID)
inline

Get the orientation of a display when it is unrotated.

Parameters
displayIDthe instance ID of the display to query.
Returns
the DisplayOrientation enum value of the display, or ORIENTATION_UNKNOWN if it isn't available.
Thread safety:
This function should only be called on the main thread.
Since
This function is available since SDL 3.2.0.
See also
GetDisplays

◆ GetNaturalOrientation()

DisplayOrientation SDL::Display::GetNaturalOrientation ( ) const
inline

Get the orientation of a display when it is unrotated.

Returns
the DisplayOrientation enum value of the display, or ORIENTATION_UNKNOWN if it isn't available.
Thread safety:
This function should only be called on the main thread.
Since
This function is available since SDL 3.2.0.
See also
GetDisplays

◆ GetNumVideoDrivers()

int SDL::GetNumVideoDrivers ( )
inline

Get the number of video drivers compiled into SDL.

Returns
the number of built in video drivers.
Thread safety:
This function should only be called on the main thread.
Since
This function is available since SDL 3.2.0.
See also
GetVideoDriver

◆ GetOpacity()

float SDL::Window::GetOpacity ( ) const
inline

Get the opacity of a window.

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

Returns
the opacity, (0.0f - transparent, 1.0f - opaque), or -1.0f on failure; call GetError() for more information.
Thread safety:
This function should only be called on the main thread.
Since
This function is available since SDL 3.2.0.
See also
Window.SetOpacity

◆ GetParent()

WindowRef SDL::Window::GetParent ( ) const
inline

Get parent of a window.

Returns
the parent of the window on success or nullptr if the window has no parent.
Thread safety:
This function should only be called on the main thread.
Since
This function is available since SDL 3.2.0.
See also
CreatePopupWindow

◆ GetPixelDensity()

float SDL::Window::GetPixelDensity ( ) const
inline

Get the pixel density of a window.

This is a ratio of pixel size to window size. For example, if the window is 1920x1080 and it has a high density back buffer of 3840x2160 pixels, it would have a pixel density of 2.0.

Returns
the pixel density or 0.0f on failure; call GetError() for more information.
Thread safety:
This function should only be called on the main thread.
Since
This function is available since SDL 3.2.0.
See also
Window.GetDisplayScale

◆ GetPixelFormat()

PixelFormat SDL::Window::GetPixelFormat ( ) const
inline

Get the pixel format associated with the window.

Returns
the pixel format of the window on success.
Exceptions
Erroron failure.
Thread safety:
This function should only be called on the main thread.
Since
This function is available since SDL 3.2.0.

◆ GetPosition() [1/2]

Point SDL::Window::GetPosition ( ) const
inline

Get the position of a window.

This is the current position of the window as last reported by the windowing system.

If you do not need the value for one of the positions a nullptr may be passed in the x or y parameter.

Returns
the position on success.
Exceptions
Erroron failure.
Thread safety:
This function should only be called on the main thread.
Since
This function is available since SDL 3.2.0.
See also
Window.SetPosition
SetPosition(int *, int *)

◆ GetPosition() [2/2]

void SDL::Window::GetPosition ( int * x,
int * y ) const
inline

Get the position of a window.

This is the current position of the window as last reported by the windowing system.

If you do not need the value for one of the positions a nullptr may be passed in the x or y parameter.

Parameters
xa pointer filled in with the x position of the window, may be nullptr.
ya pointer filled in with the y position of the window, may be nullptr.
Exceptions
Erroron failure.
Thread safety:
This function should only be called on the main thread.
Since
This function is available since SDL 3.2.0.
See also
Window.SetPosition

◆ GetPrimary()

Display SDL::Display::GetPrimary ( )
inlinestatic

Return the primary display.

Returns
the instance ID of the primary display on success.
Exceptions
Erroron failure.
Thread safety:
This function should only be called on the main thread.
Since
This function is available since SDL 3.2.0.
See also
GetDisplays

◆ GetPrimaryDisplay()

Display SDL::GetPrimaryDisplay ( )
inline

Return the primary display.

Returns
the instance ID of the primary display on success.
Exceptions
Erroron failure.
Thread safety:
This function should only be called on the main thread.
Since
This function is available since SDL 3.2.0.
See also
GetDisplays

◆ GetProgressState()

ProgressState SDL::Window::GetProgressState ( )
inline

Get the state of the progress bar for the given window’s taskbar icon.

Returns
the progress state, or PROGRESS_STATE_INVALID on failure; call GetError() for more information.
Thread safety:
This function should only be called on the main thread.
Since
This function is available since SDL 3.4.0.

◆ GetProgressValue()

float SDL::Window::GetProgressValue ( )
inline

Get the value of the progress bar for the given window’s taskbar icon.

Returns
the progress value in the range of [0.0f - 1.0f], or -1.0f on failure; call GetError() for more information.
Thread safety:
This function should only be called on the main thread.
Since
This function is available since SDL 3.4.0.

◆ GetProperties() [1/2]

PropertiesRef SDL::Display::GetProperties ( ) const
inline

Get the properties associated with a display.

The following read-only properties are provided by SDL:

  • prop.Display.HDR_ENABLED_BOOLEAN: true if the display has HDR headroom above the SDR white point. This is for informational and diagnostic purposes only, as not all platforms provide this information at the display level.

On KMS/DRM:

  • prop.Display.KMSDRM_PANEL_ORIENTATION_NUMBER: the "panel orientation" property for the display in degrees of clockwise rotation. Note that this is provided only as a hint, and the application is responsible for any coordinate transformations needed to conform to the requested display orientation.

On Wayland:

On Windows:

Returns
a valid property ID on success.
Exceptions
Erroron failure.
Thread safety:
This function should only be called on the main thread.
Since
This function is available since SDL 3.2.0.

◆ GetProperties() [2/2]

PropertiesRef SDL::Window::GetProperties ( ) const
inline

Get the properties associated with a window.

The following read-only properties are provided by SDL:

  • prop.Window.SHAPE_POINTER: the surface associated with a shaped window
  • prop.Window.HDR_ENABLED_BOOLEAN: true if the window has HDR headroom above the SDR white point. This property can change dynamically when EVENT_WINDOW_HDR_STATE_CHANGED is sent.
  • prop.Window.SDR_WHITE_LEVEL_FLOAT: the value of SDR white in the COLORSPACE_SRGB_LINEAR colorspace. On Windows this corresponds to the SDR white level in scRGB colorspace, and on Apple platforms this is always 1.0 for EDR content. This property can change dynamically when EVENT_WINDOW_HDR_STATE_CHANGED is sent.
  • prop.Window.HDR_HEADROOM_FLOAT: the additional high dynamic range that can be displayed, in terms of the SDR white point. When HDR is not enabled, this will be 1.0. This property can change dynamically when EVENT_WINDOW_HDR_STATE_CHANGED is sent.

On Android:

On iOS:

On KMS/DRM:

On macOS:

On OpenVR:

On Vivante:

On Windows:

On Wayland:

Note: The xdg_* window objects do not internally persist across window show/hide calls. They will be null if the window is hidden and must be queried each time it is shown.

On X11:

On Emscripten:

Returns
a valid property ID on success.
Exceptions
Erroron failure.
Thread safety:
This function should only be called on the main thread.
Since
This function is available since SDL 3.2.0.

◆ GetRect()

Rect SDL::Window::GetRect ( ) const
inline

Get the position and client size of a window.

This is the current position of the window as last reported by the windowing system.

The window pixel size may differ from its window coordinate size if the window is on a high pixel density display. Use Window.GetSizeInPixels() or RendererRef.GetOutputSize() to get the real client area size in pixels.

Returns
Rect with the position and size
Exceptions
Erroron failure.

◆ GetSafeArea()

Rect SDL::Window::GetSafeArea ( ) const
inline

Get the safe area for this window.

Some devices have portions of the screen which are partially obscured or not interactive, possibly due to on-screen controls, curved edges, camera notches, TV overscan, etc. This function provides the area of the window which is safe to have interactable content. You should continue rendering into the rest of the window, but it should not contain visually important or interactable content.

Exceptions
Erroron failure.
Thread safety:
This function should only be called on the main thread.
Since
This function is available since SDL 3.2.0.

◆ GetSize() [1/2]

Point SDL::Window::GetSize ( ) const
inline

Get the size of a window's client area.

The window pixel size may differ from its window coordinate size if the window is on a high pixel density display. Use Window.GetSizeInPixels() or Renderer.GetOutputSize() to get the real client area size in pixels.

Returns
a point with width and height on success
Exceptions
Erroron failure.
Thread safety:
This function should only be called on the main thread.
Since
This function is available since SDL 3.2.0.
See also
Renderer.GetOutputSize
Window.GetSizeInPixels
Window.SetSize
EVENT_WINDOW_RESIZED
GetSize(int *, int *)

◆ GetSize() [2/2]

void SDL::Window::GetSize ( int * w,
int * h ) const
inline

Get the size of a window's client area.

The window pixel size may differ from its window coordinate size if the window is on a high pixel density display. Use Window.GetSizeInPixels() or Renderer.GetOutputSize() to get the real client area size in pixels.

Parameters
wa pointer filled in with the width of the window, may be nullptr.
ha pointer filled in with the height of the window, may be nullptr.
Exceptions
Erroron failure.
Thread safety:
This function should only be called on the main thread.
Since
This function is available since SDL 3.2.0.
See also
Renderer.GetOutputSize
Window.GetSizeInPixels
Window.SetSize
EVENT_WINDOW_RESIZED

◆ GetSizeInPixels() [1/2]

Point SDL::Window::GetSizeInPixels ( ) const
inline

Get the size of a window's client area, in pixels.

Returns
the size on success or std::nullopt on failure; call GetError() for more information.
Exceptions
Erroron failure.
Thread safety:
This function should only be called on the main thread.
Since
This function is available since SDL 3.2.0.
See also
CreateWindow
Window.GetSize
GetSizeInPixels(int*, int*)

◆ GetSizeInPixels() [2/2]

void SDL::Window::GetSizeInPixels ( int * w,
int * h ) const
inline

Get the size of a window's client area, in pixels.

Parameters
wa pointer to variable for storing the width in pixels, may be nullptr.
ha pointer to variable for storing the height in pixels, may be nullptr.
Exceptions
Erroron failure.
Thread safety:
This function should only be called on the main thread.
Since
This function is available since SDL 3.2.0.
See also
CreateWindow
Window.GetSize
GetSizeInPixels()

◆ GetSurface()

Surface SDL::Window::GetSurface ( )
inline

Get the SDL surface associated with the window.

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. Do not free this surface.

This surface will be invalidated if the window is resized. After resizing a window this function must be called again to return a valid surface.

You may not combine this with 3D or the rendering API on this window.

This function is affected by SDL_HINT_FRAMEBUFFER_ACCELERATION.

Returns
the surface associated with the window on success.
Exceptions
Erroron failure.
Thread safety:
This function should only be called on the main thread.
Since
This function is available since SDL 3.2.0.
See also
Window.DestroySurface
Window.HasSurface
Window.UpdateSurface
Window.UpdateSurfaceRects

◆ GetSurfaceVSync()

int SDL::Window::GetSurfaceVSync ( ) const
inline

Get VSync for the window surface.

Returns
the current vertical refresh sync interval. See Window.SetSurfaceVSync() for the meaning of the value.
Exceptions
Erroron failure.
Thread safety:
This function should only be called on the main thread.
Since
This function is available since SDL 3.2.0.
See also
Window.SetSurfaceVSync

◆ GetSystemTheme()

SystemTheme SDL::GetSystemTheme ( )
inline

Get the current system theme.

Returns
the current system theme, light, dark, or unknown.
Thread safety:
This function should only be called on the main thread.
Since
This function is available since SDL 3.2.0.

◆ GetTitle()

const char * SDL::Window::GetTitle ( ) const
inline

Get the title of a window.

Returns
the title of the window in UTF-8 format or "" if there is no title.
Thread safety:
This function should only be called on the main thread.
Since
This function is available since SDL 3.2.0.
See also
Window.SetTitle

◆ GetUsableBounds()

Rect SDL::Display::GetUsableBounds ( ) const
inline

Get the usable desktop area represented by a display, in screen coordinates.

This is the same area as Display.GetBounds() reports, but with portions reserved by the system removed. For example, on Apple's macOS, this subtracts the area occupied by the menu bar and dock.

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

Returns
the Rect structure filled in with the display bounds.
Exceptions
Erroron failure.
Thread safety:
This function should only be called on the main thread.
Since
This function is available since SDL 3.2.0.
See also
Display.GetBounds
GetDisplays

◆ GetVideoDriver()

const char * SDL::GetVideoDriver ( int index)
inline

Get the name of a built in video driver.

The video drivers are presented in the order in which they are normally checked during initialization.

The names of drivers are all simple, low-ASCII identifiers, like "cocoa", "x11" or "windows". These never have Unicode characters, and are not meant to be proper names.

Parameters
indexthe index of a video driver.
Returns
the name of the video driver with the given index, or nullptr if index is out of bounds.
Thread safety:
This function should only be called on the main thread.
Since
This function is available since SDL 3.2.0.
See also
GetNumVideoDrivers

◆ GetWindowAspectRatio()

void SDL::GetWindowAspectRatio ( WindowRef window,
float * min_aspect,
float * max_aspect )
inline

Get the aspect ratio of a window's client area.

Parameters
windowthe window to query the width and height from.
min_aspecta pointer filled in with the minimum aspect ratio of the window, may be nullptr.
max_aspecta pointer filled in with the maximum aspect ratio of the window, may be nullptr.
Exceptions
Erroron failure.
Thread safety:
This function should only be called on the main thread.
Since
This function is available since SDL 3.2.0.
See also
Window.SetAspectRatio

◆ GetWindowBordersSize()

void SDL::GetWindowBordersSize ( WindowRef window,
int * top,
int * left,
int * bottom,
int * right )
inline

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

Note: If this function fails (returns false), the size values will be initialized to 0, 0, 0, 0 (if a non-nullptr pointer is provided), as if the window in question was borderless.

Note: This function may fail on systems where the window has not yet been decorated by the display server (for example, immediately after calling CreateWindow). It is recommended that you wait at least until the window has been presented and composited, so that the window system has a chance to decorate the window and provide the border dimensions to SDL.

This function also returns false if getting the information is not supported.

Parameters
windowthe window to query the size values of the border (decorations) from.
toppointer to variable for storing the size of the top border; nullptr is permitted.
leftpointer to variable for storing the size of the left border; nullptr is permitted.
bottompointer to variable for storing the size of the bottom border; nullptr is permitted.
rightpointer to variable for storing the size of the right border; nullptr is permitted.
Exceptions
Erroron failure.
Thread safety:
This function should only be called on the main thread.
Since
This function is available since SDL 3.2.0.
See also
Window.GetSize

◆ GetWindowDisplayScale()

float SDL::GetWindowDisplayScale ( WindowRef window)
inline

Get the content display scale relative to a window's pixel size.

This is a combination of the window pixel density and the display content scale, and is the expected scale for displaying content in this window. For example, if a 3840x2160 window had a display scale of 2.0, the user expects the content to take twice as many pixels and be the same physical size as if it were being displayed in a 1920x1080 window with a display scale of 1.0.

Conceptually this value corresponds to the scale display setting, and is updated when that setting is changed, or the window moves to a display with a different scale setting.

Parameters
windowthe window to query.
Returns
the display scale, or 0.0f on failure; call GetError() for more information.
Thread safety:
This function should only be called on the main thread.
Since
This function is available since SDL 3.2.0.

◆ GetWindowFlags()

WindowFlags SDL::GetWindowFlags ( WindowRef window)
inline

Get the window flags.

Parameters
windowthe window to query.
Returns
a mask of the WindowFlags associated with window.
Thread safety:
This function should only be called on the main thread.
Since
This function is available since SDL 3.2.0.
See also
CreateWindow
Window.Hide
Window.Maximize
Window.Minimize
Window.SetFullscreen
Window.SetMouseGrab
Window.SetFillDocument
Window.Show

◆ GetWindowFromID()

WindowRef SDL::GetWindowFromID ( WindowID id)
inline

Get a window from a stored ID.

The numeric ID is what WindowEvent references, and is necessary to map these events to specific Window objects.

Parameters
idthe ID of the window.
Returns
the window associated with id or nullptr if it doesn't exist; call GetError() for more information.
Thread safety:
This function should only be called on the main thread.
Since
This function is available since SDL 3.2.0.
See also
Window.GetID

◆ GetWindowFullscreenMode()

const DisplayMode & SDL::GetWindowFullscreenMode ( WindowRef window)
inline

Query the display mode to use when a window is visible at fullscreen.

Parameters
windowthe window to query.
Returns
a pointer to the exclusive fullscreen mode to use or nullptr for borderless fullscreen desktop mode.
Thread safety:
This function should only be called on the main thread.
Since
This function is available since SDL 3.2.0.
See also
Window.SetFullscreenMode
Window.SetFullscreen

◆ GetWindowICCProfile()

OwnPtr< void > SDL::GetWindowICCProfile ( WindowRef window)
inline

Get the raw ICC profile data for the screen the window is currently on.

Parameters
windowthe window to query.
Returns
the raw ICC profile data on success.
Exceptions
Erroron failure.
Thread safety:
This function should only be called on the main thread.
Since
This function is available since SDL 3.2.0.

◆ GetWindowID()

WindowID SDL::GetWindowID ( WindowRef window)
inline

Get the numeric ID of a window.

The numeric ID is what WindowEvent references, and is necessary to map these events to specific Window objects.

Parameters
windowthe window to query.
Returns
the ID of the window on success.
Exceptions
Erroron failure.
Thread safety:
This function should only be called on the main thread.
Since
This function is available since SDL 3.2.0.
See also
Window.FromID

◆ GetWindowKeyboardGrab()

bool SDL::GetWindowKeyboardGrab ( WindowRef window)
inline

Get a window's keyboard grab mode.

Parameters
windowthe window to query.
Returns
true if keyboard is grabbed, and false otherwise.
Thread safety:
This function should only be called on the main thread.
Since
This function is available since SDL 3.2.0.
See also
Window.SetKeyboardGrab

◆ GetWindowMaximumSize()

void SDL::GetWindowMaximumSize ( WindowRef window,
int * w,
int * h )
inline

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

Parameters
windowthe window to query.
wa pointer filled in with the maximum width of the window, may be nullptr.
ha pointer filled in with the maximum height of the window, may be nullptr.
Exceptions
Erroron failure.
Thread safety:
This function should only be called on the main thread.
Since
This function is available since SDL 3.2.0.
See also
Window.GetMinimumSize
Window.SetMaximumSize

◆ GetWindowMinimumSize()

void SDL::GetWindowMinimumSize ( WindowRef window,
int * w,
int * h )
inline

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

Parameters
windowthe window to query.
wa pointer filled in with the minimum width of the window, may be nullptr.
ha pointer filled in with the minimum height of the window, may be nullptr.
Exceptions
Erroron failure.
Thread safety:
This function should only be called on the main thread.
Since
This function is available since SDL 3.2.0.
See also
Window.GetMaximumSize
Window.SetMinimumSize

◆ GetWindowMouseGrab()

bool SDL::GetWindowMouseGrab ( WindowRef window)
inline

Get a window's mouse grab mode.

Parameters
windowthe window to query.
Returns
true if mouse is grabbed, and false otherwise.
Thread safety:
This function should only be called on the main thread.
Since
This function is available since SDL 3.2.0.
See also
Window.GetMouseRect
Window.SetMouseRect
Window.SetMouseGrab
Window.SetKeyboardGrab

◆ GetWindowMouseRect()

const RectRaw * SDL::GetWindowMouseRect ( WindowRef window)
inline

Get the mouse confinement rectangle of a window.

Parameters
windowthe window to query.
Returns
a pointer to the mouse confinement rectangle of a window, or nullptr if there isn't one.
Thread safety:
This function should only be called on the main thread.
Since
This function is available since SDL 3.2.0.
See also
Window.SetMouseRect
Window.GetMouseGrab
Window.SetMouseGrab

◆ GetWindowOpacity()

float SDL::GetWindowOpacity ( WindowRef window)
inline

Get the opacity of a window.

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

Parameters
windowthe window to get the current opacity value from.
Returns
the opacity, (0.0f - transparent, 1.0f - opaque), or -1.0f on failure; call GetError() for more information.
Thread safety:
This function should only be called on the main thread.
Since
This function is available since SDL 3.2.0.
See also
Window.SetOpacity

◆ GetWindowParent()

WindowRef SDL::GetWindowParent ( WindowRef window)
inline

Get parent of a window.

Parameters
windowthe window to query.
Returns
the parent of the window on success or nullptr if the window has no parent.
Thread safety:
This function should only be called on the main thread.
Since
This function is available since SDL 3.2.0.
See also
CreatePopupWindow

◆ GetWindowPixelDensity()

float SDL::GetWindowPixelDensity ( WindowRef window)
inline

Get the pixel density of a window.

This is a ratio of pixel size to window size. For example, if the window is 1920x1080 and it has a high density back buffer of 3840x2160 pixels, it would have a pixel density of 2.0.

Parameters
windowthe window to query.
Returns
the pixel density or 0.0f on failure; call GetError() for more information.
Thread safety:
This function should only be called on the main thread.
Since
This function is available since SDL 3.2.0.
See also
Window.GetDisplayScale

◆ GetWindowPixelFormat()

PixelFormat SDL::GetWindowPixelFormat ( WindowRef window)
inline

Get the pixel format associated with the window.

Parameters
windowthe window to query.
Returns
the pixel format of the window on success.
Exceptions
Erroron failure.
Thread safety:
This function should only be called on the main thread.
Since
This function is available since SDL 3.2.0.

◆ GetWindowPosition() [1/2]

Point SDL::GetWindowPosition ( WindowRef window)
inline

Get the position of a window.

This is the current position of the window as last reported by the windowing system.

If you do not need the value for one of the positions a nullptr may be passed in the x or y parameter.

Parameters
windowthe window to query.
Returns
the position on success.
Exceptions
Erroron failure.
Thread safety:
This function should only be called on the main thread.
Since
This function is available since SDL 3.2.0.
See also
Window.SetPosition

◆ GetWindowPosition() [2/2]

void SDL::GetWindowPosition ( WindowRef window,
int * x,
int * y )
inline

Get the position of a window.

This is the current position of the window as last reported by the windowing system.

If you do not need the value for one of the positions a nullptr may be passed in the x or y parameter.

Parameters
windowthe window to query.
xa pointer filled in with the x position of the window, may be nullptr.
ya pointer filled in with the y position of the window, may be nullptr.
Exceptions
Erroron failure.
Thread safety:
This function should only be called on the main thread.
Since
This function is available since SDL 3.2.0.
See also
Window.SetPosition

◆ GetWindowProgressState()

ProgressState SDL::GetWindowProgressState ( WindowRef window)
inline

Get the state of the progress bar for the given window’s taskbar icon.

Parameters
windowthe window to get the current progress state from.
Returns
the progress state, or PROGRESS_STATE_INVALID on failure; call GetError() for more information.
Thread safety:
This function should only be called on the main thread.
Since
This function is available since SDL 3.4.0.

◆ GetWindowProgressValue()

float SDL::GetWindowProgressValue ( WindowRef window)
inline

Get the value of the progress bar for the given window’s taskbar icon.

Parameters
windowthe window to get the current progress value from.
Returns
the progress value in the range of [0.0f - 1.0f], or -1.0f on failure; call GetError() for more information.
Thread safety:
This function should only be called on the main thread.
Since
This function is available since SDL 3.4.0.

◆ GetWindowProperties()

PropertiesRef SDL::GetWindowProperties ( WindowRef window)
inline

Get the properties associated with a window.

The following read-only properties are provided by SDL:

  • prop.Window.SHAPE_POINTER: the surface associated with a shaped window
  • prop.Window.HDR_ENABLED_BOOLEAN: true if the window has HDR headroom above the SDR white point. This property can change dynamically when EVENT_WINDOW_HDR_STATE_CHANGED is sent.
  • prop.Window.SDR_WHITE_LEVEL_FLOAT: the value of SDR white in the COLORSPACE_SRGB_LINEAR colorspace. On Windows this corresponds to the SDR white level in scRGB colorspace, and on Apple platforms this is always 1.0 for EDR content. This property can change dynamically when EVENT_WINDOW_HDR_STATE_CHANGED is sent.
  • prop.Window.HDR_HEADROOM_FLOAT: the additional high dynamic range that can be displayed, in terms of the SDR white point. When HDR is not enabled, this will be 1.0. This property can change dynamically when EVENT_WINDOW_HDR_STATE_CHANGED is sent.

On Android:

On iOS:

On KMS/DRM:

On macOS:

On OpenVR:

On Vivante:

On Windows:

On Wayland:

Note: The xdg_* window objects do not internally persist across window show/hide calls. They will be null if the window is hidden and must be queried each time it is shown.

On X11:

On Emscripten:

Parameters
windowthe window to query.
Returns
a valid property ID on success.
Exceptions
Erroron failure.
Thread safety:
This function should only be called on the main thread.
Since
This function is available since SDL 3.2.0.

◆ GetWindowRect()

Rect SDL::GetWindowRect ( WindowRef window)
inline

Get the position and client size of a window.

This is the current position of the window as last reported by the windowing system.

The window pixel size may differ from its window coordinate size if the window is on a high pixel density display. Use Window.GetSizeInPixels() or RendererRef.GetOutputSize() to get the real client area size in pixels.

Parameters
windowthe window to query the width and height from.
Returns
Rect with the position and size
Exceptions
Erroron failure.

◆ GetWindows()

OwnArray< WindowRef > SDL::GetWindows ( )
inline

Get a list of valid windows.

Returns
a nullptr terminated array of Window pointers or nullptr on failure; call GetError() for more information.
Thread safety:
This function should only be called on the main thread.
Since
This function is available since SDL 3.2.0.

◆ GetWindowSafeArea()

Rect SDL::GetWindowSafeArea ( WindowRef window)
inline

Get the safe area for this window.

Some devices have portions of the screen which are partially obscured or not interactive, possibly due to on-screen controls, curved edges, camera notches, TV overscan, etc. This function provides the area of the window which is safe to have interactable content. You should continue rendering into the rest of the window, but it should not contain visually important or interactable content.

Parameters
windowthe window to query.
Exceptions
Erroron failure.
Thread safety:
This function should only be called on the main thread.
Since
This function is available since SDL 3.2.0.

◆ GetWindowSize() [1/2]

Point SDL::GetWindowSize ( WindowRef window)
inline

Get the size of a window's client area.

The window pixel size may differ from its window coordinate size if the window is on a high pixel density display. Use Window.GetSizeInPixels() or Renderer.GetOutputSize() to get the real client area size in pixels.

Parameters
windowthe window to query the width and height from.
Returns
a point with width and height on success
Exceptions
Erroron failure.
Thread safety:
This function should only be called on the main thread.
Since
This function is available since SDL 3.2.0.
See also
Renderer.GetOutputSize
Window.GetSizeInPixels
Window.SetSize
EVENT_WINDOW_RESIZED

◆ GetWindowSize() [2/2]

void SDL::GetWindowSize ( WindowRef window,
int * w,
int * h )
inline

Get the size of a window's client area.

The window pixel size may differ from its window coordinate size if the window is on a high pixel density display. Use Window.GetSizeInPixels() or Renderer.GetOutputSize() to get the real client area size in pixels.

Parameters
windowthe window to query the width and height from.
wa pointer filled in with the width of the window, may be nullptr.
ha pointer filled in with the height of the window, may be nullptr.
Exceptions
Erroron failure.
Thread safety:
This function should only be called on the main thread.
Since
This function is available since SDL 3.2.0.
See also
Renderer.GetOutputSize
Window.GetSizeInPixels
Window.SetSize
EVENT_WINDOW_RESIZED

◆ GetWindowSizeInPixels() [1/2]

Point SDL::GetWindowSizeInPixels ( WindowRef window)
inline

Get the size of a window's client area, in pixels.

Parameters
windowthe window from which the drawable size should be queried.
Returns
the size on success or std::nullopt on failure; call GetError() for more information.
Exceptions
Erroron failure.
Thread safety:
This function should only be called on the main thread.
Since
This function is available since SDL 3.2.0.
See also
CreateWindow
Window.GetSize

◆ GetWindowSizeInPixels() [2/2]

void SDL::GetWindowSizeInPixels ( WindowRef window,
int * w,
int * h )
inline

Get the size of a window's client area, in pixels.

Parameters
windowthe window from which the drawable size should be queried.
wa pointer to variable for storing the width in pixels, may be nullptr.
ha pointer to variable for storing the height in pixels, may be nullptr.
Exceptions
Erroron failure.
Thread safety:
This function should only be called on the main thread.
Since
This function is available since SDL 3.2.0.
See also
CreateWindow
Window.GetSize

◆ GetWindowSurface()

Surface SDL::GetWindowSurface ( WindowRef window)
inline

Get the SDL surface associated with the window.

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. Do not free this surface.

This surface will be invalidated if the window is resized. After resizing a window this function must be called again to return a valid surface.

You may not combine this with 3D or the rendering API on this window.

This function is affected by SDL_HINT_FRAMEBUFFER_ACCELERATION.

Parameters
windowthe window to query.
Returns
the surface associated with the window on success.
Exceptions
Erroron failure.
Thread safety:
This function should only be called on the main thread.
Since
This function is available since SDL 3.2.0.
See also
Window.DestroySurface
Window.HasSurface
Window.UpdateSurface
Window.UpdateSurfaceRects

◆ GetWindowSurfaceVSync()

int SDL::GetWindowSurfaceVSync ( WindowRef window)
inline

Get VSync for the window surface.

Parameters
windowthe window to query.
Exceptions
Erroron failure.
Thread safety:
This function should only be called on the main thread.
Since
This function is available since SDL 3.2.0.
See also
Window.SetSurfaceVSync

◆ GetWindowTitle()

const char * SDL::GetWindowTitle ( WindowRef window)
inline

Get the title of a window.

Parameters
windowthe window to query.
Returns
the title of the window in UTF-8 format or "" if there is no title.
Thread safety:
This function should only be called on the main thread.
Since
This function is available since SDL 3.2.0.
See also
Window.SetTitle

◆ GL_CreateContext()

GLContext SDL::GL_CreateContext ( WindowRef window)
inline

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

The OpenGL context will be created with the current states set through GL_SetAttribute().

The Window specified must have been created with the WINDOW_OPENGL flag, or context creation will fail.

Windows users new to OpenGL should note that, for historical reasons, GL functions added after OpenGL version 1.1 are not available by default. Those functions must be loaded at run-time, either with an OpenGL extension-handling library or with GL_GetProcAddress() and its related functions.

GLContext is opaque to the application.

Parameters
windowthe window to associate with the context.
Returns
the OpenGL context associated with window or nullptr on failure; call GetError() for more information.
Thread safety:
This function should only be called on the main thread.
Since
This function is available since SDL 3.2.0.
See also
GLContext.Destroy
GLContext.MakeCurrent

◆ GL_DestroyContext()

void SDL::GL_DestroyContext ( GLContextRaw context)
inline

Delete an OpenGL context.

Parameters
contextthe OpenGL context to be deleted.
Exceptions
Erroron failure.
Thread safety:
This function should only be called on the main thread.
Since
This function is available since SDL 3.2.0.
See also
Window.CreateGLContext

◆ GL_ExtensionSupported()

bool SDL::GL_ExtensionSupported ( StringParam extension)
inline

Check if an OpenGL extension is supported for the current context.

This function operates on the current GL context; you must have created a context and it must be current before calling this function. Do not assume that all contexts you create will have the same set of extensions available, or that recreating an existing context will offer the same extensions again.

While it's probably not a massive overhead, this function is not an O(1) operation. Check the extensions you care about after creating the GL context and save that information somewhere instead of calling the function every time you need to know.

Parameters
extensionthe name of the extension to check.
Returns
true if the extension is supported, false otherwise.
Thread safety:
This function should only be called on the main thread.
Since
This function is available since SDL 3.2.0.

◆ GL_GetAttribute()

void SDL::GL_GetAttribute ( GLAttr attr,
int * value )
inline

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

Parameters
attran GLAttr enum value specifying the OpenGL attribute to get.
valuea pointer filled in with the current value of attr.
Exceptions
Erroron failure.
Thread safety:
This function should only be called on the main thread.
Since
This function is available since SDL 3.2.0.
See also
GL_ResetAttributes
GL_SetAttribute

◆ GL_GetCurrentContext()

GLContext SDL::GL_GetCurrentContext ( )
inline

Get the currently active OpenGL context.

Returns
the currently active OpenGL context or nullptr on failure; call GetError() for more information.
Thread safety:
This function should only be called on the main thread.
Since
This function is available since SDL 3.2.0.
See also
GLContext.MakeCurrent

◆ GL_GetCurrentWindow()

WindowRef SDL::GL_GetCurrentWindow ( )
inline

Get the currently active OpenGL window.

Returns
the currently active OpenGL window on success.
Exceptions
Erroron failure.
Thread safety:
This function should only be called on the main thread.
Since
This function is available since SDL 3.2.0.

◆ GL_GetProcAddress()

FunctionPointer SDL::GL_GetProcAddress ( StringParam proc)
inline

Get an OpenGL function by name.

If the GL library is loaded at runtime with GL_LoadLibrary(), then all GL functions must be retrieved this way. Usually this is used to retrieve function pointers to OpenGL extensions.

There are some quirks to looking up OpenGL functions that require some extra care from the application. If you code carefully, you can handle these quirks without any platform-specific code, though:

  • On Windows, function pointers are specific to the current GL context; this means you need to have created a GL context and made it current before calling GL_GetProcAddress(). If you recreate your context or create a second context, you should assume that any existing function pointers aren't valid to use with it. This is (currently) a Windows-specific limitation, and in practice lots of drivers don't suffer this limitation, but it is still the way the wgl API is documented to work and you should expect crashes if you don't respect it. Store a copy of the function pointers that comes and goes with context lifespan.
  • On X11, function pointers returned by this function are valid for any context, and can even be looked up before a context is created at all. This means that, for at least some common OpenGL implementations, if you look up a function that doesn't exist, you'll get a non-nullptr result that is NOT safe to call. You must always make sure the function is actually available for a given GL context before calling it, by checking for the existence of the appropriate extension with GL_ExtensionSupported(), or verifying that the version of OpenGL you're using offers the function as core functionality.
  • Some OpenGL drivers, on all platforms, will return nullptr if a function isn't supported, but you can't count on this behavior. Check for extensions you use, and if you get a nullptr anyway, act as if that extension wasn't available. This is probably a bug in the driver, but you can code defensively for this scenario anyhow.
  • Just because you're on Linux/Unix, don't assume you'll be using X11. Next-gen display servers are waiting to replace it, and may or may not make the same promises about function pointers.
  • OpenGL function pointers must be declared APIENTRY as in the example code. This will ensure the proper calling convention is followed on platforms where this matters (Win32) thereby avoiding stack corruption.
Parameters
procthe name of an OpenGL function.
Returns
a pointer to the named OpenGL function. The returned pointer should be cast to the appropriate function signature.
Thread safety:
This function should only be called on the main thread.
Since
This function is available since SDL 3.2.0.
See also
GL_ExtensionSupported
GL_LoadLibrary
GL_UnloadLibrary

◆ GL_GetSwapInterval()

void SDL::GL_GetSwapInterval ( int * interval)
inline

Get the swap interval for the current OpenGL context.

If the system can't determine the swap interval, or there isn't a valid current context, this function will set *interval to 0 as a safe default.

Parameters
intervaloutput interval value. 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.
Exceptions
Erroron failure.
Thread safety:
This function should only be called on the main thread.
Since
This function is available since SDL 3.2.0.
See also
GL_SetSwapInterval

◆ GL_LoadLibrary()

void SDL::GL_LoadLibrary ( StringParam path)
inline

Dynamically load an OpenGL library.

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.

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

Parameters
paththe platform dependent OpenGL library name, or nullptr to open the default OpenGL library.
Exceptions
Erroron failure.
Thread safety:
This function should only be called on the main thread.
Since
This function is available since SDL 3.2.0.
See also
GL_GetProcAddress
GL_UnloadLibrary

◆ GL_MakeCurrent()

void SDL::GL_MakeCurrent ( WindowRef window,
GLContext context )
inline

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

The context must have been created with a compatible window.

Parameters
windowthe window to associate with the context.
contextthe OpenGL context to associate with the window.
Exceptions
Erroron failure.
Thread safety:
This function should only be called on the main thread.
Since
This function is available since SDL 3.2.0.
See also
Window.CreateGLContext

◆ GL_ResetAttributes()

void SDL::GL_ResetAttributes ( )
inline

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

Thread safety:
This function should only be called on the main thread.
Since
This function is available since SDL 3.2.0.
See also
GL_GetAttribute
GL_SetAttribute

◆ GL_SetAttribute()

void SDL::GL_SetAttribute ( GLAttr attr,
int value )
inline

Set an OpenGL window attribute before window creation.

This function sets the OpenGL attribute attr to value. The requested attributes should be set before creating an OpenGL window. You should use GL_GetAttribute() to check the values after creating the OpenGL context, since the values obtained can differ from the requested ones.

Parameters
attran enum value specifying the OpenGL attribute to set.
valuethe desired value for the attribute.
Exceptions
Erroron failure.
Thread safety:
This function should only be called on the main thread.
Since
This function is available since SDL 3.2.0.
See also
Window.CreateGLContext
GL_GetAttribute
GL_ResetAttributes

◆ GL_SetSwapInterval()

void SDL::GL_SetSwapInterval ( int interval)
inline

Set the swap interval for the current OpenGL context.

Some systems allow specifying -1 for the interval, to enable adaptive vsync. Adaptive vsync works the same as vsync, but if you've already missed the vertical retrace for a given frame, it swaps buffers immediately, which might be less jarring for the user during occasional framerate drops. If an application requests adaptive vsync and the system does not support it, this function will fail and return false. In such a case, you should probably retry the call with 1 for the interval.

Adaptive vsync is implemented for some glX drivers with GLX_EXT_swap_control_tear, and for some Windows drivers with WGL_EXT_swap_control_tear.

Read more on the Khronos wiki: https://www.khronos.org/opengl/wiki/Swap_Interval#Adaptive_Vsync

Parameters
interval0 for immediate updates, 1 for updates synchronized with the vertical retrace, -1 for adaptive vsync.
Exceptions
Erroron failure.
Thread safety:
This function should only be called on the main thread.
Since
This function is available since SDL 3.2.0.
See also
GL_GetSwapInterval

◆ GL_Swap()

void SDL::Window::GL_Swap ( )
inline

Update a window with OpenGL rendering.

This is used with double-buffered OpenGL contexts, which are the default.

On macOS, make sure you bind 0 to the draw framebuffer before swapping the window, otherwise nothing will happen. If you aren't using glBindFramebuffer(), this is the default and you won't have to do anything extra.

Exceptions
Erroron failure.
Thread safety:
This function should only be called on the main thread.
Since
This function is available since SDL 3.2.0.

◆ GL_SwapWindow()

void SDL::GL_SwapWindow ( WindowRef window)
inline

Update a window with OpenGL rendering.

This is used with double-buffered OpenGL contexts, which are the default.

On macOS, make sure you bind 0 to the draw framebuffer before swapping the window, otherwise nothing will happen. If you aren't using glBindFramebuffer(), this is the default and you won't have to do anything extra.

Parameters
windowthe window to change.
Exceptions
Erroron failure.
Thread safety:
This function should only be called on the main thread.
Since
This function is available since SDL 3.2.0.

◆ GL_UnloadLibrary()

void SDL::GL_UnloadLibrary ( )
inline

Unload the OpenGL library previously loaded by GL_LoadLibrary().

Thread safety:
This function should only be called on the main thread.
Since
This function is available since SDL 3.2.0.
See also
GL_LoadLibrary

◆ GLContext()

SDL::GLContext::GLContext ( WindowRef window)
inline

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

The OpenGL context will be created with the current states set through GL_SetAttribute().

The Window specified must have been created with the WINDOW_OPENGL flag, or context creation will fail.

Windows users new to OpenGL should note that, for historical reasons, GL functions added after OpenGL version 1.1 are not available by default. Those functions must be loaded at run-time, either with an OpenGL extension-handling library or with GL_GetProcAddress() and its related functions.

GLContext is opaque to the application.

Parameters
windowthe window to associate with the context.
Postcondition
the OpenGL context associated with window or nullptr on failure; call GetError() for more information.
Thread safety:
This function should only be called on the main thread.
Since
This function is available since SDL 3.2.0.
See also
GLContext.Destroy
GLContext.MakeCurrent

◆ HasSurface()

bool SDL::Window::HasSurface ( ) const
inline

Return whether the window has a surface associated with it.

Returns
true if there is a surface associated with the window, or false otherwise.
Thread safety:
This function should only be called on the main thread.
Since
This function is available since SDL 3.2.0.
See also
Window.GetSurface

◆ Hide()

void SDL::Window::Hide ( )
inline

Hide a window.

Exceptions
Erroron failure.
Thread safety:
This function should only be called on the main thread.
Since
This function is available since SDL 3.2.0.
See also
Window.Show
WINDOW_HIDDEN

◆ HideWindow()

void SDL::HideWindow ( WindowRef window)
inline

Hide a window.

Parameters
windowthe window to hide.
Exceptions
Erroron failure.
Thread safety:
This function should only be called on the main thread.
Since
This function is available since SDL 3.2.0.
See also
Window.Show
WINDOW_HIDDEN

◆ MakeCurrent() [1/2]

void SDL::GLContext::MakeCurrent ( WindowRef window)
inline

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

The context must have been created with a compatible window.

Parameters
windowthe window to associate with the context.
Exceptions
Erroron failure.
Thread safety:
This function should only be called on the main thread.
Since
This function is available since SDL 3.2.0.
See also
Window.CreateGLContext

◆ MakeCurrent() [2/2]

void SDL::Window::MakeCurrent ( GLContext context)
inline

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

The context must have been created with a compatible window.

Parameters
contextthe OpenGL context to associate with the window.
Exceptions
Erroron failure.
Thread safety:
This function should only be called on the main thread.
Since
This function is available since SDL 3.2.0.
See also
Window.CreateGLContext

◆ Maximize()

void SDL::Window::Maximize ( )
inline

Request that the window be made as large as possible.

Non-resizable windows can't be maximized. The window must have the WINDOW_RESIZABLE flag set, or this will have no effect.

On some windowing systems this request is asynchronous and the new window state may not have have been applied immediately upon the return of this function. If an immediate change is required, call Window.Sync() to block until the changes have taken effect.

When the window state changes, an EVENT_WINDOW_MAXIMIZED event will be emitted. Note that, as this is just a request, the windowing system can deny the state change.

When maximizing a window, whether the constraints set via Window.SetMaximumSize() are honored depends on the policy of the window manager. Win32 and macOS enforce the constraints when maximizing, while X11 and Wayland window managers may vary.

Exceptions
Erroron failure.
Thread safety:
This function should only be called on the main thread.
Since
This function is available since SDL 3.2.0.
See also
Window.Minimize
Window.Restore
Window.Sync

◆ MaximizeWindow()

void SDL::MaximizeWindow ( WindowRef window)
inline

Request that the window be made as large as possible.

Non-resizable windows can't be maximized. The window must have the WINDOW_RESIZABLE flag set, or this will have no effect.

On some windowing systems this request is asynchronous and the new window state may not have have been applied immediately upon the return of this function. If an immediate change is required, call Window.Sync() to block until the changes have taken effect.

When the window state changes, an EVENT_WINDOW_MAXIMIZED event will be emitted. Note that, as this is just a request, the windowing system can deny the state change.

When maximizing a window, whether the constraints set via Window.SetMaximumSize() are honored depends on the policy of the window manager. Win32 and macOS enforce the constraints when maximizing, while X11 and Wayland window managers may vary.

Parameters
windowthe window to maximize.
Exceptions
Erroron failure.
Thread safety:
This function should only be called on the main thread.
Since
This function is available since SDL 3.2.0.
See also
Window.Minimize
Window.Restore
Window.Sync

◆ Minimize()

void SDL::Window::Minimize ( )
inline

Request that the window be minimized to an iconic representation.

If the window is in a fullscreen state, this request has no direct effect. It may alter the state the window is returned to when leaving fullscreen.

On some windowing systems this request is asynchronous and the new window state may not have been applied immediately upon the return of this function. If an immediate change is required, call Window.Sync() to block until the changes have taken effect.

When the window state changes, an EVENT_WINDOW_MINIMIZED event will be emitted. Note that, as this is just a request, the windowing system can deny the state change.

Exceptions
Erroron failure.
Thread safety:
This function should only be called on the main thread.
Since
This function is available since SDL 3.2.0.
See also
Window.Maximize
Window.Restore
Window.Sync

◆ MinimizeWindow()

void SDL::MinimizeWindow ( WindowRef window)
inline

Request that the window be minimized to an iconic representation.

If the window is in a fullscreen state, this request has no direct effect. It may alter the state the window is returned to when leaving fullscreen.

On some windowing systems this request is asynchronous and the new window state may not have been applied immediately upon the return of this function. If an immediate change is required, call Window.Sync() to block until the changes have taken effect.

When the window state changes, an EVENT_WINDOW_MINIMIZED event will be emitted. Note that, as this is just a request, the windowing system can deny the state change.

Parameters
windowthe window to minimize.
Exceptions
Erroron failure.
Thread safety:
This function should only be called on the main thread.
Since
This function is available since SDL 3.2.0.
See also
Window.Maximize
Window.Restore
Window.Sync

◆ Raise()

void SDL::Window::Raise ( )
inline

Request that a window be raised above other windows and gain the input focus.

The result of this request is subject to desktop window manager policy, particularly if raising the requested window would result in stealing focus from another application. If the window is successfully raised and gains input focus, an EVENT_WINDOW_FOCUS_GAINED event will be emitted, and the window will have the WINDOW_INPUT_FOCUS flag set.

Exceptions
Erroron failure.
Thread safety:
This function should only be called on the main thread.
Since
This function is available since SDL 3.2.0.

◆ RaiseWindow()

void SDL::RaiseWindow ( WindowRef window)
inline

Request that a window be raised above other windows and gain the input focus.

The result of this request is subject to desktop window manager policy, particularly if raising the requested window would result in stealing focus from another application. If the window is successfully raised and gains input focus, an EVENT_WINDOW_FOCUS_GAINED event will be emitted, and the window will have the WINDOW_INPUT_FOCUS flag set.

Parameters
windowthe window to raise.
Exceptions
Erroron failure.
Thread safety:
This function should only be called on the main thread.
Since
This function is available since SDL 3.2.0.

◆ Restore()

void SDL::Window::Restore ( )
inline

Request that the size and position of a minimized or maximized window be restored.

If the window is in a fullscreen state, this request has no direct effect. It may alter the state the window is returned to when leaving fullscreen.

On some windowing systems this request is asynchronous and the new window state may not have have been applied immediately upon the return of this function. If an immediate change is required, call Window.Sync() to block until the changes have taken effect.

When the window state changes, an EVENT_WINDOW_RESTORED event will be emitted. Note that, as this is just a request, the windowing system can deny the state change.

Exceptions
Erroron failure.
Thread safety:
This function should only be called on the main thread.
Since
This function is available since SDL 3.2.0.
See also
Window.Maximize
Window.Minimize
Window.Sync

◆ RestoreWindow()

void SDL::RestoreWindow ( WindowRef window)
inline

Request that the size and position of a minimized or maximized window be restored.

If the window is in a fullscreen state, this request has no direct effect. It may alter the state the window is returned to when leaving fullscreen.

On some windowing systems this request is asynchronous and the new window state may not have have been applied immediately upon the return of this function. If an immediate change is required, call Window.Sync() to block until the changes have taken effect.

When the window state changes, an EVENT_WINDOW_RESTORED event will be emitted. Note that, as this is just a request, the windowing system can deny the state change.

Parameters
windowthe window to restore.
Exceptions
Erroron failure.
Thread safety:
This function should only be called on the main thread.
Since
This function is available since SDL 3.2.0.
See also
Window.Maximize
Window.Minimize
Window.Sync

◆ ScreenSaverEnabled()

bool SDL::ScreenSaverEnabled ( )
inline

Check whether the screensaver is currently enabled.

The screensaver is disabled by default.

The default can also be changed using SDL_HINT_VIDEO_ALLOW_SCREENSAVER.

Returns
true if the screensaver is enabled, false if it is disabled.
Thread safety:
This function should only be called on the main thread.
Since
This function is available since SDL 3.2.0.
See also
DisableScreenSaver
EnableScreenSaver

◆ SetAlwaysOnTop()

void SDL::Window::SetAlwaysOnTop ( bool on_top)
inline

Set the window to always be above the others.

This will add or remove the window's WINDOW_ALWAYS_ON_TOP flag. This will bring the window to the front and keep the window above the rest.

Parameters
on_toptrue to set the window always on top, false to disable.
Exceptions
Erroron failure.
Thread safety:
This function should only be called on the main thread.
Since
This function is available since SDL 3.2.0.
See also
Window.GetFlags

◆ SetAspectRatio()

void SDL::Window::SetAspectRatio ( float min_aspect,
float max_aspect )
inline

Request that the aspect ratio of a window's client area be set.

The aspect ratio is the ratio of width divided by height, e.g. 2560x1600 would be 1.6. Larger aspect ratios are wider and smaller aspect ratios are narrower.

If, at the time of this request, the window in a fixed-size state, such as maximized or fullscreen, the request will be deferred until the window exits this state and becomes resizable again.

On some windowing systems, this request is asynchronous and the new window aspect ratio may not have have been applied immediately upon the return of this function. If an immediate change is required, call Window.Sync() to block until the changes have taken effect.

When the window size changes, an EVENT_WINDOW_RESIZED event will be emitted with the new window dimensions. Note that the new dimensions may not match the exact aspect ratio requested, as some windowing systems can restrict the window size in certain scenarios (e.g. constraining the size of the content area to remain within the usable desktop bounds). Additionally, as this is just a request, it can be denied by the windowing system.

Parameters
min_aspectthe minimum aspect ratio of the window, or 0.0f for no limit.
max_aspectthe maximum aspect ratio of the window, or 0.0f for no limit.
Exceptions
Erroron failure.
Thread safety:
This function should only be called on the main thread.
Since
This function is available since SDL 3.2.0.
See also
Window.GetAspectRatio
Window.Sync

◆ SetBordered()

void SDL::Window::SetBordered ( bool bordered)
inline

Set the border state of a window.

This will add or remove the window's 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.

You can't change the border state of a fullscreen window.

Parameters
borderedfalse to remove border, true to add border.
Exceptions
Erroron failure.
Thread safety:
This function should only be called on the main thread.
Since
This function is available since SDL 3.2.0.
See also
Window.GetFlags

◆ SetFillDocument()

void SDL::Window::SetFillDocument ( bool fill)
inline

Set the window to fill the current document space (Emscripten only).

This will add or remove the window's WINDOW_FILL_DOCUMENT flag.

Currently this flag only applies to the Emscripten target.

When enabled, the canvas element fills the entire document. Resize events will be generated as the browser window is resized, as that will adjust the canvas size as well. The canvas will cover anything else on the page, including any controls provided by Emscripten in its generated HTML file (in fact, any elements on the page that aren't the canvas will be moved into a hidden div element).

Often times this is desirable for a browser-based game, but it means several things that we expect of an SDL window on other platforms might not work as expected, such as minimum window sizes and aspect ratios.

Parameters
filltrue to set the window to fill the document, false to disable.
Exceptions
Erroron failure.
Thread safety:
This function should only be called on the main thread.
Since
This function is available since SDL 3.4.0.
See also
Window.GetFlags

◆ SetFocusable()

void SDL::Window::SetFocusable ( bool focusable)
inline

Set whether the window may have input focus.

Parameters
focusabletrue to allow input focus, false to not allow input focus.
Exceptions
Erroron failure.
Thread safety:
This function should only be called on the main thread.
Since
This function is available since SDL 3.2.0.

◆ SetFullscreen()

void SDL::Window::SetFullscreen ( bool fullscreen)
inline

Request that the window's fullscreen state be changed.

By default a window in fullscreen state uses borderless fullscreen desktop mode, but a specific exclusive display mode can be set using Window.SetFullscreenMode().

On some windowing systems this request is asynchronous and the new fullscreen state may not have have been applied immediately upon the return of this function. If an immediate change is required, call Window.Sync() to block until the changes have taken effect.

When the window state changes, an EVENT_WINDOW_ENTER_FULLSCREEN or EVENT_WINDOW_LEAVE_FULLSCREEN event will be emitted. Note that, as this is just a request, it can be denied by the windowing system.

Parameters
fullscreentrue for fullscreen mode, false for windowed mode.
Exceptions
Erroron failure.
Thread safety:
This function should only be called on the main thread.
Since
This function is available since SDL 3.2.0.
See also
Window.GetFullscreenMode
Window.SetFullscreenMode
Window.Sync
WINDOW_FULLSCREEN

◆ SetFullscreenMode()

void SDL::Window::SetFullscreenMode ( OptionalRef< const DisplayMode > mode)
inline

Set the display mode to use when a window is visible and fullscreen.

This only affects the display mode used when the window is fullscreen. To change the window size when the window is not fullscreen, use Window.SetSize().

If the window is currently in the fullscreen state, this request is asynchronous on some windowing systems and the new mode dimensions may not be applied immediately upon the return of this function. If an immediate change is required, call Window.Sync() to block until the changes have taken effect.

When the new mode takes effect, an EVENT_WINDOW_RESIZED and/or an EVENT_WINDOW_PIXEL_SIZE_CHANGED event will be emitted with the new mode dimensions.

Parameters
modea pointer to the display mode to use, which can be nullptr for borderless fullscreen desktop mode, or one of the fullscreen modes returned by Display.GetFullscreenModes() to set an exclusive fullscreen mode.
Exceptions
Erroron failure.
Thread safety:
This function should only be called on the main thread.
Since
This function is available since SDL 3.2.0.
See also
Window.GetFullscreenMode
Window.SetFullscreen
Window.Sync

◆ SetHitTest() [1/2]

void SDL::Window::SetHitTest ( HitTest callback,
void * callback_data )
inline

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 nullptr for a callback disables hit-testing. Hit-testing is disabled by default.

Platforms that don't support this functionality will return false 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
callbackthe function to call when doing a hit-test.
callback_dataan app-defined void pointer passed to callback.
Exceptions
Erroron failure.
Thread safety:
This function should only be called on the main thread.
Since
This function is available since SDL 3.2.0.

◆ SetHitTest() [2/2]

void SDL::Window::SetHitTest ( HitTestCB callback)
inline

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 nullptr for a callback disables hit-testing. Hit-testing is disabled by default.

Platforms that don't support this functionality will return false 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
callbackthe function to call when doing a hit-test.
Exceptions
Erroron failure.
Thread safety:
This function should only be called on the main thread.
Since
This function is available since SDL 3.2.0.
Category:
Listener callback

◆ SetIcon()

void SDL::Window::SetIcon ( SurfaceRef icon)
inline

Set the icon for a window.

If this function is passed a surface with alternate representations added using Surface.AddAlternateImage(), the surface will be interpreted as the content to be used for 100% display scale, and the alternate representations will be used for high DPI situations. For example, if the original surface is 32x32, then on a 2x macOS display or 200% display scale on Windows, a 64x64 version of the image will be used, if available. If a matching version of the image isn't available, the closest larger size image will be downscaled to the appropriate size and be used instead, if available. Otherwise, the closest smaller image will be upscaled and be used instead.

Parameters
iconan Surface structure containing the icon for the window.
Exceptions
Erroron failure.
Thread safety:
This function should only be called on the main thread.
Since
This function is available since SDL 3.2.0.
See also
Surface.AddAlternateImage

◆ SetKeyboardGrab()

void SDL::Window::SetKeyboardGrab ( bool grabbed)
inline

Set a window's keyboard grab mode.

Keyboard grab enables capture of system keyboard shortcuts like Alt+Tab or the Meta/Super key. Note that not all system keyboard shortcuts can be captured by applications (one example is Ctrl+Alt+Del on Windows).

This is primarily intended for specialized applications such as VNC clients or VM frontends. Normal games should not use keyboard grab.

When keyboard grab is enabled, SDL will continue to handle Alt+Tab when the window is full-screen to ensure the user is not trapped in your application. If you have a custom keyboard shortcut to exit fullscreen mode, you may suppress this behavior with SDL_HINT_ALLOW_ALT_TAB_WHILE_GRABBED.

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.

Parameters
grabbedthis is true to grab keyboard, and false to release.
Exceptions
Erroron failure.
Thread safety:
This function should only be called on the main thread.
Since
This function is available since SDL 3.2.0.
See also
Window.GetKeyboardGrab
Window.SetMouseGrab

◆ SetMaximumSize()

void SDL::Window::SetMaximumSize ( const PointRaw & p)
inline

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

Parameters
pthe maximum width and height of the window, or 0 for no limit.
Exceptions
Erroron failure.
Thread safety:
This function should only be called on the main thread.
Since
This function is available since SDL 3.2.0.
See also
Window.GetMaximumSize
Window.SetMinimumSize

◆ SetMinimumSize()

void SDL::Window::SetMinimumSize ( const PointRaw & p)
inline

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

Parameters
pthe minimum width and heigh of the window, or 0 for no limit.
Exceptions
Erroron failure.
Thread safety:
This function should only be called on the main thread.
Since
This function is available since SDL 3.2.0.
See also
Window.GetMinimumSize
Window.SetMaximumSize

◆ SetModal()

void SDL::Window::SetModal ( bool modal)
inline

Toggle the state of the window as modal.

To enable modal status on a window, the window must currently be the child window of a parent, or toggling modal status on will fail.

Parameters
modaltrue to toggle modal status on, false to toggle it off.
Exceptions
Erroron failure.
Thread safety:
This function should only be called on the main thread.
Since
This function is available since SDL 3.2.0.
See also
Window.SetParent
WINDOW_MODAL

◆ SetMouseGrab()

void SDL::Window::SetMouseGrab ( bool grabbed)
inline

Set a window's mouse grab mode.

Mouse grab confines the mouse cursor to the window.

Parameters
grabbedthis is true to grab mouse, and false to release.
Exceptions
Erroron failure.
Thread safety:
This function should only be called on the main thread.
Since
This function is available since SDL 3.2.0.
See also
Window.GetMouseRect
Window.SetMouseRect
Window.SetKeyboardGrab

◆ SetMouseRect()

void SDL::Window::SetMouseRect ( const RectRaw & rect)
inline

Confines the cursor to the specified area of a window.

Note that this does NOT grab the cursor, it only defines the area a cursor is restricted to when the window has mouse focus.

Parameters
recta rectangle area in window-relative coordinates. If nullptr the barrier for the specified window will be destroyed.
Exceptions
Erroron failure.
Thread safety:
This function should only be called on the main thread.
Since
This function is available since SDL 3.2.0.
See also
Window.GetMouseRect
Window.GetMouseGrab
Window.SetMouseGrab

◆ SetOpacity()

void SDL::Window::SetOpacity ( float opacity)
inline

Set the opacity for a window.

The parameter opacity will be clamped internally between 0.0f (transparent) and 1.0f (opaque).

This function also returns false if setting the opacity isn't supported.

Parameters
opacitythe opacity value (0.0f - transparent, 1.0f - opaque).
Exceptions
Erroron failure.
Thread safety:
This function should only be called on the main thread.
Since
This function is available since SDL 3.2.0.
See also
Window.GetOpacity

◆ SetParent()

void SDL::Window::SetParent ( WindowRef parent)
inline

Set the window as a child of a parent window.

If the window is already the child of an existing window, it will be reparented to the new owner. Setting the parent window to nullptr unparents the window and removes child window status.

If a parent window is hidden or destroyed, the operation will be recursively applied to child windows. Child windows hidden with the parent that did not have their hidden status explicitly set will be restored when the parent is shown.

Attempting to set the parent of a window that is currently in the modal state will fail. Use Window.SetModal() to cancel the modal status before attempting to change the parent.

Popup windows cannot change parents and attempts to do so will fail.

Setting a parent window that is currently the sibling or descendent of the child window results in undefined behavior.

Parameters
parentthe new parent window for the child window.
Exceptions
Erroron failure.
Thread safety:
This function should only be called on the main thread.
Since
This function is available since SDL 3.2.0.
See also
Window.SetModal

◆ SetPosition()

void SDL::Window::SetPosition ( const PointRaw & p)
inline

Request that the window's position be set.

If the window is in an exclusive fullscreen or maximized state, this request has no effect.

This can be used to reposition fullscreen-desktop windows onto a different display, however, as exclusive fullscreen windows are locked to a specific display, they can only be repositioned programmatically via Window.SetFullscreenMode().

On some windowing systems this request is asynchronous and the new coordinates may not have have been applied immediately upon the return of this function. If an immediate change is required, call Window.Sync() to block until the changes have taken effect.

When the window position changes, an EVENT_WINDOW_MOVED event will be emitted with the window's new coordinates. Note that the new coordinates may not match the exact coordinates requested, as some windowing systems can restrict the position of the window in certain scenarios (e.g. constraining the position so the window is always within desktop bounds). Additionally, as this is just a request, it can be denied by the windowing system.

Parameters
pthe coordinates of the window, or WINDOWPOS_CENTERED or WINDOWPOS_UNDEFINED.
Exceptions
Erroron failure.
Thread safety:
This function should only be called on the main thread.
Since
This function is available since SDL 3.2.0.
See also
Window.GetPosition
Window.Sync

◆ SetProgressState()

void SDL::Window::SetProgressState ( ProgressState state)
inline

Sets the state of the progress bar for the given window’s taskbar icon.

Parameters
statethe progress state. PROGRESS_STATE_NONE stops displaying the progress bar.
Exceptions
Erroron failure.
Thread safety:
This function should only be called on the main thread.
Since
This function is available since SDL 3.4.0.

◆ SetProgressValue()

void SDL::Window::SetProgressValue ( float value)
inline

Sets the value of the progress bar for the given window’s taskbar icon.

Parameters
valuethe progress value in the range of [0.0f - 1.0f]. If the value is outside the valid range, it gets clamped.
Exceptions
Erroron failure.
Thread safety:
This function should only be called on the main thread.
Since
This function is available since SDL 3.4.0.

◆ SetRect()

void SDL::Window::SetRect ( Rect rect)
inline

Request the window's position and size to be set.

Parameters
rectthe rect containing the new coordinates
Exceptions
Erroron failure.
Thread safety:
This function should only be called on the main thread.
See also
WindowRef.SetPosition()
WindowRef.SetSize()

◆ SetResizable()

void SDL::Window::SetResizable ( bool resizable)
inline

Set the user-resizable state of a window.

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

You can't change the resizable state of a fullscreen window.

Parameters
resizabletrue to allow resizing, false to disallow.
Exceptions
Erroron failure.
Thread safety:
This function should only be called on the main thread.
Since
This function is available since SDL 3.2.0.
See also
Window.GetFlags

◆ SetShape()

void SDL::Window::SetShape ( SurfaceRef shape)
inline

Set the shape of a transparent window.

This sets the alpha channel of a transparent window and any fully transparent areas are also transparent to mouse clicks. If you are using something besides the SDL render API, then you are responsible for drawing the alpha channel of the window to match the shape alpha channel to get consistent cross-platform results.

The shape is copied inside this function, so you can free it afterwards. If your shape surface changes, you should call Window.SetShape() again to update the window. This is an expensive operation, so should be done sparingly.

The window must have been created with the WINDOW_TRANSPARENT flag.

Parameters
shapethe surface representing the shape of the window, or nullptr to remove any current shape.
Exceptions
Erroron failure.
Thread safety:
This function should only be called on the main thread.
Since
This function is available since SDL 3.2.0.

◆ SetSize()

void SDL::Window::SetSize ( const PointRaw & size)
inline

Request that the size of a window's client area be set.

If the window is in a fullscreen or maximized state, this request has no effect.

To change the exclusive fullscreen mode of a window, use Window.SetFullscreenMode().

On some windowing systems, this request is asynchronous and the new window size may not have have been applied immediately upon the return of this function. If an immediate change is required, call Window.Sync() to block until the changes have taken effect.

When the window size changes, an EVENT_WINDOW_RESIZED event will be emitted with the new window dimensions. Note that the new dimensions may not match the exact size requested, as some windowing systems can restrict the window size in certain scenarios (e.g. constraining the size of the content area to remain within the usable desktop bounds). Additionally, as this is just a request, it can be denied by the windowing system.

Parameters
sizethe width and height of the window, must be > 0.
Exceptions
Erroron failure.
Thread safety:
This function should only be called on the main thread.
Since
This function is available since SDL 3.2.0.
See also
Window.GetSize
Window.SetFullscreenMode
Window.Sync

◆ SetSurfaceVSync()

void SDL::Window::SetSurfaceVSync ( int vsync)
inline

Toggle VSync for the window surface.

When a window surface is created, vsync defaults to WINDOW_SURFACE_VSYNC_DISABLED.

The vsync parameter can be 1 to synchronize present with every vertical refresh, 2 to synchronize present with every second vertical refresh, etc., WINDOW_SURFACE_VSYNC_ADAPTIVE for late swap tearing (adaptive vsync), or WINDOW_SURFACE_VSYNC_DISABLED to disable. Not every value is supported by every driver, so you should check the return value to see whether the requested setting is supported.

Parameters
vsyncthe vertical refresh sync interval.
Exceptions
Erroron failure.
Thread safety:
This function should only be called on the main thread.
Since
This function is available since SDL 3.2.0.
See also
Window.GetSurfaceVSync

◆ SetTitle()

void SDL::Window::SetTitle ( StringParam title)
inline

Set the title of a window.

This string is expected to be in UTF-8 encoding.

Parameters
titlethe desired window title in UTF-8 format.
Exceptions
Erroron failure.
Thread safety:
This function should only be called on the main thread.
Since
This function is available since SDL 3.2.0.
See also
Window.GetTitle

◆ SetWindowAlwaysOnTop()

void SDL::SetWindowAlwaysOnTop ( WindowRef window,
bool on_top )
inline

Set the window to always be above the others.

This will add or remove the window's WINDOW_ALWAYS_ON_TOP flag. This will bring the window to the front and keep the window above the rest.

Parameters
windowthe window of which to change the always on top state.
on_toptrue to set the window always on top, false to disable.
Exceptions
Erroron failure.
Thread safety:
This function should only be called on the main thread.
Since
This function is available since SDL 3.2.0.
See also
Window.GetFlags

◆ SetWindowAspectRatio()

void SDL::SetWindowAspectRatio ( WindowRef window,
float min_aspect,
float max_aspect )
inline

Request that the aspect ratio of a window's client area be set.

The aspect ratio is the ratio of width divided by height, e.g. 2560x1600 would be 1.6. Larger aspect ratios are wider and smaller aspect ratios are narrower.

If, at the time of this request, the window in a fixed-size state, such as maximized or fullscreen, the request will be deferred until the window exits this state and becomes resizable again.

On some windowing systems, this request is asynchronous and the new window aspect ratio may not have have been applied immediately upon the return of this function. If an immediate change is required, call Window.Sync() to block until the changes have taken effect.

When the window size changes, an EVENT_WINDOW_RESIZED event will be emitted with the new window dimensions. Note that the new dimensions may not match the exact aspect ratio requested, as some windowing systems can restrict the window size in certain scenarios (e.g. constraining the size of the content area to remain within the usable desktop bounds). Additionally, as this is just a request, it can be denied by the windowing system.

Parameters
windowthe window to change.
min_aspectthe minimum aspect ratio of the window, or 0.0f for no limit.
max_aspectthe maximum aspect ratio of the window, or 0.0f for no limit.
Exceptions
Erroron failure.
Thread safety:
This function should only be called on the main thread.
Since
This function is available since SDL 3.2.0.
See also
Window.GetAspectRatio
Window.Sync

◆ SetWindowBordered()

void SDL::SetWindowBordered ( WindowRef window,
bool bordered )
inline

Set the border state of a window.

This will add or remove the window's 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.

You can't change the border state of a fullscreen window.

Parameters
windowthe window of which to change the border state.
borderedfalse to remove border, true to add border.
Exceptions
Erroron failure.
Thread safety:
This function should only be called on the main thread.
Since
This function is available since SDL 3.2.0.
See also
Window.GetFlags

◆ SetWindowFillDocument()

void SDL::SetWindowFillDocument ( WindowRef window,
bool fill )
inline

Set the window to fill the current document space (Emscripten only).

This will add or remove the window's WINDOW_FILL_DOCUMENT flag.

Currently this flag only applies to the Emscripten target.

When enabled, the canvas element fills the entire document. Resize events will be generated as the browser window is resized, as that will adjust the canvas size as well. The canvas will cover anything else on the page, including any controls provided by Emscripten in its generated HTML file (in fact, any elements on the page that aren't the canvas will be moved into a hidden div element).

Often times this is desirable for a browser-based game, but it means several things that we expect of an SDL window on other platforms might not work as expected, such as minimum window sizes and aspect ratios.

Parameters
windowthe window of which to change the fill-document state.
filltrue to set the window to fill the document, false to disable.
Exceptions
Erroron failure.
Thread safety:
This function should only be called on the main thread.
Since
This function is available since SDL 3.4.0.
See also
Window.GetFlags

◆ SetWindowFocusable()

void SDL::SetWindowFocusable ( WindowRef window,
bool focusable )
inline

Set whether the window may have input focus.

Parameters
windowthe window to set focusable state.
focusabletrue to allow input focus, false to not allow input focus.
Exceptions
Erroron failure.
Thread safety:
This function should only be called on the main thread.
Since
This function is available since SDL 3.2.0.

◆ SetWindowFullscreen()

void SDL::SetWindowFullscreen ( WindowRef window,
bool fullscreen )
inline

Request that the window's fullscreen state be changed.

By default a window in fullscreen state uses borderless fullscreen desktop mode, but a specific exclusive display mode can be set using Window.SetFullscreenMode().

On some windowing systems this request is asynchronous and the new fullscreen state may not have have been applied immediately upon the return of this function. If an immediate change is required, call Window.Sync() to block until the changes have taken effect.

When the window state changes, an EVENT_WINDOW_ENTER_FULLSCREEN or EVENT_WINDOW_LEAVE_FULLSCREEN event will be emitted. Note that, as this is just a request, it can be denied by the windowing system.

Parameters
windowthe window to change.
fullscreentrue for fullscreen mode, false for windowed mode.
Exceptions
Erroron failure.
Thread safety:
This function should only be called on the main thread.
Since
This function is available since SDL 3.2.0.
See also
Window.GetFullscreenMode
Window.SetFullscreenMode
Window.Sync
WINDOW_FULLSCREEN

◆ SetWindowFullscreenMode()

void SDL::SetWindowFullscreenMode ( WindowRef window,
OptionalRef< const DisplayMode > mode )
inline

Set the display mode to use when a window is visible and fullscreen.

This only affects the display mode used when the window is fullscreen. To change the window size when the window is not fullscreen, use Window.SetSize().

If the window is currently in the fullscreen state, this request is asynchronous on some windowing systems and the new mode dimensions may not be applied immediately upon the return of this function. If an immediate change is required, call Window.Sync() to block until the changes have taken effect.

When the new mode takes effect, an EVENT_WINDOW_RESIZED and/or an EVENT_WINDOW_PIXEL_SIZE_CHANGED event will be emitted with the new mode dimensions.

Parameters
windowthe window to affect.
modea pointer to the display mode to use, which can be nullptr for borderless fullscreen desktop mode, or one of the fullscreen modes returned by Display.GetFullscreenModes() to set an exclusive fullscreen mode.
Exceptions
Erroron failure.
Thread safety:
This function should only be called on the main thread.
Since
This function is available since SDL 3.2.0.
See also
Window.GetFullscreenMode
Window.SetFullscreen
Window.Sync

◆ SetWindowHitTest() [1/2]

void SDL::SetWindowHitTest ( WindowRef window,
HitTest callback,
void * callback_data )
inline

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 nullptr for a callback disables hit-testing. Hit-testing is disabled by default.

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

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

Parameters
windowthe window to set hit-testing on.
callbackthe function to call when doing a hit-test.
callback_dataan app-defined void pointer passed to callback.
Exceptions
Erroron failure.
Thread safety:
This function should only be called on the main thread.
Since
This function is available since SDL 3.2.0.

◆ SetWindowHitTest() [2/2]

void SDL::SetWindowHitTest ( WindowRef window,
HitTestCB callback )
inline

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 nullptr for a callback disables hit-testing. Hit-testing is disabled by default.

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

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

Parameters
windowthe window to set hit-testing on.
callbackthe function to call when doing a hit-test.
Exceptions
Erroron failure.
Thread safety:
This function should only be called on the main thread.
Since
This function is available since SDL 3.2.0.

◆ SetWindowIcon()

void SDL::SetWindowIcon ( WindowRef window,
SurfaceRef icon )
inline

Set the icon for a window.

If this function is passed a surface with alternate representations added using Surface.AddAlternateImage(), the surface will be interpreted as the content to be used for 100% display scale, and the alternate representations will be used for high DPI situations. For example, if the original surface is 32x32, then on a 2x macOS display or 200% display scale on Windows, a 64x64 version of the image will be used, if available. If a matching version of the image isn't available, the closest larger size image will be downscaled to the appropriate size and be used instead, if available. Otherwise, the closest smaller image will be upscaled and be used instead.

Parameters
windowthe window to change.
iconan Surface structure containing the icon for the window.
Exceptions
Erroron failure.
Thread safety:
This function should only be called on the main thread.
Since
This function is available since SDL 3.2.0.
See also
Surface.AddAlternateImage

◆ SetWindowKeyboardGrab()

void SDL::SetWindowKeyboardGrab ( WindowRef window,
bool grabbed )
inline

Set a window's keyboard grab mode.

Keyboard grab enables capture of system keyboard shortcuts like Alt+Tab or the Meta/Super key. Note that not all system keyboard shortcuts can be captured by applications (one example is Ctrl+Alt+Del on Windows).

This is primarily intended for specialized applications such as VNC clients or VM frontends. Normal games should not use keyboard grab.

When keyboard grab is enabled, SDL will continue to handle Alt+Tab when the window is full-screen to ensure the user is not trapped in your application. If you have a custom keyboard shortcut to exit fullscreen mode, you may suppress this behavior with SDL_HINT_ALLOW_ALT_TAB_WHILE_GRABBED.

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.

Parameters
windowthe window for which the keyboard grab mode should be set.
grabbedthis is true to grab keyboard, and false to release.
Exceptions
Erroron failure.
Thread safety:
This function should only be called on the main thread.
Since
This function is available since SDL 3.2.0.
See also
Window.GetKeyboardGrab
Window.SetMouseGrab

◆ SetWindowMaximumSize()

void SDL::SetWindowMaximumSize ( WindowRef window,
const PointRaw & p )
inline

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

Parameters
windowthe window to change.
pthe maximum width and height of the window, or 0 for no limit.
Exceptions
Erroron failure.
Thread safety:
This function should only be called on the main thread.
Since
This function is available since SDL 3.2.0.
See also
Window.GetMaximumSize
Window.SetMinimumSize

◆ SetWindowMinimumSize()

void SDL::SetWindowMinimumSize ( WindowRef window,
const PointRaw & p )
inline

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

Parameters
windowthe window to change.
pthe minimum width and height of the window, or 0 for no limit.
Exceptions
Erroron failure.
Thread safety:
This function should only be called on the main thread.
Since
This function is available since SDL 3.2.0.
See also
Window.GetMinimumSize
Window.SetMaximumSize

◆ SetWindowModal()

void SDL::SetWindowModal ( WindowRef window,
bool modal )
inline

Toggle the state of the window as modal.

To enable modal status on a window, the window must currently be the child window of a parent, or toggling modal status on will fail.

Parameters
windowthe window on which to set the modal state.
modaltrue to toggle modal status on, false to toggle it off.
Exceptions
Erroron failure.
Thread safety:
This function should only be called on the main thread.
Since
This function is available since SDL 3.2.0.
See also
Window.SetParent
WINDOW_MODAL

◆ SetWindowMouseGrab()

void SDL::SetWindowMouseGrab ( WindowRef window,
bool grabbed )
inline

Set a window's mouse grab mode.

Mouse grab confines the mouse cursor to the window.

Parameters
windowthe window for which the mouse grab mode should be set.
grabbedthis is true to grab mouse, and false to release.
Exceptions
Erroron failure.
Thread safety:
This function should only be called on the main thread.
Since
This function is available since SDL 3.2.0.
See also
Window.GetMouseRect
Window.SetMouseRect
Window.SetKeyboardGrab

◆ SetWindowMouseRect()

void SDL::SetWindowMouseRect ( WindowRef window,
const RectRaw & rect )
inline

Confines the cursor to the specified area of a window.

Note that this does NOT grab the cursor, it only defines the area a cursor is restricted to when the window has mouse focus.

Parameters
windowthe window that will be associated with the barrier.
recta rectangle area in window-relative coordinates. If nullptr the barrier for the specified window will be destroyed.
Exceptions
Erroron failure.
Thread safety:
This function should only be called on the main thread.
Since
This function is available since SDL 3.2.0.
See also
Window.GetMouseRect
Window.GetMouseGrab
Window.SetMouseGrab

◆ SetWindowOpacity()

void SDL::SetWindowOpacity ( WindowRef window,
float opacity )
inline

Set the opacity for a window.

The parameter opacity will be clamped internally between 0.0f (transparent) and 1.0f (opaque).

This function also returns false if setting the opacity isn't supported.

Parameters
windowthe window which will be made transparent or opaque.
opacitythe opacity value (0.0f - transparent, 1.0f - opaque).
Exceptions
Erroron failure.
Thread safety:
This function should only be called on the main thread.
Since
This function is available since SDL 3.2.0.
See also
Window.GetOpacity

◆ SetWindowParent()

void SDL::SetWindowParent ( WindowRef window,
WindowRef parent )
inline

Set the window as a child of a parent window.

If the window is already the child of an existing window, it will be reparented to the new owner. Setting the parent window to nullptr unparents the window and removes child window status.

If a parent window is hidden or destroyed, the operation will be recursively applied to child windows. Child windows hidden with the parent that did not have their hidden status explicitly set will be restored when the parent is shown.

Attempting to set the parent of a window that is currently in the modal state will fail. Use Window.SetModal() to cancel the modal status before attempting to change the parent.

Popup windows cannot change parents and attempts to do so will fail.

Setting a parent window that is currently the sibling or descendent of the child window results in undefined behavior.

Parameters
windowthe window that should become the child of a parent.
parentthe new parent window for the child window.
Exceptions
Erroron failure.
Thread safety:
This function should only be called on the main thread.
Since
This function is available since SDL 3.2.0.
See also
Window.SetModal

◆ SetWindowPosition()

void SDL::SetWindowPosition ( WindowRef window,
const PointRaw & p )
inline

Request that the window's position be set.

If the window is in an exclusive fullscreen or maximized state, this request has no effect.

This can be used to reposition fullscreen-desktop windows onto a different display, however, as exclusive fullscreen windows are locked to a specific display, they can only be repositioned programmatically via Window.SetFullscreenMode().

On some windowing systems this request is asynchronous and the new coordinates may not have have been applied immediately upon the return of this function. If an immediate change is required, call Window.Sync() to block until the changes have taken effect.

When the window position changes, an EVENT_WINDOW_MOVED event will be emitted with the window's new coordinates. Note that the new coordinates may not match the exact coordinates requested, as some windowing systems can restrict the position of the window in certain scenarios (e.g. constraining the position so the window is always within desktop bounds). Additionally, as this is just a request, it can be denied by the windowing system.

Parameters
windowthe window to reposition.
pthe coordinates of the window, or WINDOWPOS_CENTERED or WINDOWPOS_UNDEFINED.
Exceptions
Erroron failure.
Thread safety:
This function should only be called on the main thread.
Since
This function is available since SDL 3.2.0.
See also
Window.GetPosition
Window.Sync

◆ SetWindowProgressState()

void SDL::SetWindowProgressState ( WindowRef window,
ProgressState state )
inline

Sets the state of the progress bar for the given window’s taskbar icon.

Parameters
windowthe window whose progress state is to be modified.
statethe progress state. PROGRESS_STATE_NONE stops displaying the progress bar.
Exceptions
Erroron failure.
Thread safety:
This function should only be called on the main thread.
Since
This function is available since SDL 3.4.0.

◆ SetWindowProgressValue()

void SDL::SetWindowProgressValue ( WindowRef window,
float value )
inline

Sets the value of the progress bar for the given window’s taskbar icon.

Parameters
windowthe window whose progress value is to be modified.
valuethe progress value in the range of [0.0f - 1.0f]. If the value is outside the valid range, it gets clamped.
Exceptions
Erroron failure.
Thread safety:
This function should only be called on the main thread.
Since
This function is available since SDL 3.4.0.

◆ SetWindowRect()

void SDL::SetWindowRect ( WindowRef window,
Rect rect )
inline

Request the window's position and size to be set.

Parameters
windowthe window to query the width and height from.
rectthe rect containing the new coordinates
Exceptions
Erroron failure.
Thread safety:
This function should only be called on the main thread.
See also
WindowRef.SetPosition()
WindowRef.SetSize()

◆ SetWindowResizable()

void SDL::SetWindowResizable ( WindowRef window,
bool resizable )
inline

Set the user-resizable state of a window.

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

You can't change the resizable state of a fullscreen window.

Parameters
windowthe window of which to change the resizable state.
resizabletrue to allow resizing, false to disallow.
Exceptions
Erroron failure.
Thread safety:
This function should only be called on the main thread.
Since
This function is available since SDL 3.2.0.
See also
Window.GetFlags

◆ SetWindowShape()

void SDL::SetWindowShape ( WindowRef window,
SurfaceRef shape )
inline

Set the shape of a transparent window.

This sets the alpha channel of a transparent window and any fully transparent areas are also transparent to mouse clicks. If you are using something besides the SDL render API, then you are responsible for drawing the alpha channel of the window to match the shape alpha channel to get consistent cross-platform results.

The shape is copied inside this function, so you can free it afterwards. If your shape surface changes, you should call Window.SetShape() again to update the window. This is an expensive operation, so should be done sparingly.

The window must have been created with the WINDOW_TRANSPARENT flag.

Parameters
windowthe window.
shapethe surface representing the shape of the window, or nullptr to remove any current shape.
Exceptions
Erroron failure.
Thread safety:
This function should only be called on the main thread.
Since
This function is available since SDL 3.2.0.

◆ SetWindowSize()

void SDL::SetWindowSize ( WindowRef window,
const PointRaw & size )
inline

Request that the size of a window's client area be set.

If the window is in a fullscreen or maximized state, this request has no effect.

To change the exclusive fullscreen mode of a window, use Window.SetFullscreenMode().

On some windowing systems, this request is asynchronous and the new window size may not have have been applied immediately upon the return of this function. If an immediate change is required, call Window.Sync() to block until the changes have taken effect.

When the window size changes, an EVENT_WINDOW_RESIZED event will be emitted with the new window dimensions. Note that the new dimensions may not match the exact size requested, as some windowing systems can restrict the window size in certain scenarios (e.g. constraining the size of the content area to remain within the usable desktop bounds). Additionally, as this is just a request, it can be denied by the windowing system.

Parameters
windowthe window to change.
sizethe width and height of the window, must be > 0.
Exceptions
Erroron failure.
Thread safety:
This function should only be called on the main thread.
Since
This function is available since SDL 3.2.0.
See also
Window.GetSize
Window.SetFullscreenMode
Window.Sync

◆ SetWindowSurfaceVSync()

void SDL::SetWindowSurfaceVSync ( WindowRef window,
int vsync )
inline

Toggle VSync for the window surface.

When a window surface is created, vsync defaults to WINDOW_SURFACE_VSYNC_DISABLED.

The vsync parameter can be 1 to synchronize present with every vertical refresh, 2 to synchronize present with every second vertical refresh, etc., WINDOW_SURFACE_VSYNC_ADAPTIVE for late swap tearing (adaptive vsync), or WINDOW_SURFACE_VSYNC_DISABLED to disable. Not every value is supported by every driver, so you should check the return value to see whether the requested setting is supported.

Parameters
windowthe window.
vsyncthe vertical refresh sync interval.
Exceptions
Erroron failure.
Thread safety:
This function should only be called on the main thread.
Since
This function is available since SDL 3.2.0.
See also
Window.GetSurfaceVSync

◆ SetWindowTitle()

void SDL::SetWindowTitle ( WindowRef window,
StringParam title )
inline

Set the title of a window.

This string is expected to be in UTF-8 encoding.

Parameters
windowthe window to change.
titlethe desired window title in UTF-8 format.
Exceptions
Erroron failure.
Thread safety:
This function should only be called on the main thread.
Since
This function is available since SDL 3.2.0.
See also
Window.GetTitle

◆ Show()

void SDL::Window::Show ( )
inline

Show a window.

Exceptions
Erroron failure.
Thread safety:
This function should only be called on the main thread.
Since
This function is available since SDL 3.2.0.
See also
Window.Hide
Window.Raise

◆ ShowSystemMenu()

void SDL::Window::ShowSystemMenu ( const PointRaw & p)
inline

Display the system-level window menu.

This default window menu is provided by the system and on some platforms provides functionality for setting or changing privileged state on the window, such as moving it between workspaces or displays, or toggling the always-on-top property.

On platforms or desktops where this is unsupported, this function does nothing.

Parameters
pthe x, y coordinates of the menu, relative to the origin (top-left) of the client area.
Exceptions
Erroron failure.
Thread safety:
This function should only be called on the main thread.
Since
This function is available since SDL 3.2.0.

◆ ShowWindow()

void SDL::ShowWindow ( WindowRef window)
inline

Show a window.

Parameters
windowthe window to show.
Exceptions
Erroron failure.
Thread safety:
This function should only be called on the main thread.
Since
This function is available since SDL 3.2.0.
See also
Window.Hide
Window.Raise

◆ ShowWindowSystemMenu()

void SDL::ShowWindowSystemMenu ( WindowRef window,
const PointRaw & p )
inline

Display the system-level window menu.

This default window menu is provided by the system and on some platforms provides functionality for setting or changing privileged state on the window, such as moving it between workspaces or displays, or toggling the always-on-top property.

On platforms or desktops where this is unsupported, this function does nothing.

Parameters
windowthe window for which the menu will be displayed.
pthe coordinates of the menu, relative to the origin (top-left) of the client area.
Exceptions
Erroron failure.
Thread safety:
This function should only be called on the main thread.
Since
This function is available since SDL 3.2.0.

◆ Sync()

bool SDL::Window::Sync ( )
inline

Block until any pending window state is finalized.

On asynchronous windowing systems, this acts as a synchronization barrier for pending window state. It will attempt to wait until any pending window state has been applied and is guaranteed to return within finite time. Note that for how long it can potentially block depends on the underlying window system, as window state changes may involve somewhat lengthy animations that must complete before the window is in its final requested state.

On windowing systems where changes are immediate, this does nothing.

Returns
true on success or false if the operation timed out before the window was in the requested state.
Thread safety:
This function should only be called on the main thread.
Since
This function is available since SDL 3.2.0.
See also
Window.SetSize
Window.SetPosition
Window.SetFullscreen
Window.Minimize
Window.Maximize
Window.Restore
SDL_HINT_VIDEO_SYNC_WINDOW_OPERATIONS

◆ SyncWindow()

bool SDL::SyncWindow ( WindowRef window)
inline

Block until any pending window state is finalized.

On asynchronous windowing systems, this acts as a synchronization barrier for pending window state. It will attempt to wait until any pending window state has been applied and is guaranteed to return within finite time. Note that for how long it can potentially block depends on the underlying window system, as window state changes may involve somewhat lengthy animations that must complete before the window is in its final requested state.

On windowing systems where changes are immediate, this does nothing.

Parameters
windowthe window for which to wait for the pending state to be applied.
Returns
true on success or false if the operation timed out before the window was in the requested state.
Thread safety:
This function should only be called on the main thread.
Since
This function is available since SDL 3.2.0.
See also
Window.SetSize
Window.SetPosition
Window.SetFullscreen
Window.Minimize
Window.Maximize
Window.Restore
SDL_HINT_VIDEO_SYNC_WINDOW_OPERATIONS

◆ UpdateSurface()

void SDL::Window::UpdateSurface ( )
inline

Copy the window surface to the screen.

This is the function you use to reflect any changes to the surface on the screen.

This function is equivalent to the SDL 1.2 API SDL_Flip().

Exceptions
Erroron failure.
Thread safety:
This function should only be called on the main thread.
Since
This function is available since SDL 3.2.0.
See also
Window.GetSurface
Window.UpdateSurfaceRects

◆ UpdateSurfaceRects()

void SDL::Window::UpdateSurfaceRects ( SpanRef< const RectRaw > rects)
inline

Copy areas of the window surface to the screen.

This is the function you use to reflect changes to portions of the surface on the screen.

This function is equivalent to the SDL 1.2 API SDL_UpdateRects().

Note that this function will update at least the rectangles specified, but this is only intended as an optimization; in practice, this might update more of the screen (or all of the screen!), depending on what method SDL uses to send pixels to the system.

Parameters
rectsan array of Rect structures representing areas of the surface to copy, in pixels.
Exceptions
Erroron failure.
Thread safety:
This function should only be called on the main thread.
Since
This function is available since SDL 3.2.0.
See also
Window.GetSurface
Window.UpdateSurface

◆ UpdateWindowSurface()

void SDL::UpdateWindowSurface ( WindowRef window)
inline

Copy the window surface to the screen.

This is the function you use to reflect any changes to the surface on the screen.

This function is equivalent to the SDL 1.2 API SDL_Flip().

Parameters
windowthe window to update.
Exceptions
Erroron failure.
Thread safety:
This function should only be called on the main thread.
Since
This function is available since SDL 3.2.0.
See also
Window.GetSurface
Window.UpdateSurfaceRects

◆ UpdateWindowSurfaceRects()

void SDL::UpdateWindowSurfaceRects ( WindowRef window,
SpanRef< const RectRaw > rects )
inline

Copy areas of the window surface to the screen.

This is the function you use to reflect changes to portions of the surface on the screen.

This function is equivalent to the SDL 1.2 API SDL_UpdateRects().

Note that this function will update at least the rectangles specified, but this is only intended as an optimization; in practice, this might update more of the screen (or all of the screen!), depending on what method SDL uses to send pixels to the system.

Parameters
windowthe window to update.
rectsan array of Rect structures representing areas of the surface to copy, in pixels.
Exceptions
Erroron failure.
Thread safety:
This function should only be called on the main thread.
Since
This function is available since SDL 3.2.0.
See also
Window.GetSurface
Window.UpdateSurface

◆ Window() [1/3]

SDL::Window::Window ( PropertiesRef props)
inline

Create a window with the specified properties.

The window size is a request and may be different than expected based on the desktop layout and window manager policies. Your application should be prepared to handle a window of any size.

These are the supported properties:

These are additional supported properties on macOS:

These are additional supported properties on iOS, tvOS, and visionOS:

These are additional supported properties on Wayland:

These are additional supported properties on Windows:

These are additional supported properties with X11:

The window is implicitly shown if the "hidden" property is not set.

These are additional supported properties with Emscripten:

  • prop.Window.Create.EMSCRIPTEN_CANVAS_ID_STRING: the id given to the canvas element. This should start with a '#' sign
  • prop.Window.Create.EMSCRIPTEN_KEYBOARD_ELEMENT_STRING: override the binding element for keyboard inputs for this canvas. The variable can be one of:
  • "#window": the javascript window object (default)
  • "#document": the javascript document object
  • "#screen": the javascript window.screen object
  • "#canvas": the WebGL canvas element
  • "#none": Don't bind anything at all
  • any other string without a leading # sign applies to the element on the page with that ID. Windows with the "tooltip" and "menu" properties are popup windows and have the behaviors and guidelines outlined in CreatePopupWindow().

If this window is being created to be used with an Renderer, you should not add a graphics API specific property (prop.Window.Create.OPENGL_BOOLEAN, etc), as SDL will handle that internally when it chooses a renderer. However, SDL might need to recreate your window at that point, which may cause the window to appear briefly, and then flicker as it is recreated. The correct approach to this is to create the window with the prop.Window.Create.HIDDEN_BOOLEAN property set to true, then create the renderer, then show the window with Window.Show().

Parameters
propsthe properties to use.
Postcondition
the window that was created or nullptr on failure; call GetError() for more information.
Thread safety:
This function should only be called on the main thread.
Since
This function is available since SDL 3.2.0.
See also
Properties.Create
CreateWindow
Window.Destroy

◆ Window() [2/3]

SDL::Window::Window ( StringParam title,
const PointRaw & size,
WindowFlags flags = 0 )
inline

Create a window with the specified dimensions and flags.

The window size is a request and may be different than expected based on the desktop layout and window manager policies. Your application should be prepared to handle a window of any size.

flags may be any of the following OR'd together:

The Window will be shown if WINDOW_HIDDEN is not set. If hidden at creation time, Window.Show() can be used to show it later.

On Apple's macOS, you must set the NSHighResolutionCapable Info.plist property to YES, otherwise you will not receive a High-DPI OpenGL canvas.

The window pixel size may differ from its window coordinate size if the window is on a high pixel density display. Use Window.GetSize() to query the client area's size in window coordinates, and Window.GetSizeInPixels() or Renderer.GetOutputSize() to query the drawable size in pixels. Note that the drawable size can vary after the window is created and should be queried again if you get an EVENT_WINDOW_PIXEL_SIZE_CHANGED event.

If the window is created with any of the WINDOW_OPENGL or WINDOW_VULKAN flags, then the corresponding LoadLibrary function (GL_LoadLibrary or Vulkan_LoadLibrary) is called and the corresponding UnloadLibrary function is called by Window.Destroy().

If WINDOW_VULKAN is specified and there isn't a working Vulkan driver, CreateWindow() will fail, because Vulkan_LoadLibrary() will fail.

If WINDOW_METAL is specified on an OS that does not support Metal, CreateWindow() will fail.

If you intend to use this window with an Renderer, you should use CreateWindowAndRenderer() instead of this function, to avoid window flicker.

On non-Apple devices, SDL requires you to either not link to the Vulkan loader or link to a dynamic library version. This limitation may be removed in a future version of SDL.

Parameters
titlethe title of the window, in UTF-8 encoding.
sizethe width and height of the window.
flags0, or one or more WindowFlags OR'd together.
Postcondition
the window that was created or nullptr on failure; call GetError() for more information.
Thread safety:
This function should only be called on the main thread.
Since
This function is available since SDL 3.2.0.
See also
CreateWindowAndRenderer
CreatePopupWindow
CreateWindowWithProperties
Window.Destroy

◆ Window() [3/3]

SDL::Window::Window ( WindowRef parent,
const PointRaw & offset,
const PointRaw & size,
WindowFlags flags = 0 )
inline

Create a child popup window of the specified parent window.

The window size is a request and may be different than expected based on the desktop layout and window manager policies. Your application should be prepared to handle a window of any size.

The flags parameter must contain at least one of the following:

  • WINDOW_TOOLTIP: The popup window is a tooltip and will not pass any input events.
  • WINDOW_POPUP_MENU: The popup window is a popup menu. The topmost popup menu will implicitly gain the keyboard focus.

The following flags are not relevant to popup window creation and will be ignored:

The following flags are incompatible with popup window creation and will cause it to fail:

The parent parameter must be non-null and a valid window. The parent of a popup window can be either a regular, toplevel window, or another popup window.

Popup windows cannot be minimized, maximized, made fullscreen, raised, flash, be made a modal window, be the parent of a toplevel window, or grab the mouse and/or keyboard. Attempts to do so will fail.

Popup windows implicitly do not have a border/decorations and do not appear on the taskbar/dock or in lists of windows such as alt-tab menus.

By default, popup window positions will automatically be constrained to keep the entire window within display bounds. This can be overridden with the prop.Window.Create.CONSTRAIN_POPUP_BOOLEAN property.

By default, popup menus will automatically grab keyboard focus from the parent when shown. This behavior can be overridden by setting the WINDOW_NOT_FOCUSABLE flag, setting the prop.Window.Create.FOCUSABLE_BOOLEAN property to false, or toggling it after creation via the Window.SetFocusable() function.

If a parent window is hidden or destroyed, any child popup windows will be recursively hidden or destroyed as well. Child popup windows not explicitly hidden will be restored when the parent is shown.

Parameters
parentthe parent of the window, must not be nullptr.
offsetthe x, y position of the popup window relative to the origin of the parent.
sizethe width and height of the window.
flagsWINDOW_TOOLTIP or WINDOW_POPUP_MENU, and zero or more additional WindowFlags OR'd together.
Postcondition
the window that was created or nullptr on failure; call GetError() for more information.
Thread safety:
This function should only be called on the main thread.
Since
This function is available since SDL 3.2.0.
See also
CreateWindow
CreateWindowWithProperties
Window.Destroy
Window.GetParent

◆ WindowHasSurface()

bool SDL::WindowHasSurface ( WindowRef window)
inline

Return whether the window has a surface associated with it.

Parameters
windowthe window to query.
Returns
true if there is a surface associated with the window, or false otherwise.
Thread safety:
This function should only be called on the main thread.
Since
This function is available since SDL 3.2.0.
See also
Window.GetSurface

◆ WINDOWPOS_CENTERED_DISPLAY()

int SDL::WINDOWPOS_CENTERED_DISPLAY ( int X)
constexpr

Used to indicate that the window position should be centered.

WINDOWPOS_CENTERED is the same, but always uses the primary display instead of specifying one.

Parameters
Xthe Display of the display to use.
Since
This function is available since SDL 3.2.0.
See also
Window.SetPosition

◆ WINDOWPOS_ISCENTERED()

bool SDL::WINDOWPOS_ISCENTERED ( int X)
constexpr

A macro to test if the window position is marked as "centered.".

Parameters
Xthe window position value.
Since
This function is available since SDL 3.2.0.
See also
Window.GetPosition

◆ WINDOWPOS_ISUNDEFINED()

bool SDL::WINDOWPOS_ISUNDEFINED ( int X)
constexpr

A macro to test if the window position is marked as "undefined.".

Parameters
Xthe window position value.
Since
This function is available since SDL 3.2.0.
See also
Window.SetPosition

◆ WINDOWPOS_UNDEFINED_DISPLAY()

int SDL::WINDOWPOS_UNDEFINED_DISPLAY ( int X)
constexpr

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

If you really don't care, WINDOWPOS_UNDEFINED is the same, but always uses the primary display instead of specifying one.

Parameters
Xthe Display of the display to use.
Since
This function is available since SDL 3.2.0.
See also
Window.SetPosition

Variable Documentation

◆ FLASH_BRIEFLY

FlashOperation SDL::FLASH_BRIEFLY
constexpr
Initial value:
=
SDL_FLASH_BRIEFLY

Flash the window briefly to get attention.

◆ FLASH_CANCEL

FlashOperation SDL::FLASH_CANCEL
constexpr
Initial value:
=
SDL_FLASH_CANCEL

Cancel any window flash state.

◆ FLASH_UNTIL_FOCUSED

FlashOperation SDL::FLASH_UNTIL_FOCUSED
constexpr
Initial value:
=
SDL_FLASH_UNTIL_FOCUSED

Flash the window until it gets focus.

◆ GL_CONTEXT_DEBUG_FLAG

GLContextFlag SDL::GL_CONTEXT_DEBUG_FLAG
constexpr
Initial value:
=
SDL_GL_CONTEXT_DEBUG_FLAG

DEBUG_FLAG.

◆ GL_CONTEXT_FORWARD_COMPATIBLE_FLAG

GLContextFlag SDL::GL_CONTEXT_FORWARD_COMPATIBLE_FLAG
constexpr
Initial value:
=
SDL_GL_CONTEXT_FORWARD_COMPATIBLE_FLAG

FORWARD_COMPATIBLE_FLAG.

◆ GL_CONTEXT_MAJOR_VERSION

GLAttr SDL::GL_CONTEXT_MAJOR_VERSION
constexpr
Initial value:
=
SDL_GL_CONTEXT_MAJOR_VERSION

OpenGL context major version.

◆ GL_CONTEXT_MINOR_VERSION

GLAttr SDL::GL_CONTEXT_MINOR_VERSION
constexpr
Initial value:
=
SDL_GL_CONTEXT_MINOR_VERSION

OpenGL context minor version.

◆ GL_CONTEXT_NO_ERROR

GLAttr SDL::GL_CONTEXT_NO_ERROR
constexpr
Initial value:
=
SDL_GL_CONTEXT_NO_ERROR

GL_CONTEXT_NO_ERROR.

◆ GL_CONTEXT_PROFILE_COMPATIBILITY

GLProfile SDL::GL_CONTEXT_PROFILE_COMPATIBILITY
constexpr
Initial value:
=
SDL_GL_CONTEXT_PROFILE_COMPATIBILITY

OpenGL Compatibility Profile context.

◆ GL_CONTEXT_PROFILE_CORE

GLProfile SDL::GL_CONTEXT_PROFILE_CORE
constexpr
Initial value:
=
SDL_GL_CONTEXT_PROFILE_CORE

OpenGL Core Profile context.

◆ GL_CONTEXT_PROFILE_ES

GLProfile SDL::GL_CONTEXT_PROFILE_ES
constexpr
Initial value:
=
SDL_GL_CONTEXT_PROFILE_ES

GLX_CONTEXT_ES2_PROFILE_BIT_EXT.

◆ GL_CONTEXT_PROFILE_MASK

GLAttr SDL::GL_CONTEXT_PROFILE_MASK = SDL_GL_CONTEXT_PROFILE_MASK
constexpr

type of GL context (Core, Compatibility, ES).

See GLProfile; default value depends on platform.

◆ GL_CONTEXT_RELEASE_BEHAVIOR

GLAttr SDL::GL_CONTEXT_RELEASE_BEHAVIOR = SDL_GL_CONTEXT_RELEASE_BEHAVIOR
constexpr

sets context the release behavior.

See GLContextReleaseFlag; defaults to FLUSH.

◆ GL_CONTEXT_RELEASE_BEHAVIOR_FLUSH

GLContextReleaseFlag SDL::GL_CONTEXT_RELEASE_BEHAVIOR_FLUSH
constexpr
Initial value:
=
SDL_GL_CONTEXT_RELEASE_BEHAVIOR_FLUSH

BEHAVIOR_FLUSH.

◆ GL_CONTEXT_RELEASE_BEHAVIOR_NONE

GLContextReleaseFlag SDL::GL_CONTEXT_RELEASE_BEHAVIOR_NONE
constexpr
Initial value:
=
SDL_GL_CONTEXT_RELEASE_BEHAVIOR_NONE

BEHAVIOR_NONE.

◆ GL_CONTEXT_RESET_ISOLATION_FLAG

GLContextFlag SDL::GL_CONTEXT_RESET_ISOLATION_FLAG
constexpr
Initial value:
=
SDL_GL_CONTEXT_RESET_ISOLATION_FLAG

RESET_ISOLATION_FLAG.

◆ GL_CONTEXT_RESET_LOSE_CONTEXT

GLContextResetNotification SDL::GL_CONTEXT_RESET_LOSE_CONTEXT
constexpr
Initial value:
=
SDL_GL_CONTEXT_RESET_LOSE_CONTEXT

LOSE_CONTEXT.

◆ GL_CONTEXT_RESET_NO_NOTIFICATION

GLContextResetNotification SDL::GL_CONTEXT_RESET_NO_NOTIFICATION
constexpr
Initial value:
=
SDL_GL_CONTEXT_RESET_NO_NOTIFICATION

NO_NOTIFICATION.

◆ GL_CONTEXT_RESET_NOTIFICATION

GLAttr SDL::GL_CONTEXT_RESET_NOTIFICATION
constexpr
Initial value:
=
SDL_GL_CONTEXT_RESET_NOTIFICATION

set context reset notification.

See GLContextResetNotification; defaults to NO_NOTIFICATION.

◆ GL_CONTEXT_ROBUST_ACCESS_FLAG

GLContextFlag SDL::GL_CONTEXT_ROBUST_ACCESS_FLAG
constexpr
Initial value:
=
SDL_GL_CONTEXT_ROBUST_ACCESS_FLAG

ROBUST_ACCESS_FLAG.

◆ GL_FRAMEBUFFER_SRGB_CAPABLE

GLAttr SDL::GL_FRAMEBUFFER_SRGB_CAPABLE = SDL_GL_FRAMEBUFFER_SRGB_CAPABLE
constexpr

requests sRGB-capable visual if 1.

Defaults to -1 ("don't care"). This is a request; GL drivers might not comply!

◆ GL_RETAINED_BACKING

GLAttr SDL::GL_RETAINED_BACKING
constexpr
Initial value:
=
SDL_GL_RETAINED_BACKING

not used (deprecated).

◆ GL_SHARE_WITH_CURRENT_CONTEXT

GLAttr SDL::GL_SHARE_WITH_CURRENT_CONTEXT
constexpr
Initial value:
=
SDL_GL_SHARE_WITH_CURRENT_CONTEXT

OpenGL context sharing; defaults to 0.

◆ GL_STEREO

GLAttr SDL::GL_STEREO
constexpr
Initial value:
=
SDL_GL_STEREO

whether the output is stereo 3D; defaults to off.

◆ HITTEST_DRAGGABLE

HitTestResult SDL::HITTEST_DRAGGABLE
constexpr
Initial value:
=
SDL_HITTEST_DRAGGABLE

Region can drag entire window.

◆ HITTEST_NORMAL

HitTestResult SDL::HITTEST_NORMAL
constexpr
Initial value:
=
SDL_HITTEST_NORMAL

Region is normal. No special properties.

◆ HITTEST_RESIZE_BOTTOM

HitTestResult SDL::HITTEST_RESIZE_BOTTOM
constexpr
Initial value:
=
SDL_HITTEST_RESIZE_BOTTOM

Region is the resizable bottom border.

◆ HITTEST_RESIZE_BOTTOMLEFT

HitTestResult SDL::HITTEST_RESIZE_BOTTOMLEFT
constexpr
Initial value:
=
SDL_HITTEST_RESIZE_BOTTOMLEFT

Region is the resizable bottom-left corner border.

◆ HITTEST_RESIZE_BOTTOMRIGHT

HitTestResult SDL::HITTEST_RESIZE_BOTTOMRIGHT
constexpr
Initial value:
=
SDL_HITTEST_RESIZE_BOTTOMRIGHT

Region is the resizable bottom-right corner border.

◆ HITTEST_RESIZE_LEFT

HitTestResult SDL::HITTEST_RESIZE_LEFT
constexpr
Initial value:
=
SDL_HITTEST_RESIZE_LEFT

Region is the resizable left border.

◆ HITTEST_RESIZE_RIGHT

HitTestResult SDL::HITTEST_RESIZE_RIGHT
constexpr
Initial value:
=
SDL_HITTEST_RESIZE_RIGHT

Region is the resizable right border.

◆ HITTEST_RESIZE_TOP

HitTestResult SDL::HITTEST_RESIZE_TOP
constexpr
Initial value:
=
SDL_HITTEST_RESIZE_TOP

Region is the resizable top border.

◆ HITTEST_RESIZE_TOPLEFT

HitTestResult SDL::HITTEST_RESIZE_TOPLEFT
constexpr
Initial value:
=
SDL_HITTEST_RESIZE_TOPLEFT

Region is the resizable top-left corner border.

◆ HITTEST_RESIZE_TOPRIGHT

HitTestResult SDL::HITTEST_RESIZE_TOPRIGHT
constexpr
Initial value:
=
SDL_HITTEST_RESIZE_TOPRIGHT

Region is the resizable top-right corner border.

◆ ORIENTATION_LANDSCAPE_FLIPPED

DisplayOrientation SDL::ORIENTATION_LANDSCAPE_FLIPPED
constexpr
Initial value:
=
SDL_ORIENTATION_LANDSCAPE_FLIPPED

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

◆ ORIENTATION_PORTRAIT

DisplayOrientation SDL::ORIENTATION_PORTRAIT
constexpr
Initial value:
=
SDL_ORIENTATION_PORTRAIT

The display is in portrait mode.

◆ ORIENTATION_PORTRAIT_FLIPPED

DisplayOrientation SDL::ORIENTATION_PORTRAIT_FLIPPED
constexpr
Initial value:
=
SDL_ORIENTATION_PORTRAIT_FLIPPED

The display is in portrait mode, upside down.

◆ ORIENTATION_UNKNOWN

DisplayOrientation SDL::ORIENTATION_UNKNOWN
constexpr
Initial value:
=
SDL_ORIENTATION_UNKNOWN

The display orientation can't be determined.

◆ PROGRESS_STATE_INDETERMINATE

ProgressState SDL::PROGRESS_STATE_INDETERMINATE
constexpr
Initial value:
=
SDL_PROGRESS_STATE_INDETERMINATE

The progress bar is shown in a indeterminate state.

The progress bar is shown in a indeterminate state

◆ PROGRESS_STATE_NONE

ProgressState SDL::PROGRESS_STATE_NONE
constexpr
Initial value:
=
SDL_PROGRESS_STATE_NONE

No progress bar is shown.

◆ PROGRESS_STATE_NORMAL

ProgressState SDL::PROGRESS_STATE_NORMAL
constexpr
Initial value:
=
SDL_PROGRESS_STATE_NORMAL

The progress bar is shown in a normal state.

◆ PROGRESS_STATE_PAUSED

ProgressState SDL::PROGRESS_STATE_PAUSED
constexpr
Initial value:
=
SDL_PROGRESS_STATE_PAUSED

The progress bar is shown in a paused state.

◆ SYSTEM_THEME_DARK

SystemTheme SDL::SYSTEM_THEME_DARK
constexpr
Initial value:
=
SDL_SYSTEM_THEME_DARK

Dark colored system theme.

◆ SYSTEM_THEME_LIGHT

SystemTheme SDL::SYSTEM_THEME_LIGHT
constexpr
Initial value:
=
SDL_SYSTEM_THEME_LIGHT

Light colored system theme.

◆ SYSTEM_THEME_UNKNOWN

SystemTheme SDL::SYSTEM_THEME_UNKNOWN
constexpr
Initial value:
=
SDL_SYSTEM_THEME_UNKNOWN

Unknown system theme.

◆ WINDOW_ALWAYS_ON_TOP

WindowFlags SDL::WINDOW_ALWAYS_ON_TOP
constexpr
Initial value:
=
SDL_WINDOW_ALWAYS_ON_TOP

window should always be above others

◆ WINDOW_BORDERLESS

WindowFlags SDL::WINDOW_BORDERLESS
constexpr
Initial value:
=
SDL_WINDOW_BORDERLESS

no window decoration

◆ WINDOW_EXTERNAL

WindowFlags SDL::WINDOW_EXTERNAL
constexpr
Initial value:
=
SDL_WINDOW_EXTERNAL

window not created by SDL

◆ WINDOW_FULLSCREEN

WindowFlags SDL::WINDOW_FULLSCREEN
constexpr
Initial value:
=
SDL_WINDOW_FULLSCREEN

window is in fullscreen mode

◆ WINDOW_INPUT_FOCUS

WindowFlags SDL::WINDOW_INPUT_FOCUS
constexpr
Initial value:
=
SDL_WINDOW_INPUT_FOCUS

window has input focus

◆ WINDOW_KEYBOARD_GRABBED

WindowFlags SDL::WINDOW_KEYBOARD_GRABBED
constexpr
Initial value:
=
SDL_WINDOW_KEYBOARD_GRABBED

window has grabbed keyboard input

◆ WINDOW_MAXIMIZED

WindowFlags SDL::WINDOW_MAXIMIZED
constexpr
Initial value:
=
SDL_WINDOW_MAXIMIZED

window is maximized

◆ WINDOW_METAL

WindowFlags SDL::WINDOW_METAL
constexpr
Initial value:
=
SDL_WINDOW_METAL

window usable for Metal view

◆ WINDOW_MINIMIZED

WindowFlags SDL::WINDOW_MINIMIZED
constexpr
Initial value:
=
SDL_WINDOW_MINIMIZED

window is minimized

◆ WINDOW_MOUSE_FOCUS

WindowFlags SDL::WINDOW_MOUSE_FOCUS
constexpr
Initial value:
=
SDL_WINDOW_MOUSE_FOCUS

window has mouse focus

◆ WINDOW_MOUSE_GRABBED

WindowFlags SDL::WINDOW_MOUSE_GRABBED
constexpr
Initial value:
=
SDL_WINDOW_MOUSE_GRABBED

window has grabbed mouse input

◆ WINDOW_MOUSE_RELATIVE_MODE

WindowFlags SDL::WINDOW_MOUSE_RELATIVE_MODE
constexpr
Initial value:
=
SDL_WINDOW_MOUSE_RELATIVE_MODE

window has relative mode enabled

◆ WINDOW_NOT_FOCUSABLE

WindowFlags SDL::WINDOW_NOT_FOCUSABLE
constexpr
Initial value:
=
SDL_WINDOW_NOT_FOCUSABLE

window should not be focusable

◆ WINDOW_OCCLUDED

WindowFlags SDL::WINDOW_OCCLUDED
constexpr
Initial value:
=
SDL_WINDOW_OCCLUDED

window is occluded

◆ WINDOW_OPENGL

WindowFlags SDL::WINDOW_OPENGL
constexpr
Initial value:
=
SDL_WINDOW_OPENGL

window usable with OpenGL context

◆ WINDOW_RESIZABLE

WindowFlags SDL::WINDOW_RESIZABLE
constexpr
Initial value:
=
SDL_WINDOW_RESIZABLE

window can be resized

◆ WINDOW_TRANSPARENT

WindowFlags SDL::WINDOW_TRANSPARENT
constexpr
Initial value:
=
SDL_WINDOW_TRANSPARENT

window with transparent buffer

◆ WINDOW_VULKAN

WindowFlags SDL::WINDOW_VULKAN
constexpr
Initial value:
=
SDL_WINDOW_VULKAN

window usable for Vulkan surface

◆ WINDOWPOS_CENTERED

int SDL::WINDOWPOS_CENTERED = SDL_WINDOWPOS_CENTERED
constexpr

Used to indicate that the window position should be centered.

This always uses the primary display.

Since
This constant is available since SDL 3.2.0.
See also
Window.SetPosition

◆ WINDOWPOS_CENTERED_MASK

int SDL::WINDOWPOS_CENTERED_MASK = SDL_WINDOWPOS_CENTERED_MASK
constexpr

A magic value used with WINDOWPOS_CENTERED.

Generally this macro isn't used directly, but rather through WINDOWPOS_CENTERED or WINDOWPOS_CENTERED_DISPLAY.

Since
This constant is available since SDL 3.2.0.
See also
Window.SetPosition

◆ WINDOWPOS_UNDEFINED

int SDL::WINDOWPOS_UNDEFINED = SDL_WINDOWPOS_UNDEFINED
constexpr

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

This always uses the primary display.

Since
This constant is available since SDL 3.2.0.
See also
Window.SetPosition

◆ WINDOWPOS_UNDEFINED_MASK

int SDL::WINDOWPOS_UNDEFINED_MASK = SDL_WINDOWPOS_UNDEFINED_MASK
constexpr

A magic value used with WINDOWPOS_UNDEFINED.

Generally this macro isn't used directly, but rather through WINDOWPOS_UNDEFINED or WINDOWPOS_UNDEFINED_DISPLAY.

Since
This constant is available since SDL 3.2.0.
See also
Window.SetPosition