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