[SDL] Detect 16/9 videomode

Gabriele Greco gabriele.greco at darts.it
Tue Sep 19 06:17:26 PDT 2006


There is a way to detect if the computer is connected to a 16/9 monitor 
and open the program (fullscreen) to a 16/9 resolution?

The best solution I see is to open by default the game in the desktop 
resolution using the values returned by SDL_GetVideoInfo (compatible 
only with SDL 1.2.10+).

Looking at the modelists is not working since this is what I get on a 
mac mini connected to a 16/9 display (lcd tv):

Desktop resolution: 1280 x 768
Actual pixel format: bpp: 32 bytespp: 4
R:00ff0000 G:0000ff00 B:000000ff A:00000000

Modes for actual pixel format:
2048 x 1536
1920 x 1440
1600 x 1200
1400 x 1050
1344 x 1008
1280 x 1024
1280 x 960
1280 x 768
1024 x 768
800 x 600
640 x 480

And this is what I get from my linux box in office connected to a 16/9 
19" lcd monitor:

Desktop resolution: 1440 x 900
Actual pixel format: bpp: 32 bytespp: 4
R:00ff0000 G:0000ff00 B:000000ff A:00000000

Modes for actual pixel format:
1440 x 900
1024 x 768
800 x 600
640 x 480

This is the line I use to get the modelist, info is the PTR returned 
from SDL_GetVideoMode(), no window is opened by this program:

SDL_Rect **modes = SDL_ListModes(info->vfmt , 			
                                  SDL_FULLSCREEN|SDL_OPENGL);




More information about the SDL mailing list