Windows & displaysSDL 3.2

SDL_GetWindowFlags

Reads the window's current state as flags: minimized, full screen, has focus…

Signature

SDL_WindowFlags SDL_GetWindowFlags(SDL_Window *window);

How it works

Test single bits with &. A common use is to stop rendering while the window is minimized (SDL_WINDOW_MINIMIZED), which saves battery and avoids zero-sized swapchains, or to pause the game when it loses keyboard focus (SDL_WINDOW_INPUT_FOCUS not set).

Parameters

windowSDL_Window *

The window to ask about.

Return value

A mask of SDL_WINDOW_… flags.

Example

example.cpp
1if (SDL_GetWindowFlags(window) & SDL_WINDOW_MINIMIZED) {
2    SDL_DelayNS(SDL_MS_TO_NS(10));   // nothing to draw
3    continue;
4}
Official SDL wiki