Simple directmedia layer (SDL) is a cross-platform multimedia library written in C to provide low level access to keyboard, mouse, audio, joystick and 3D hardware through OpenGL. It is also used by MPEG playback software and many popular games.
SDL was first released in 1998 by Sam Lantinga while working for Loki Software. SDL is a thin, cross platform library providing support for 2D pixel operations, sound, file access, event handling and threading. It complements OpenGL enabling the graphical output by providing mouse and keyboard input. All operations in SDL are performed by passing parameters to functions. The library is divided into numerous subsystems, such as the video, audio, CD-ROM, joystick and timer. Besides this basic low level support, there are also a few official libraries providing additional functionalities.
SDL is widely used to write computer games or other multimedia applications running on a variety of operating systems, including:
- Mac OS X
- OS 9
- Google Android
It also provides bindings to many other languages, including (a partial listing):
Thus, it is a common choice for many multimedia applications. It is also distributed under GNU LGPL version 2 and enables game development for several platforms at the same time, and porting of the game to a new platform within time. While the SDL sound features are modest, the SDL API, which is mainly graphic related, holds around 200 functions and a few structures. It also offers tools for parallel programming such as semaphores, mutex, condition variables and threads.
SDL has the title layer as its wrapper around specific operating system's functionality providing access to it. The SDL source codes are split into different modules for specific operating systems. On compilation, the right modules are selected for the target system. SDL use a GDI backend for Microsoft Windows, while it makes use of the Xlib to communicate with the Linux and OpenVMS for graphics and events.