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

NAME

6       SDL_ListModes  -  Returns  a  pointer  to  an array of available screen
7       dimensions for the given format and video flags
8

SYNOPSIS

10       #include "SDL.h"
11
12       SDL_Rect **SDL_ListModes(SDL_PixelFormat *format, Uint32 flags);
13

DESCRIPTION

15       Return a pointer to an array of available  screen  dimensions  for  the
16       given  format and video flags, sorted largest to smallest. Returns NULL
17       if there are no dimensions available for a particular format, or -1  if
18       any dimension is okay for the given format.
19
20       If  format  is  NULL,  the mode list will be for the format returned by
21       SDL_GetVideoInfo()->vfmt. The flag parameter is an OR'd combination  of
22       surface  flags.  The  flags are the same as those used SDL_SetVideoMode
23       and they play a strong role in  deciding  what  modes  are  valid.  For
24       instance,  if  you pass SDL_HWSURFACE as a flag only modes that support
25       hardware video surfaces will be returned.
26

EXAMPLE

28       SDL_Rect **modes;
29       int i;
30       .
31       .
32       .
33
34       /* Get available fullscreen/hardware modes */
35       modes=SDL_ListModes(NULL, SDL_FULLSCREEN|SDL_HWSURFACE);
36
37       /* Check is there are any modes available */
38       if(modes == (SDL_Rect **)0){
39         printf("No modes available!
40       ");
41         exit(-1);
42       }
43
44       /* Check if or resolution is restricted */
45       if(modes == (SDL_Rect **)-1){
46         printf("All resolutions available.
47       ");
48       }
49       else{
50         /* Print valid modes */
51         printf("Available Modes
52       ");
53         for(i=0;modes[i];++i)
54           printf("  %d x %d
55       ", modes[i]->w, modes[i]->h);
56       }
57       .
58       .
59

SEE ALSO

61       SDL_SetVideoMode, SDL_GetVideoInfo, SDL_Rect, SDL_PixelFormat
62
63
64
65SDL                         Tue 11 Sep 2001, 23:01            SDL_ListModes(3)
Impressum