Home -> PlatformBindings -> CobaltSDLCreateWindow
Declaration
SDL_Window* CobaltSDLCreateWindow(const char* title, int windowWidthInPixels, int windowHeightInPixels, SDL_WindowFlags flags = 0);Description
The CobaltSDLCreateWindow function creates an SDL3 window configured for use with Cobalt-managed graphics contexts.
Availability: Builds where COBALT_RENDERER_SDL3_SUPPORT is enabled.
The helper forces high pixel density support, strips SDL's OpenGL, Vulkan, and Metal window flags, and creates the window with SDL_PROP_WINDOW_CREATE_EXTERNAL_GRAPHICS_CONTEXT_BOOLEAN set to true so SDL does not initialize a graphics API context for the window.
Important
The width and height arguments are pixel dimensions. The helper compensates for SDL pixel density before showing the window.
Usage
SDL_Window* CobaltSDLCreateWindow(const char* title, int windowWidthInPixels, int windowHeightInPixels, SDL_WindowFlags flags = 0);
Argument list
- title [const char*]
- The SDL window title.
- windowWidthInPixels [int]
- The requested window width in pixels.
- windowHeightInPixels [int]
- The requested window height in pixels.
- flags [SDL_WindowFlags]
- Optional SDL window flags. Graphics API flags are stripped by the helper.
Return value
- [SDL_Window*]
- The created SDL window, or nullptr if window creation failed.