SDL_SetWindowFullscreenMode(3)

πŸ’– SDL_SetWindowFullscreenMode πŸ’–

okay bestie, welcome to the SDL3 FUNCTIONS corner of the manual β€” this is SDL_SetWindowFullscreenMode(3) and she is here to pick which display mode your window rocks when it goes fullscreen. no cap.


✨ NAME ✨

SDL_SetWindowFullscreenMode β€” set the display mode to use when a window is visible and fullscreen.

it's giving "glow up your fullscreen vibe" fr fr πŸ¦‹


🌸 SYNOPSIS 🌸

#include <SDL3/SDL_video.h>

bool SDL_SetWindowFullscreenMode(SDL_Window *window, const SDL_DisplayMode *mode);

πŸ’… DESCRIPTION πŸ’…

so, the tea: this only affects the display mode used when the window is fullscreen. that's it, that's the lane she stays in. if you wanna change the window size when the window is not fullscreen, that's a whole different girl β€” use SDL_SetWindowSize() instead. πŸŽ€

if the window is currently in the fullscreen state, this request is asynchronous on some windowing systems 😭 which means the new mode dimensions may not be applied immediately upon the return of this function. like, she said yes but she's still getting ready. if an immediate change is required, call SDL_SyncWindow() to block until the changes have taken effect β€” that's your "bestie are you ready yet" function, periodt. πŸ’€

when the new mode takes effect, an SDL_EVENT_WINDOW_RESIZED and/or an SDL_EVENT_WINDOW_PIXEL_SIZE_CHANGED event will be emitted with the new mode dimensions. so you will get notified, don't stress. ✨


🫢 FUNCTION PARAMETERS 🫢

  • window β€” the window to affect. your main character, the one getting the glow up πŸ’–
  • mode β€” a pointer to the display mode to use, which can be NULL for borderless fullscreen desktop mode, or one of the fullscreen modes returned by SDL_GetFullscreenDisplayModes() to set an exclusive fullscreen mode. so like, NULL = chill borderless vibe 🌈, or hand her a real mode from SDL_GetFullscreenDisplayModes() for the exclusive fullscreen moment πŸ‘‘

⭐ RETURN VALUE ⭐

returns true on success or false on failure 😭 and if it's a flop, call SDL_GetError() for more information. she'll tell you what went wrong, i promise. πŸ™ˆ


🧚 THREAD SAFETY 🧚

this function should only be called on the main thread. no side-quest threads, bestie. main thread only, iykyk. πŸ’…


🌈 AVAILABILITY 🌈

this function is available since SDL 3.2.0. so if you're on something older, that's a no from her. πŸŽ€


πŸ‘‘ SEE ALSO πŸ‘‘


and that's the whole page, bestie!! πŸ₯³ brought to you by the Simple Directmedia Layer girlies, SDL 3.4.18, dated SDL_SetWindowFullscreenMode(3) πŸ’œβœ¨ go forth and fullscreen slay πŸ¦‹πŸ’–πŸŽ€

πŸ“¦ where this page comes from