Original author(s) | Sam Lantinga |
---|---|
Developer(s) | SDL Community |
Initial release | 1998 |
Stable release | |
Repository | |
Written in | C |
Operating system | Linux (e.g. SteamOS), Windows, macOS 10.4+, iOS 3.1.3+, tvOS, [2] Android 2.3.3+, FreeBSD 8.4+, Nintendo Switch, PlayStation 2, Haiku, RISC OS 3.5+ [3] , MorphOS 0.4+ [4] [5] Additionally before v2.0.0: e.g. AmigaOS and MorphOS, and consoles (PlayStation, XBox, Wii, etc), Nintendo DS |
Platform | 'IA-32' (i386), 'x86-64', 'PowerPC', AArch64 |
Type | API |
License | zlib License Before 2.0.0: GNU LGPL [6] |
Website | www |
Simple DirectMedia Layer (SDL) is a cross-platform software development library designed to provide a hardware abstraction layer for computer multimedia hardware components. Software developers can use it to write high-performance computer games and other multimedia applications that can run on many operating systems such as Android, iOS, Linux, macOS, and Windows. [7]
SDL manages video, audio, input devices, threads, shared object loading, networking and timers. [8] For 3D graphics, it can handle an OpenGL, Vulkan, [9] Metal, or Direct3D11 (older Direct3D version 9 is also supported) context. A common misconception is that SDL is a game engine. However, the library is suited to building games directly, or is usable indirectly by engines built on top of it.
The library is internally written in C and possibly, depending on the target platform, C++ or Objective-C, and provides the application programming interface in C, with bindings to other languages available. [10] It is free and open-source software subject to the requirements of the zlib License since version 2.0, and with prior versions subject to the GNU Lesser General Public License. [6] Under the zlib License, SDL 2.0 is freely available for static linking in closed-source projects, unlike SDL 1.2, [11] although it is possible for the user to override the statically linked library with one provided by them. [12] SDL 2.0, released in 2013, was a major departure from previous versions, offering more opportunity for 3D hardware acceleration, but breaking backwards-compatibility, a wrapper library made to translate 1.2 calls to 2.0 was later made available. [13]
SDL is extensively used in the industry in both large and small projects. By 2010, over 700 games, 180 applications, and 120 demos had been posted on the library website. [14]
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 (see Doom source ports). [15] Several other free libraries were developed to work alongside SDL, such as SMPEG and OpenAL. He also founded Galaxy Gameworks in 2008 to help commercially support SDL, although the company plans are currently on hold due to time constraints. [16]
Soon after putting Galaxy Gameworks on hold, Lantinga announced that SDL 1.3 (which would then later become SDL 2.0) would be licensed under the zlib License. [17] Lantinga announced SDL 2.0 on 14 July 2012, at the same time announcing that he was joining Valve, the first version of which was announced the same day he joined the company. [18] Lantinga announced the stable release of SDL 2.0.0 on 13 August 2013. [19]
SDL 2.0 is a major update to the SDL 1.2 codebase with a different, not backwards-compatible [20] API. It replaces several parts of the 1.2 API with more general support for multiple input and output options. Some feature additions include multiple window support, hardware-accelerated 2D graphics, and better Unicode support. [21]
Support for Mir and Wayland was added in SDL 2.0.2 [22] and enabled by default in SDL 2.0.4. [23] Version 2.0.4 also provided better support for Android. [24]
In 2024, the stable preview of SDL 3.1.3 was released. It makes the API more consistent and allows access to more parts of the device, along with other features. [25]
SDL is a wrapper around the operating-system-specific functions that the game needs to access. The only purpose of SDL is to provide a common framework for accessing these functions for multiple operating systems (cross-platform). [26] SDL provides support for 2D pixel operations, sound, file access, event handling, timing and threading. It is often used to complement OpenGL by setting up the graphical output and providing mouse and keyboard input, since OpenGL comprises only rendering.
A game using the Simple DirectMedia Layer will not automatically run on every operating system; further adaptations must be applied. These are reduced to the minimum, since SDL also contains a few abstraction APIs for frequent functions offered by an operating system.
The syntax of SDL is function-based: all operations done in SDL are done by passing parameters to subroutines (functions). Special structures are also used to store the specific information SDL needs to handle. SDL functions are categorized under several different subsystems.
SDL is divided into several subsystems: [27]
Besides this basic, low-level support, there also are a few separate official libraries that provide some more functions. These comprise the "standard library", and are provided on the official website and included in the official documentation:
Other, non-standard libraries also exist. For example: SDL_Collide on SourceForge created by Amir Taaki.
The SDL 2.0 library has language bindings for:
Because of the way SDL is designed, much of its source code is split into separate modules for each operating system, to make calls to the underlying system. When SDL is compiled, the appropriate modules are selected for the target system. The following back-ends are available: [7]
An unofficial Sixel back-end is available for SDL 1.2. [56]
The Rockbox MP3 player firmware also distributes a version of SDL 1.2, which is used to run games such as Quake. [57]
Over the years SDL was used for many commercial and non-commercial video game projects. For instance, MobyGames listed 120 games using SDL in 2013, [58] and the SDL website itself listed around 700 games in 2012. [59] Important commercial examples are Angry Birds , [60] Unreal Tournament , and games developed using Valve's Source Engine, which uses SDL extensively for cross-platform compatibility; ones from the open-source domain are OpenTTD , [61] The Battle for Wesnoth [62] or Freeciv . [63]
The cross-platform game releases of the popular Humble Indie Bundles for Linux, Mac and Android are often SDL-based.
SDL is also often used for later ports on new platforms with legacy code. For instance, the PC game Homeworld was ported to the Pandora handheld [64] and Jagged Alliance 2 for Android [65] via SDL.
Also, several non video game programs use SDL; examples are the emulators, such as DOSBox, FUSE ZX Spectrum emulator and VisualBoyAdvance.
There were several books written for development with SDL (see further reading).
SDL is used in university courses teaching multimedia and computer science, for instance, in a workshop about game programming using libSDL at the University of Cadiz in 2010, or a Game Design discipline at UTFPR (Ponta Grossa campus) in 2015.
The OpenGL Utility Toolkit (GLUT) is a library of utilities for OpenGL programs, which primarily perform system-level I/O with the host operating system. Functions performed include window definition, window control, and monitoring of keyboard and mouse input. Routines for drawing a number of geometric primitives are also provided, including cubes, spheres and the Utah teapot. GLUT also has some limited support for creating pop-up menus.
OpenGL is a cross-language, cross-platform application programming interface (API) for rendering 2D and 3D vector graphics. The API is typically used to interact with a graphics processing unit (GPU), to achieve hardware-accelerated rendering.
Allegro is a software library for video game development. The functionality of the library includes support for basic 2D graphics, image manipulation, text output, audio output, MIDI music, input and timers, as well as additional routines for fixed-point and floating-point matrix arithmetic, Unicode strings, file system access, file manipulation, data files, and 3D graphics. The library is written in the C programming language and designed to be used with C, C++, or Objective-C, with bindings available for Python, Lua, Scheme, D, Go, and other languages. Allegro comes with extensive documentation and many examples.
Irrlicht is an open-source game engine written in C++. It is cross-platform, officially running on Windows, macOS, Linux and Windows CE and due to its open nature ports to other systems are available, including FreeBSD, Xbox, PlayStation Portable, Symbian, iPhone, AmigaOS 4, Sailfish OS via a Qt/QML wrapper, and Google Native Client.
OpenAL is a cross-platform audio application programming interface (API). It is designed for efficient rendering of multichannel three-dimensional positional audio. Its API style and conventions deliberately resemble those of OpenGL. OpenAL is an environmental 3D audio library, which can add realism to a game by simulating attenuation, the Doppler effect, and material densities.
SuperTux is a free and open-source 2D side scrolling platform video game inspired by Nintendo's Super Mario Bros. series. The player character is Tux, the official mascot of the Linux kernel.
The Battle for Wesnoth is a free and open-source turn-based strategy video game with a high fantasy setting, designed by Australian-American developer David White and first released in June 2003. In Wesnoth, the player controls a particular faction/race and attempts to build a powerful army by controlling villages and defeating enemies for experience. The game is loosely based on the Sega Genesis games Master of Monsters and Warsong.
Abuse is a run and gun video game developed by Crack dot Com and published by Electronic Arts in North America and Origin Systems in Europe. It was released on February 29, 1996 for MS-DOS. A Mac OS port of the game was published by Bungie and released on March 5, 1997. The game's source code, along with some of the shareware content, has been in the public domain since the late 1990s and has been ported to Linux and many other platforms.
Pygame is a cross-platform set of Python modules designed for writing video games. It includes computer graphics and sound libraries designed to be used with the Python programming language.
OpenGL for Embedded Systems is a subset of the OpenGL computer graphics rendering application programming interface (API) for rendering 2D and 3D computer graphics such as those used by video games, typically hardware-accelerated using a graphics processing unit (GPU). It is designed for embedded systems like smartphones, tablet computers, video game consoles and PDAs. OpenGL ES is the "most widely deployed 3D graphics API in history".
Sam Oscar Lantinga is a computer programmer. He used to be the lead software engineer at Blizzard Entertainment, where he was known to the community as Slouken. He is best known as the creator of the Simple DirectMedia Layer, a very popular open source multimedia programming library, and also developed the compatibility database for Executor, a proprietary Mac OS emulator.
An open-source video game, or simply an open-source game, is a video game whose source code is open-source. They are often freely distributable and sometimes cross-platform compatible.
Pingus is a free software game programmed by German developer Ingo Ruhnke. It is a clone of Lemmings in which the characters are penguins instead of lemmings.
C-Dogs, the sequel to Cyberdogs, is a shoot 'em up video game where players work cooperatively during missions, and against each other in "dogfight" deathmatch mode.
GrafX2 is a bitmap graphics editor inspired by the Amiga programs Deluxe Paint and Brilliance. It is free software and distributed under the GPL-2.0-only license.
Simple and Fast Multimedia Library (SFML) is a cross-platform software development library designed to provide a simple application programming interface (API) to various multimedia components in computers. It is written in C++ with bindings available for Ada, C, Crystal, D, Euphoria, Go, Java, Julia, .NET, Nim, OCaml, Python, Ruby, and Rust. Experimental mobile ports were made available for Android and iOS with the release of SFML 2.2.
GLFW is a lightweight utility library for use with OpenGL. It provides programmers with the ability to create and manage windows and OpenGL contexts, as well as handle joystick, keyboard and mouse input.
mpv is free and open-source media player software based on MPlayer, mplayer2 and FFmpeg. It runs on several operating systems, including Unix-like operating systems and Microsoft Windows, along with having an Android port called mpv-android. It is cross-platform, running on ARM, MIPS, PowerPC, RISC-V, s390x, x86/IA-32, x86-64, and some other by 3rd party.
LÖVE is a free, open-source, cross-platform framework released under the zlib license for developing video games. The framework is written in C++ and uses Lua as its scripting language and is still maintained by its original developers. The framework is cross-platform supporting the platforms Microsoft Windows, macOS, Linux, Android, and iOS.
Raylib is a cross-platform open-source software development library. The library was made to create graphical applications and games.
Games that use the very portable Simple DirectMedia Layer.[ permanent dead link ]
[...] released port of HomeworldSDL. Forum member Edglex enables your Pandora to experience the excellent work done by the guys at HomeworldSDL.
...SDL >= 1.2.5...
...Simple DirectMedia Layer - SDL for cross platform game windowing...
Linux users, please be advised that SDL2 is now enabled by default on Linux.
... based on SDL ...