[SDL] [PATCH] Function to get desktop resolution

Ryan C. Gordon icculus at clutteredmind.org
Sat Jan 29 00:01:41 PST 2005


> Alternatively, we could say that 0 for width and height means "use 
> user's current resolution if possible, otherwise use highest available 
> resolution". I don't like that much either, because it would make is 
> impossible to do something like:

Never use highest available resolution...some platforms (or 
misconfigured hardware on any platform) will report a higher resolution 
than the monitor can support. When this happens, you end up with a 
scrambled screen, or a blurry display, or a monitor inexplicably in standby.

Plus, there's my crazy parents who are running an Apple 20" flat panel 
at 800x600 since they think it looks "better" that way. The hardware can 
do a better resolution, but now the font and icons are too small. Yeah, 
yeah, take it up with them.

I would say never trust the OS to tell you the maximum screen 
resolution, because it might have a rough idea, but it doesn't 
specifically know. SDL_ListModes() was, I think, always meant as an 
interface so you can present sane defaults to the user or definitely 
rule out a given resolution.

Being able to ask the OS "what resolution is the desktop in RIGHT NOW" 
is more useful, especially if you can make an intelligent decision about 
multi-display setups.

I was actually wishing for this function the other day; I had an OpenGL 
project that would have been nice to scale to my LCD's native 
resolution, but picking the biggest fullscreen value in SDL_ListModes() 
can't really be trusted.

Above rant aside, I like the idea about SDL_SetVideoMode() with a size 
of 0x0, too, at least at first glance.

--ryan.





More information about the SDL mailing list