X Window Programming/SDL

Introduction
Simple DirectMedia Layer (SDL) is a cross-platform multimedia library written in C that creates an abstraction over various platforms' graphics, sound, and input APIs, allowing a developer to write a computer game or other multimedia application once and run it on many operating systems including GNU/Linux, Microsoft Windows and MacOS X. It manages video, events, digital audio, CD-ROM, sound, threads, shared object loading, networking and timers.

History
Sam Lantinga created the library, first releasing it in early 1998, while working for Loki Software. He got the idea while porting a Windows application to Macintosh. He then used SDL to port Doom to BeOS. Several other free libraries appeared to work with SDL, such as SMPEG and OpenAL.

The SDL library has bindings with almost every programming language there is, from the popular (C++, Perl, Python (through pygame), Pascal etc.) to the less known (such as Euphoria or Pliant). This and the fact that it is open-source and licensed under the LGPL make SDL a common choice for a lot of multimedia applications.

SDL itself is very simple; it merely acts as a thin, cross-platform wrapper, providing support for 2D pixel operations, sound, file access, event handling, timing, threading, and more. OpenGL is often used with SDL to provide fast 3D rendering. It is often thought of as a cross-platform DirectX, although it lacks some of its more advanced functionality. SDL instead has a huge number of third party extensions that make it easy to do more advanced functions.

The library is divided into several subsystems, namely the Video (handles both surface functions and OpenGL), Audio, CD-ROM, Joystick and Timer subsystems. Besides this basic, low-level support, there also are a few SDL-dependent libraries that provide some additional functionality. These include SDL_image (provides an easy way to load today's most common image formats), SDL_mixer (complex audio functions, mainly for sound mixing), SDL_net (networking support), SDL_ttf (TrueType Font rendering support), SDL_gfx (some additional graphical functions, such as image resizing and rotating) and SDL_rtf (simple Rich Text Format rendering).

Example C Code
A very basic SDL program. It loads SDL subsystems, pauses for 2 seconds, closes SDL, then exits the program.

Here is more advanced example :

That is easily compiled and ran under Linux with "gcc `sdl-config --cflags --libs` -O3 mandelbrot.c && ./a.out", on Windows it's the same, but you have to use MinGW to compile it.

Extensions

 * SMPEG - SDL MPEG Player Library
 * Guichan and ParaGUI - Widget Sets
 * GGI - a free cross-platform graphics interface