1SDL_VideoModeOK(3)             SDL API Reference            SDL_VideoModeOK(3)
2
3
4

NAME

6       SDL_VideoModeOK - Check to see if a particular video mode is supported.
7

SYNOPSIS

9       #include "SDL.h"
10
11       int SDL_VideoModeOK(int width, int height, int bpp, Uint32 flags);
12

DESCRIPTION

14       SDL_VideoModeOK  returns 0 if the requested mode is not supported under
15       any bit depth, or returns the bits-per-pixel of the  closest  available
16       mode  with  the  given  width,  height and requested surface flags (see
17       SDL_SetVideoMode).
18
19       The bits-per-pixel value returned is only a  suggested  mode.  You  can
20       usually  request  and  bpp you want when setting the video mode and SDL
21       will emulate that color depth with a shadow video surface.
22
23       The arguments to SDL_VideoModeOK are the same ones you  would  pass  to
24       SDL_SetVideoMode
25

EXAMPLE

27       SDL_Surface *screen;
28       Uint32 bpp;
29       .
30       .
31       .
32       printf("Checking mode 640x480@16bpp.
33       ");
34       bpp=SDL_VideoModeOK(640, 480, 16, SDL_HWSURFACE);
35
36       if(!bpp){
37         printf("Mode not available.
38       ");
39         exit(-1);
40       }
41
42       printf("SDL Recommends 640x480@%dbpp.
43       ", bpp);
44       screen=SDL_SetVideoMode(640, 480, bpp, SDL_HWSURFACE);
45       .
46       .
47

SEE ALSO

49       SDL_SetVideoMode, SDL_GetVideoInfo
50
51
52
53SDL                         Tue 11 Sep 2001, 23:01          SDL_VideoModeOK(3)
Impressum