SDL_VideoModeOK(3)
SDL_VideoModeOK πβ¨
okay bestie, welcome to the SDL API Reference bestie β this one's the vibe check for your video modes π
β¨ NAME β¨
SDL_VideoModeOK β check to see if a particular video mode is supported π
π¦ SYNOPSIS π¦
#include "SDL.h"
int SDL_VideoModeOK(int width, int height, int bpp, Uint32 flags);
πΈ DESCRIPTION πΈ
so like, SDL_VideoModeOK is the girl who tells you the truth before you commit, no cap. She returns 0 if the mode you asked for is not supported under any bit depth π, OR she returns the bits-per-pixel of the closest available mode with the width, height and requested surface flags you handed her (peep SDL_SetVideoMode for the lore π«Ά).
ok but lowkey important: the bits-per-pixel value she gives back is only a suggested mode. That's not the law, that's a suggestion β¨. You can usually request any bpp you want when you're actually setting the video mode, and SDL will emulate that color depth with a shadow video surface. iconic behaviour fr fr π
also the arguments you pass to SDL_VideoModeOK are literally the same ones you'd pass to SDL_SetVideoMode. same energy, same list, iykyk π
π EXAMPLE π
SDL_Surface *screen;
Uint32 bpp;
.
.
.
printf("Checking mode 640x480@16bpp.
");
bpp=SDL_VideoModeOK(640, 480, 16, SDL_HWSURFACE);
if(!bpp){
printf("Mode not available.
");
exit(-1);
}
printf("SDL Recommends 640x480@%dbpp.
", bpp);
screen=SDL_SetVideoMode(640, 480, bpp, SDL_HWSURFACE);
.
.
π SEE ALSO π
SDL_SetVideoModeSDL_GetVideoInfo
π and that's the whole page bestie, you ate that. go forth and vibe check ur video modes π
SDL Β· Tue 11 Sep 2001, 23:01 Β· SDL_VideoModeOK(3) β mwah, slay, bye bestie π¦πβ¨
π¦ where this page comes from
- debian bookworm: libsdl1.2-dev 1.2.15+dfsg2-8 Β· LGPL-2.1-or-later
- nixos 26.05: SDL_sixel 0-unstable-2016-02-06
- nixpkgs unstable: SDL_sixel 0-unstable-2016-02-06
- ubuntu jammy: libsdl1.2-dev 1.2.15+dfsg2-6 Β· LGPL-2.1-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms