sdlSetWindowFillDocument function video

bool sdlSetWindowFillDocument(
  1. Pointer<SdlWindow> window,
  2. bool fill
)

Set the window to fill the current document space (Emscripten only).

This will add or remove the window's SDL_WINDOW_FILL_DOCUMENT flag.

Currently this flag only applies to the Emscripten target.

When enabled, the canvas element fills the entire document. Resize events will be generated as the browser window is resized, as that will adjust the canvas size as well. The canvas will cover anything else on the page, including any controls provided by Emscripten in its generated HTML file (in fact, any elements on the page that aren't the canvas will be moved into a hidden div element).

Often times this is desirable for a browser-based game, but it means several things that we expect of an SDL window on other platforms might not work as expected, such as minimum window sizes and aspect ratios.

\param window the window of which to change the fill-document state. \param fill true to set the window to fill the document, false to disable. \returns true on success or false on failure; call SDL_GetError() for more information.

\threadsafety This function should only be called on the main thread.

\since This function is available since SDL 3.4.0.

\sa SDL_GetWindowFlags

extern SDL_DECLSPEC bool SDLCALL SDL_SetWindowFillDocument(SDL_Window *window, bool fill)

Implementation

bool sdlSetWindowFillDocument(Pointer<SdlWindow> window, bool fill) {
  final sdlSetWindowFillDocumentLookupFunction = _libSdl
      .lookupFunction<
        Uint8 Function(Pointer<SdlWindow> window, Uint8 fill),
        int Function(Pointer<SdlWindow> window, int fill)
      >('SDL_SetWindowFillDocument');
  return sdlSetWindowFillDocumentLookupFunction(window, fill ? 1 : 0) == 1;
}