video topic

CategoryVideo

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 SDL_CreateWindow() and SDL_PollEvent().

Functions

sdlCreatePopupWindow(Pointer<SdlWindow> parent, int offsetX, int offsetY, int w, int h, int flags) Pointer<SdlWindow> video
Create a child popup window of the specified parent window.
sdlCreateWindow(String? title, int w, int h, int flags) Pointer<SdlWindow> video
Create a window with the specified dimensions and flags.
sdlCreateWindowWithProperties(int props) Pointer<SdlWindow> video
Create a window with the specified properties.
sdlDestroyWindow(Pointer<SdlWindow> window) → void video
Destroy a window.
sdlDestroyWindowSurface(Pointer<SdlWindow> window) bool video
Destroy the surface associated with the window.
sdlDisableScreenSaver() bool video
Prevent the screen from being blanked by a screen saver.
sdlEglGetCurrentConfig() Pointer<NativeType> video
Get the currently active EGL config.
sdlEglGetCurrentDisplay() Pointer<NativeType> video
Get the currently active EGL display.
sdlEglGetProcAddress(String? proc) Pointer<NativeType> video
Get an EGL library function by name.
sdlEglGetWindowSurface(Pointer<SdlWindow> window) → void video
Get the EGL surface associated with the window.
sdlEglSetAttributeCallbacks(Pointer<NativeFunction<SdlEglAttribArrayCallback>> platformAttribCallback, Pointer<NativeFunction<SdlEglIntArrayCallback>> surfaceAttribCallback, Pointer<NativeFunction<SdlEglIntArrayCallback>> contextAttribCallback, Pointer<NativeType> userdata) → void video
Sets the callbacks for defining custom EGLAttrib arrays for EGL initialization.
sdlEnableScreenSaver() bool video
Allow the screen to be blanked by a screen saver.
sdlFlashWindow(Pointer<SdlWindow> window, int operation) bool video
Request a window to demand attention from the user.
sdlGetClosestFullscreenDisplayMode(int displayId, int w, int h, double refreshRate, bool includeHighDensityModes, Pointer<SdlDisplayMode> closest) bool video
Get the closest match to the requested display mode.
sdlGetCurrentDisplayMode(int displayId) Pointer<SdlDisplayMode> video
Get information about the current display mode.
sdlGetCurrentDisplayOrientation(int displayId) int video
Get the orientation of a display.
sdlGetCurrentVideoDriver() String? video
Get the name of the currently initialized video driver.
sdlGetDesktopDisplayMode(int displayId) Pointer<SdlDisplayMode> video
Get information about the desktop's display mode.
sdlGetDisplayBounds(int displayId, Pointer<SdlRect> rect) bool video
Get the desktop area represented by a display.
sdlGetDisplayContentScale(int displayId) double video
Get the content scale of a display.
sdlGetDisplayForPoint(Pointer<SdlPoint> point) int video
Get the display containing a point.
sdlGetDisplayForRect(Pointer<SdlRect> rect) int video
Get the display primarily containing a rect.
sdlGetDisplayForWindow(Pointer<SdlWindow> window) int video
Get the display associated with a window.
sdlGetDisplayName(int displayId) String? video
Get the name of a display in UTF-8 encoding.
sdlGetDisplayProperties(int displayId) int video
Get the properties associated with a display.
sdlGetDisplays(Pointer<Int32> count) Pointer<Uint32> video
Get a list of currently connected displays.
sdlGetDisplayUsableBounds(int displayId, Pointer<SdlRect> rect) bool video
Get the usable desktop area represented by a display, in screen coordinates.
sdlGetFullscreenDisplayModes(int displayId, Pointer<Int32> count) Pointer<Pointer<SdlDisplayMode>> video
Get a list of fullscreen display modes available on a display.
sdlGetGrabbedWindow() Pointer<SdlWindow> video
Get the window that currently has an input grab enabled.
sdlGetNaturalDisplayOrientation(int displayId) int video
Get the orientation of a display when it is unrotated.
sdlGetNumVideoDrivers() int video
Get the number of video drivers compiled into SDL.
sdlGetPrimaryDisplay() int video
Return the primary display.
sdlGetSystemTheme() int video
Get the current system theme.
sdlGetVideoDriver(int index) String? video
Get the name of a built in video driver.
sdlGetWindowAspectRatio(Pointer<SdlWindow> window, Pointer<Float> minAspect, Pointer<Float> maxAspect) bool video
Get the aspect ratio of a window's client area.
sdlGetWindowBordersSize(Pointer<SdlWindow> window, Pointer<Int32> top, Pointer<Int32> left, Pointer<Int32> bottom, Pointer<Int32> right) bool video
Get the size of a window's borders (decorations) around the client area.
sdlGetWindowDisplayScale(Pointer<SdlWindow> window) double video
Get the content display scale relative to a window's pixel size.
sdlGetWindowFlags(Pointer<SdlWindow> window) int video
Get the window flags.
sdlGetWindowFromId(int id) Pointer<SdlWindow> video
Get a window from a stored ID.
sdlGetWindowFullscreenMode(Pointer<SdlWindow> window) Pointer<SdlDisplayMode> video
Query the display mode to use when a window is visible at fullscreen.
sdlGetWindowIccProfile(Pointer<SdlWindow> window, Pointer<Uint32> size) Pointer<NativeType> video
Get the raw ICC profile data for the screen the window is currently on.
sdlGetWindowId(Pointer<SdlWindow> window) int video
Get the numeric ID of a window.
sdlGetWindowKeyboardGrab(Pointer<SdlWindow> window) bool video
Get a window's keyboard grab mode.
sdlGetWindowMaximumSize(Pointer<SdlWindow> window, Pointer<Int32> w, Pointer<Int32> h) bool video
Get the maximum size of a window's client area.
sdlGetWindowMinimumSize(Pointer<SdlWindow> window, Pointer<Int32> w, Pointer<Int32> h) bool video
Get the minimum size of a window's client area.
sdlGetWindowMouseGrab(Pointer<SdlWindow> window) bool video
Get a window's mouse grab mode.
sdlGetWindowMouseRect(Pointer<SdlWindow> window) Pointer<SdlRect> video
Get the mouse confinement rectangle of a window.
sdlGetWindowOpacity(Pointer<SdlWindow> window) double video
Get the opacity of a window.
sdlGetWindowParent(Pointer<SdlWindow> window) Pointer<SdlWindow> video
Get parent of a window.
sdlGetWindowPixelDensity(Pointer<SdlWindow> window) double video
Get the pixel density of a window.
sdlGetWindowPixelFormat(Pointer<SdlWindow> window) int video
Get the pixel format associated with the window.
sdlGetWindowPosition(Pointer<SdlWindow> window, Pointer<Int32> x, Pointer<Int32> y) bool video
Get the position of a window.
sdlGetWindowProgressState(Pointer<SdlWindow> window) int video
Get the state of the progress bar for the given window’s taskbar icon.
sdlGetWindowProgressValue(Pointer<SdlWindow> window) double video
Get the value of the progress bar for the given window’s taskbar icon.
sdlGetWindowProperties(Pointer<SdlWindow> window) int video
Get the properties associated with a window.
sdlGetWindows(Pointer<Int32> count) Pointer<Pointer<SdlWindow>> video
Get a list of valid windows.
sdlGetWindowSafeArea(Pointer<SdlWindow> window, Pointer<SdlRect> rect) bool video
Get the safe area for this window.
sdlGetWindowSize(Pointer<SdlWindow> window, Pointer<Int32> w, Pointer<Int32> h) bool video
Get the size of a window's client area.
sdlGetWindowSizeInPixels(Pointer<SdlWindow> window, Pointer<Int32> w, Pointer<Int32> h) bool video
Get the size of a window's client area, in pixels.
sdlGetWindowSurface(Pointer<SdlWindow> window) Pointer<SdlSurface> video
Get the SDL surface associated with the window.
sdlGetWindowSurfaceVSync(Pointer<SdlWindow> window, Pointer<Int32> vsync) bool video
Get VSync for the window surface.
sdlGetWindowTitle(Pointer<SdlWindow> window) String? video
Get the title of a window.
sdlGlCreateContext(Pointer<SdlWindow> window) Pointer<SdlGlContext> video
Create an OpenGL context for an OpenGL window, and make it current.
sdlGlDestroyContext(Pointer<SdlGlContext> context) bool video
Delete an OpenGL context.
sdlGlExtensionSupported(String? extension) bool video
Check if an OpenGL extension is supported for the current context.
sdlGlGetAttribute(int attr, Pointer<Int32> value) bool video
Get the actual value for an attribute from the current context.
sdlGlGetCurrentContext() Pointer<SdlGlContext> video
Get the currently active OpenGL context.
sdlGlGetCurrentWindow() Pointer<SdlWindow> video
Get the currently active OpenGL window.
sdlGlGetProcAddress(String? proc) Pointer<NativeType> video
Get an OpenGL function by name.
sdlGlGetSwapInterval(Pointer<Int32> interval) bool video
Get the swap interval for the current OpenGL context.
sdlGlLoadLibrary(String? path) bool video
Dynamically load an OpenGL library.
sdlGlMakeCurrent(Pointer<SdlWindow> window, Pointer<SdlGlContext> context) bool video
Set up an OpenGL context for rendering into an OpenGL window.
sdlGlResetAttributes() → void video
Reset all previously set OpenGL context attributes to their default values.
sdlGlSetAttribute(int attr, int value) bool video
Set an OpenGL window attribute before window creation.
sdlGlSetSwapInterval(int interval) bool video
Set the swap interval for the current OpenGL context.
sdlGlSwapWindow(Pointer<SdlWindow> window) bool video
Update a window with OpenGL rendering.
sdlGlUnloadLibrary() → void video
Unload the OpenGL library previously loaded by SDL_GL_LoadLibrary().
sdlHideWindow(Pointer<SdlWindow> window) bool video
Hide a window.
sdlMaximizeWindow(Pointer<SdlWindow> window) bool video
Request that the window be made as large as possible.
sdlMinimizeWindow(Pointer<SdlWindow> window) bool video
Request that the window be minimized to an iconic representation.
sdlRaiseWindow(Pointer<SdlWindow> window) bool video
Request that a window be raised above other windows and gain the input focus.
sdlRestoreWindow(Pointer<SdlWindow> window) bool video
Request that the size and position of a minimized or maximized window be restored.
sdlScreenSaverEnabled() bool video
Check whether the screensaver is currently enabled.
sdlSetWindowAlwaysOnTop(Pointer<SdlWindow> window, bool onTop) bool video
Set the window to always be above the others.
sdlSetWindowAspectRatio(Pointer<SdlWindow> window, double minAspect, double maxAspect) bool video
Request that the aspect ratio of a window's client area be set.
sdlSetWindowBordered(Pointer<SdlWindow> window, bool bordered) bool video
Set the border state of a window.
sdlSetWindowFocusable(Pointer<SdlWindow> window, bool focusable) bool video
Set whether the window may have input focus.
sdlSetWindowFullscreen(Pointer<SdlWindow> window, bool fullscreen) bool video
Request that the window's fullscreen state be changed.
sdlSetWindowFullscreenMode(Pointer<SdlWindow> window, Pointer<SdlDisplayMode> mode) bool video
Set the display mode to use when a window is visible and fullscreen.
sdlSetWindowHitTest(Pointer<SdlWindow> window, Pointer<NativeFunction<SdlHitTest>> callback, Pointer<NativeType> callbackData) bool video
Provide a callback that decides if a window region has special properties.
sdlSetWindowIcon(Pointer<SdlWindow> window, Pointer<SdlSurface> icon) bool video
Set the icon for a window.
sdlSetWindowKeyboardGrab(Pointer<SdlWindow> window, bool grabbed) bool video
Set a window's keyboard grab mode.
sdlSetWindowMaximumSize(Pointer<SdlWindow> window, int maxW, int maxH) bool video
Set the maximum size of a window's client area.
sdlSetWindowMinimumSize(Pointer<SdlWindow> window, int minW, int minH) bool video
Set the minimum size of a window's client area.
sdlSetWindowModal(Pointer<SdlWindow> window, bool modal) bool video
Toggle the state of the window as modal.
sdlSetWindowMouseGrab(Pointer<SdlWindow> window, bool grabbed) bool video
Set a window's mouse grab mode.
sdlSetWindowMouseRect(Pointer<SdlWindow> window, Pointer<SdlRect> rect) bool video
Confines the cursor to the specified area of a window.
sdlSetWindowOpacity(Pointer<SdlWindow> window, double opacity) bool video
Set the opacity for a window.
sdlSetWindowParent(Pointer<SdlWindow> window, Pointer<SdlWindow> parent) bool video
Set the window as a child of a parent window.
sdlSetWindowPosition(Pointer<SdlWindow> window, int x, int y) bool video
Request that the window's position be set.
sdlSetWindowProgressState(Pointer<SdlWindow> window, int state) bool video
Sets the state of the progress bar for the given window’s taskbar icon.
sdlSetWindowProgressValue(Pointer<SdlWindow> window, double value) bool video
Sets the value of the progress bar for the given window’s taskbar icon.
sdlSetWindowResizable(Pointer<SdlWindow> window, bool resizable) bool video
Set the user-resizable state of a window.
sdlSetWindowShape(Pointer<SdlWindow> window, Pointer<SdlSurface> shape) bool video
Set the shape of a transparent window.
sdlSetWindowSize(Pointer<SdlWindow> window, int w, int h) bool video
Request that the size of a window's client area be set.
sdlSetWindowSurfaceVSync(Pointer<SdlWindow> window, int vsync) bool video
Toggle VSync for the window surface.
sdlSetWindowTitle(Pointer<SdlWindow> window, String? title) bool video
Set the title of a window.
sdlShowWindow(Pointer<SdlWindow> window) bool video
Show a window.
sdlShowWindowSystemMenu(Pointer<SdlWindow> window, int x, int y) bool video
Display the system-level window menu.
sdlSyncWindow(Pointer<SdlWindow> window) bool video
Block until any pending window state is finalized.
sdlUpdateWindowSurface(Pointer<SdlWindow> window) bool video
Copy the window surface to the screen.
sdlUpdateWindowSurfaceRects(Pointer<SdlWindow> window, Pointer<SdlRect> rects, int numrects) bool video
Copy areas of the window surface to the screen.
sdlWindowHasSurface(Pointer<SdlWindow> window) bool video
Return whether the window has a surface associated with it.