In fullscreen modes, window decorations are typically irrelevant because the window is either resized to match the screen resolution (exclusive fullscreen) or displayed borderless on top of other windows (fullscreen desktop).
SDL2 provides two fullscreen modes:
SDL_WINDOW_FULLSCREEN
): The window occupies the entire screen resolution, and all decorations are removed.SDL_WINDOW_FULLSCREEN_DESKTOP
): The window behaves as a borderless window but matches the desktop resolution.Example of switching between fullscreen modes:
#include <SDL.h>
int main() {
SDL_Init(SDL_INIT_VIDEO);
SDL_Window* Window{SDL_CreateWindow(
"Fullscreen Demo",
SDL_WINDOWPOS_CENTERED,
SDL_WINDOWPOS_CENTERED,
800, 600,
SDL_WINDOW_SHOWN
)};
SDL_SetWindowFullscreen(
Window, SDL_WINDOW_FULLSCREEN_DESKTOP);
// Display fullscreen for 3 seconds
SDL_Delay(3000);
// Restore windowed mode
SDL_SetWindowFullscreen(Window, 0);
SDL_Delay(3000);
SDL_DestroyWindow(Window);
SDL_Quit();
}
Displays fullscreen desktop mode, then returns to windowed mode.
In fullscreen desktop mode, decorations are completely absent, and the window is effectively borderless. Exclusive fullscreen mode always removes decorations because it takes complete control of the display.
Answers to questions are automatically generated and may not have been reviewed.
An introduction to managing SDL2 window decorations, borders, and client areas.