[SDL] [PATCH] Function to get desktop resolution

David Olofson david at olofson.net
Fri Jan 28 16:05:56 PST 2005


On Saturday 29 January 2005 00.56, Jon Colverson wrote:
> David Olofson wrote:
> > How about this:
> > ----
> > SDL_Surface* screen = SDL_SetVideoMode(-1024, -768, bpp, flags);
> > ----
> > 
> > where the negative arguments mean "use the desktop resolution if 
> > possible, otherwise use labs(width), labs(height)?"
> > 
> > 
> > That said, I like plain 0, 0 much better for some reason. I can 
live 
> > with 0 and some #defined (negative) values having special 
meanings, 
> > but negative sizes...? Eww...! :-)
> 
> Yeah, it's a neat idea, but I don't think negative sizes are very 
intuitive.

Nor do I, but #defined "magic" values are not negative sizes. They're 
special codes, just like the value 0 - and with the #defines, you 
wouldn't see the actual values in the source either way.

Something like:
----
#define SDL_MAX_SIZE  -1
#define SDL_DESKTOP_SIZE -2
----


//David Olofson - Programmer, Composer, Open Source Advocate

.- Audiality -----------------------------------------------.
|  Free/Open Source audio engine for games and multimedia.  |
| MIDI, modular synthesis, real time effects, scripting,... |
`-----------------------------------> http://audiality.org -'
   --- http://olofson.net --- http://www.reologica.se ---




More information about the SDL mailing list