SDL Wiki
(This is the documentation for SDL3, which is under heavy development and the API is changing! SDL2 is the current stable version!)


Create an SDL window from properties representing an existing native window.


SDL_Window* SDL_CreateWindowFrom(SDL_PropertiesID props);

Function Parameters

props a set of properties describing the native window and options

Return Value

Returns the window that was created or NULL on failure; call SDL_GetError() for more information.


These are the supported properties:

On macOS:

"cocoa.window" (pointer) - the (__unsafe_unretained) NSWindow associated with the window
"cocoa.view" (pointer) - optional, the (__unsafe_unretained) NSView associated with the window, defaults to [window contentView]

On Windows:

"win32.hwnd" (pointer) - the HWND associated with the window
"win32.pixel_format_hwnd" (pointer) - optional, another window to share pixel format with, useful for OpenGL windows

On X11:

"x11.window" (number) - the X11 Window associated with the window

On all platforms:

"opengl" (boolean) - optional, true if the window will be used with OpenGL rendering
"vulkan" (boolean) - optional, true if the window will be used with Vulkan rendering


This function is available since SDL 3.0.0.

CategoryAPI, CategoryVideo

[ edit | delete | history | feedback | raw ]

[ front page | index | search | recent changes | git repo | offline html ]

All wiki content is licensed under Creative Commons Attribution 4.0 International (CC BY 4.0).
Wiki powered by ghwikipp.