SDL. Since the beginning it is clear that it is a “Simple” direct
media layer. To my mind, it means both simplicity of usage, the API
with a built-in GUI system, and a lot of built-in stuff. I’m not
condemning this choice, just highlighting the fact that, until now (I
dont know what’s planned for the next major), it is not the
philosophy of SDL to be a “all in one” library.
I agree. SDL is wonderful when you need to draw all your stuff in a
single window. The interface is really simple and straightforward. I
personally believe that SDL is just where it should be. It does not
impose any GUI model on you but provides the right amount of
abstraction so that you can think in graphics primitives that are
common to every graphics intensive application.
The model of providing basic functionality and leaving the more complex
stuff to additional libraries is also very nice. You need simple sound?
SDL gives you that and you can code a simple sound effect in half a
page of C code. If you need music and multiple effects, SDL_mixer is
your friend. Need scalable vector fonts? You can use SDL_ttf. And so on.
I think getting into the GUI business is a very big can full of really
agile worms. A good GUI should look and feel native in any platform,
preferably providing the same API regardless of the host system.
The only one I know of that is more or less along those lines is
wxWidgets (mind you, I’m no GUI expert).
Now the SDL API documentation is maybe 80 pages; you read about 30
before you can whack together your first ‘bouncy ball follows the
mouse’ program in a few hours. For wxWidgets you first buy the
(otherwise excellent) 700 page wxWorks book to get your gentle
introduction and it takes a couple of hundred pages before you even
contemplate of anything moving, let alone following the mouse. Then you
dive into the 2000+ pages API documentation for details. (By the way,
AFAIK wx now has and SDLFrame class, in one of your wx windows you can
have an SDL screen surface).
A GUI, by its nature, is all about lots of windows, widgets and all
that, concentrating on graphical representations of common interface
elements such as buttons, sliders, packing boxes and, well, menus,
with hierarchies, automatic sizing, placements and alike. SDL is a
DirectMedia Layer abstraction, the opposite approach. A GUI sits
between your program and the user - you don’t really care what
exactly the user sees (in case of wxWidgets it all depends on what
system it’s running on) as long as his actions are presented to you in a
consistent and sufficiently abstract level. With SDL you want to
control, down to the last pixel, what the user sees, want to know what
he does with mouse down to a fraction of a millimetre, want to know
the state of every single key on the keyboard. What you want to be
abstracted is the underlying hardware and its low level OS interface.
You don’t want to know if it’s a video chip or X server is reading your
video memory, but you want to deal with that video memory not as an
abstract canvas with a graphics context but as a bunch of bytes
Sorry for being long-winded but I think SDL found the abstraction level
that was very useful for a whole class of applications (most prominently
games). It has its limitations but it is lightweight yet powerful, very
well supported on a lot of platforms, platform independent (since it
represents the concept of a single rectangular raster graphics surface,
common to every platform). It is not a GUI, it does not pretend that
it is and it indeed should not be. It would be a really sad thing if it
became a victim of feature creep, as so many FOSS projects did.
Create an SDL_GUI by all means, as a separate library. Make it so that
it looks like a Windows menu and widget system on Windows, OS X on a Mac
and GTK or QT or Motif on Linux, BSD et al. Would love it, really. But
please do not put it into the core SDL library. Let that be what it is,
a Simple DirectMedia Layer.