Function SDL_CreateWindowWithProperties

pub unsafe extern "C" fn SDL_CreateWindowWithProperties(
    props: u32,
) -> *mut SDL_Window
Available on crate feature dep_sdl3 only.
Expand description

Create a window with the specified properties.

These are the supported properties:

These are additional supported properties on macOS:

  • SDL_PROP_WINDOW_CREATE_COCOA_WINDOW_POINTER: the (__unsafe_unretained) NSWindow associated with the window, if you want to wrap an existing window.
  • SDL_PROP_WINDOW_CREATE_COCOA_VIEW_POINTER: the (__unsafe_unretained) NSView associated with the window, defaults to [window contentView]

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.

Windows with the “tooltip” and “menu” properties are popup windows and have the behaviors and guidelines outlined in SDL_CreatePopupWindow().

If this window is being created to be used with an [SDL_Renderer], you should not add a graphics API specific property (SDL_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 SDL_PROP_WINDOW_CREATE_HIDDEN_BOOLEAN property set to true, then create the renderer, then show the window with SDL_ShowWindow().

§Parameters

  • props: the properties to use.

§Return value

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

§Thread safety

This function should only be called on the main thread.

§Availability

This function is available since SDL 3.2.0.

§See also