SDL or Allegro?

Started by
17 comments, last by GameDev.net 18 years ago
It really doesn't matter which library you choose as they both have their pros and cons. People can argue both ways and not really accomplish anything in the end.

What I suggest you try doing is making a simple application in either SDL or Allegro (you choose one), and then try doing the same thing using the other API. Which one seems more natural to you? Which one do you find has nicer documentation to work with? Which one is a better stepping stone to more complex APIs like Direct3D or OpenGL? Whatever you choose doesn't really matter as they can both pretty much accomplish the same thing, just in a different manner.
Rob Loach [Website] [Projects] [Contact]
Advertisement
I've used both for simple programs, and I feel Allegro is more intuitive and includes more functions (in the "default installation"). But it'd be a good idea to try something simple using both libraries, they're really simple (to start working with) and similar, so it won't take you so long :).

Another comment about 3D: both can be used along with OpenGL (in Allegro you need the AllegroGL extension), but I haven't tried them myself so I can't comment about it (I'd make a search on how AllegroGL works).

Best wishes,
José Jorge (Geo).
Imagination's the limit.
I would take a look at ClanLib. ClanLib is a higher-level API for 2d graphics with both OpenGL (for very fast 2d) and SDL (for fallback) backends. It does all sorts of stuff from resources (XML description files, and loading from zip files), proper collision detection (automatic collision detection from sprites, even works when rotated or scaled), GUI, sound, network and signals and slots.

It also makes good use of C++'s features, which makes things pretty easy to work with. For example, once you connect a signal to a slot, it returns a CL_Slot object. Once it goes out of scope, the connection is broken. Scope is used quite a bit for things like this. Don't worry about de-initialization code, the destructors handle that. To init ClanLib, just declare a new object that does it for you, and reverses the process when it goes out of scope.

It's also portable, which you mentioned needing.

On a side note, why don't people use ClanLib? I see a lot of talk about SDL (rather low-level and.. well, slow), and Allegro (rather.. archaic), but almost never ClanLib.
Quote:Original post by jonahrowley
On a side note, why don't people use ClanLib? I see a lot of talk about SDL (rather low-level and.. well, slow), and Allegro (rather.. archaic), but almost never ClanLib.


Check out http://www.clanlib.org

Best wishes,
José Jorge (GeoMX).
Imagination's the limit.
Quote:Original post by GeoMX
Quote:Original post by jonahrowley
On a side note, why don't people use ClanLib? I see a lot of talk about SDL (rather low-level and.. well, slow), and Allegro (rather.. archaic), but almost never ClanLib.


Check out http://www.clanlib.org


Oops, horrible timing. The domain name looks like it lapsed, but the ClanLib site is very alive.
I would suggest you try openlayer.

"OpenLayer is a hardware accelerated 2D Graphics library. It specifies a new api to be used alongside of Allegro and takes control of how the contents of the screen are rendered and uses OpenGL functions through AllegroGL to allow hardware acceleration."

As fast and intuitive as it gets! You get to learn OpenGL, too.

[OpenTK: C# OpenGL 4.4, OpenGL ES 3.0 and OpenAL 1.1. Now with Linux/KMS support!]

I've ported an old SVGAlib project to both SDL and Allegro, and I have to say that allegro was much easier to work with. SDL is lacking in drawing primitives, and I remember having to code some myself. Of course, if you're only working with bitmaps, then you'll be fine with SDL, but if you need drawing functions, SDL won't cut it.

But they do have slightly different purposes. SDL is supposed to be a thin abstraction layer over the hardware to allow portability, and Allegro is meant to be a more complete game toolkit. In my ideal world, Allegro would have an SDL backeng target available. This would allow the greater ease of use of allegro with the greater portability of SDL.
Quote:Original post by jonahrowley
Oops, horrible timing. The domain name looks like it lapsed, but the ClanLib site is very alive.

Well, it seems it's online now (the domain), I'll try to have a look at ClanLib in the near future, it seems it lets you target SDL or OpenGL for graphics, but I don't know if it uses SDL for other purposes (audio, input, networking...).

Quote:
I've ported an old SVGAlib project to both SDL and Allegro, and I have to say that allegro was much easier to work with. SDL is lacking in drawing primitives, and I remember having to code some myself. Of course, if you're only working with bitmaps, then you'll be fine with SDL, but if you need drawing functions, SDL won't cut it.

But they do have slightly different purposes. SDL is supposed to be a thin abstraction layer over the hardware to allow portability, and Allegro is meant to be a more complete game toolkit. In my ideal world, Allegro would have an SDL backeng target available. This would allow the greater ease of use of allegro with the greater portability of SDL.


Well, Allegro runs on DOS, Unix (Linux, FreeBSD, Irix, Solaris), Windows, QNX, BeOS and MacOS X, that's great portability.

And yes, as I mentioned, when using both "you feel" that Allegro is "more complete" since it includes some more functions (like the ones you mention for drawing primitives), but with SDL you don't need to code them yourself since there are some extra libraries provided by other (meaning not the authors of SDL) people like SDL_gfx or SDL_Draw.

Regards,
José J. Enríquez R.
Imagination's the limit.
If documentation is your concern then I recommend Allegro as the book 'Game Programming all In One - 2nd Edition' covers Allegro programming for start to finish.

I don't know of any similar books covering SDL.

This topic is closed to new replies.

Advertisement