SDL: The DirectX Alternative

There's a good chance that the next Linux game you play, especially if it's a commercially sold title, was made using Simple DirectMedia Layer.

SDL, for short, is a multimedia library API which provides low-level access to a system's video framebuffer, sound output, and input devices including keyboard, mouse, and joystick. It's used in emulators and MPEG viewers to handle the graphics and sounds of these programs, but SDL has mostly become known as an essential toolkit for Linux game development. The Linux port of Civilization: Call to Power used SDL.

In its most basic capabilities, SDL is similar to Microsoft's DirectX API. The big difference is that, besides being open source, SDL supports multiple operating systems. Other than Linux, SDL is available as BeOS, MacOS, Solaris, FreeBSD, IRIX, and, yes, even Windows 32-bit versions. Additionally, the API has bindings to other languages, a few of which are Perl, PHP, and Python.

Written in C (and also working natively with C++), the latest version, SDL 1.2, is available under the GNU Lesser General Public License version 2 or later.

This alternative to Microsoft's well-known and oft-used DirectX comes courtesy of Sam Lantinga, 27, who presently works as a software engineer for Blizzard Entertainment (the makers of Diablo) in Irvine, California. He first made a name for himself in the games industry as one of the prominent players in the Linux gaming development community. His last job was as a lead programmer for Loki Software, renowned for its quality Linux translations of Windows and Macintosh games. (The last projects that he worked on while at Loki were Tribes 2 and Kohan.) Lantinga got his start in Linux game programming while in college when he ported a Macintosh game called Maelstrom to Linux.

Do you have any projects underway or completed that use SDL? Also, any general thoughts?Post your comments

The genesis for the SDL library came about while he worked on the Windows port of a Macintosh emulator called Executor. He figured that the code he created for the emulator's graphics, sound, and game controller interfaces could be extracted and used separately across other platforms. "I thought it would be handy to write a library to encapsulate this functionality so that other people could use it," he says.

Lantinga started work on what would become SDL in the summer of 1997 and made the first public release of it, Version 0.3, in October of that year.