[SDL] Feature Query System (Was: Some multithreaded improvement to the event queue...)

Olof Bjarnason olof.bjarnason at gmail.com
Fri Sep 16 13:12:12 PDT 2005

On 9/16/05, Patrice Mandin <mandin.patrice at wanadoo.fr> wrote:
> Le Fri, 16 Sep 2005 15:32:41 +0200
> Olof Bjarnason <olof.bjarnason at gmail.com> a écrit:
> > I agree; I would love a robust runtime query system in SDL, maybe
> >
> > char* SDL_SystemQuery(char* capability);
> > ...
> > if(atoi(SDL_SystemQuery("DESKTOP_RESOLUTION_W") == 1024) {
> >   printf("I don't like people using 1024x768 desktop resolution,
> >   bye.\n"); return;
> > }
> >
> > or
> >
> > if(!SDL_SystemQuery("ALPHABLEND_HW_HW_ACCEL")) {
> >   printf("Alpha blending is not hardware accelerated, get some new gfx
> >   h/w!\n"); printf("I will run the program anyway, I've warned
> >   you.\n");
> > }
> >
> > or whatever. Lots of flags, yes :)
> >
> > Best of both worlds would be if SDL used the current
> > "fall-back-to-closest-match" system of today, but add APIs for
> > querying reliably also. Then an application programmer could choose to
> > play it the portable way and continue to run the program even if the
> > best match isn't available, or quit if he pleases.
> This is the type of example I would not like to see in SDL applications.
> It is too much PC-centric. You forgot that SDL run on some hardware
> console (ps2, dreamcast) or on PDAs. I don't know how people will
> upgrade their
> PDA :-).

Hey, I *DON'T* think SDL is strictly PC. As Ovid comments, beeing able
query "system configuration information" is even more usable in
"lesser" hw environments where knowning details means all-or-nothing.

On a more fundament level though, I for one *want* to know these
details, call me a power-monger or plain low-level minded (SDL is
still a low-level library, right?) - as a games programmer you want to
know what is "in your hands". And sometimes I simply don't want my
game to run in a "zoomed out" mode as is SDLs basic behaviour given a
non-existent resolution - *I* want to be the one controlling that
behaviour. If SDL did have a query system, it would be up to the
application programmer to decide whether to go the "broad"
("run-on-any-high-end-or-low-end-platform") or "narrow"
("this-is-my-fresh-3d-opengl-game-on-a-high-end-pc") road. Then the
decision would be up to the programmer and his preferences.

That is NOT the situation today. The library forces a certain
"philosophy" on the programmer.

In a similar trail of though, this is why I don't like to build
java-games for mobile phones for instance - you are given a set of
tools which "may" work the way you tell them to, or "may not". Not
fun. I like an up-front "sorry, but I can't do that" better than a
sneaky "Yup, I might do that, but you'll never know cuz' I'll decide

How do Sam and Bob or other "authoritative voices" feel about this?


> Also, in modern apps, you should be able to adapt to what has been given
> to you. For example, OpenGL programs should be runnable in whatever the
> video resolution is (from 320x240 to 2048x1536, etc...). And 2D programs
> can be adapted the same way (zooming is easy to do). The only difference
> will be speed.
> I agree that querying (and selecting) what driver SDL should use, from
> the ones available for the platform, would be nice, but this is all that
> is needed. Everything else is present, like flags in screen's
> SDL_Surface.
> Also I read many questions from people, about various things, who still
> think SDL is running *ONLY* on a win32 system (or this what you could
> think when reading these messages). This is the first mistake not to do
> when writing an SDL application. If you mix win32 code with SDL code,
> you lose portability, don't forget it.
> --
> Patrice Mandin
> WWW: http://pmandin.atari.org/
> Programmeur Linux, Atari
> Spécialité: Développement, jeux
> _______________________________________________
> SDL mailing list
> SDL at libsdl.org
> http://www.libsdl.org/mailman/listinfo/sdl

More information about the SDL mailing list