Вы находитесь на странице: 1из 5

Simple DirectMedia Layer 1

Simple DirectMedia Layer

Developer(s) Sam Lantinga

Stable release 1.2.14 / October 19, 2009

Written in C

Operating system Cross-platform

Type API

License GNU Lesser General Public License

Website http:/ / www. libsdl. org/

Simple DirectMedia Layer (SDL) is a cross-platform, free and open source software multimedia library written in
C that presents a simple interface to various platforms' graphics, sound, and input devices. Software developers use it
to write computer games or other multimedia applications that can run on many operating systems including
Windows, Mac OS X, OS 9, Linux, the PSP, Google Android, AmigaOS, AmigaOS 4, Haiku/BeOS, MorphOS,
OpenVMS, Syllable, and WebOS. It manages video, events, digital audio, CD-ROM, sound, threads, shared object
loading, networking and timers.[1]

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). Several other free libraries were developed to
work alongside SDL, such as SMPEG and OpenAL. He also founded
Galaxy Gameworks [2] in 2008 to help commercially support SDL.[3]

The SDL library has bindings for a substantial number of programming

languages, from the popular (C++, Perl, C, Python (through pygame),
Workshop on SDL
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 many 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. It is often used to complement OpenGL by setting up
the graphical output and providing mouse and keyboard input, which are beyond the scope of OpenGL.
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 separate
official libraries that provide some additional functionality. These comprise the "standard library", and are provided
on the official website and included in the official documentation:
• SDL_image - support for multiple image formats
• SDL_mixer - complex audio functions, mainly for sound mixing
• SDL_net - networking support
Simple DirectMedia Layer 2

• SDL_ttf - TrueType font rendering support

• SDL_rtf - simple Rich Text Format rendering

SDL 1.3
SDL 1.3 is a major update to the SDL 1.2 codebase. 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, multiple
input device support (many mice, many keyboards, etc.), hardware-accelerated 2D graphics, and better Unicode
SDL 1.3 also introduces a new licensing option, whereby one can obtain a commercial license to allow closed-source
static linking. This opens up possibilities for distribution on platforms that do not allow dynamic linking.

SDL has the word "layer" in its title because it is
actually a wrapper around operating-system-specific
functionality. The chief purpose of SDL is to provide a
common framework for accessing this functionality.
Because of the way SDL is designed, a lot of the source
code is split into separate modules for each operating
system, in order to make calls to the underlying system.
When SDL is compiled, the correct modules are
selected for the target system. Abstraction layers of several SDL platforms.
On Microsoft Windows, SDL uses a GDI backend by
default. A DirectX backend is also available. Older versions of SDL used DirectX 5, but SDL 1.2 (the current stable
release) requires DirectX 7 by default. Sam Lantinga has stated that he plans to use DirectX 8 in future SDL
On X11 platforms, including Linux and OpenVMS, SDL uses Xlib to communicate with the X11 system for
graphics and events.
On Mac OS X, SDL uses Quartz.

Syntax and subsystems

The syntax of SDL is function-based: all operations done in SDL are done by passing parameters to functions.
Special structures are also used to store the specific information SDL needs to handle. There are a few different
subsystems SDL categorizes its functions under:
• The Video, events and threads subsystem - this provides functionality for video, multi-threading, and event
• The Audio subsystem - this provides audio functionality.
• The Time subsystem
• The Joystick subsystem
• The CD-ROM subsystem
Simple DirectMedia Layer 3


[6] [7] [8] [9]

OpenTTD The Battle for Wesnoth Freeciv Oolite

libsdl.org Library List [10]
• Guichan [11], ParaGUI [12], SdlWidgets [13], Agar [14], SDLTk [15], SAGGUI [16] - Widget sets
• glSDL [17] - OpenGL backend for SDL (hardware accelerated blits, scaling, and rotation)
• SDL OpenVMS [18] - libSDL library set for OpenVMS port by Alexey Chupahin.
• SMPEG [19] - Video playback
• SDL_ffmpeg [20] - Audio / Video - Encoding and Decoding
• SDL_gfx [21], SPriG [22], SGE [23], SAgl [24] - Graphics primitives rendering and other effects
• libcrtxy [25] - Vector graphics
• Audiality [26] - Audio engine
• FastEvents [27] - Enhanced event processing
• Net2 [28] - SDL_Event-based networking
• SFont [29], BFont, DFont, NFont [30] - Bitmap font rendering
• PolyFonts [31] - TTF rendering
• Crank Storyboard Suite [32] - User Interface Builder
• SDL Collide - Collision detection

[1] "SDL official website" (http:/ / www. libsdl. org). Libsdl.org. . Retrieved 2010-03-19.
[2] http:/ / www. galaxygameworks. com/
[3] About Galaxy Gameworks (http:/ / www. galaxygameworks. com/ about. html)
[4] "SDL: A Quick Introduction to SDL 1.3" (http:/ / www. thegrumpyprogrammer. com/ node/ 13). The Grumpy Programmer (http:/ / www.
thegrumpyprogrammer. com). 29 June 2009. . Retrieved 7 February 2010.
[5] "SDL mailing list" (http:/ / lists. libsdl. org/ pipermail/ sdl-libsdl. org/ 2000-December/ 013908. html). Libsdl.org. . Retrieved 2010-03-23.
[6] "Development" (http:/ / www. openttd. org/ en/ development). OpenTTD. . Retrieved 2010-03-19.
[7] "CompilingWesnoth" (http:/ / wesnoth. org/ wiki/ CompilingWesnoth#Prerequisites). Wesnoth. 2010-02-27. . Retrieved 2010-03-19.
[8] "SDLClient - Freeciv.org" (http:/ / freeciv. wikia. com/ wiki/ SDLClient). Freeciv.wikia.com. . Retrieved 2010-03-19.
[9] "Oolite" (http:/ / oolite. org). Oolite.org. . Retrieved 2010-03-19.
[10] http:/ / www. libsdl. org/ libraries. php
[11] http:/ / guichan. sourceforge. net
[12] http:/ / www. nongnu. org/ paragui/
[13] http:/ / thelas. dk/ index. php/ SdlWidgets
[14] http:/ / libagar. org/
[15] http:/ / developer. berlios. de/ projects/ sdltk/
[16] http:/ / saggui. sourceforge. net/
[17] http:/ / olofson. net/ mixed. html
[18] http:/ / fafner. dyndns. org/ ~alexey/ libsdl/ public. html
[19] http:/ / www. icculus. org/ smpeg/
[20] http:/ / www. arjanhouben. nl/ SDL_ffmpeg/
[21] http:/ / www. ferzkopp. net/ joomla/ content/ view/ 19/ 14/
Simple DirectMedia Layer 4

[22] http:/ / code. bluedinosaurs. com/ SPriG. html

[23] http:/ / www. etek. chalmers. se/ ~e8cal1/ sge/
[24] http:/ / sourceforge. net/ projects/ sagl
[25] http:/ / libcrtxy. sourceforge. net/
[26] http:/ / audiality. org/
[27] http:/ / gameprogrammer. com/ fastevents/ fastevents1. html
[28] http:/ / gameprogrammer. com/ net2/ net2-0. html
[29] http:/ / user. cs. tu-berlin. de/ ~karlb/ sfont/
[30] http:/ / code. bluedinosaurs. com/ NFont. html
[31] http:/ / gameprogrammer. com/ polyfonts/ polyfonts. html
[32] http:/ / www. cranksoftware. com/ products/ crank_storyboard_suite. php

External links
• The SDL Documentation (http://www.libsdl.org/cgi/docwiki.cgi/FrontPage)
Article Sources and Contributors 5

Article Sources and Contributors

Simple DirectMedia Layer  Source: http://en.wikipedia.org/w/index.php?oldid=399486134  Contributors: ARC Gritt, Adam majewski, Adriatikus, Ahruman, Amenzix, Analoguedragon,
AnonMoos, Audiofish, Austin Hair, Av pete, Ballaballa7, BenjaminNeale, Billkendrick, Brian.edmond, ChaoticXSinZ, Chargh, Cmh, Conti, Conversion script, Creidieki, Csabo, Cspan64,
DOSGuy, Dejvid, Diablo-D3, Dissident, Druiloor, Dylan Lake, Emperorbma, Eric B. and Rakim, Evercat, Evil saltine, Fadookie, Flamingspinach, FleetCommand, Frap, Frecklefoot, Fredrik,
Fresheneesz, Furrykef, Gamester17, George Leung, Germ, Goa103, Graue, GrimFang4, Guyjohnston, Gwern, Hashar, Himasaram, Isilanes, IvanLanin, Jdandr2, Jendave, Jerkychew, Kanzure,
Khalid hassani, Kiand, Kl4m-AWB, Koenige, LOL, Lan56, Lasse.nielsen.dk, Lazyfoo, Liftarn, LittleDan, Lzur, Madd the sane, Marasmusine, Marko75, MattGiuca, Mekong Bluesman,
Mikemsd, Mimir, Minority Report, Moskvax, Mrwojo, Oni Lukos, Oscarthecat, Pampas Cat, Podgod, Pokeman, Polluks, Pph, Qeed, Qutezuce, Radagast83, Raffaele Megabyte, Rich
Farmbrough, RobertoPP, Rogerd, Rursus, SF007, Scarfy, Scott Paeth, Shimei, Sietse Snel, SimenH, Sladen, SourSW, Splatg, The Anome, Thumperward, Thunderbrand, Timsoft, TuringBirds,
Viniciusjarina, ViperSnake151, Wayne Hardman, Wickedpedia0, Witchinghour, WpZurp, Xandi, Yono, Youssefsan, Ysangkok, 141 anonymous edits

Image Sources, Licenses and Contributors

Image:Sdl-logo.png  Source: http://en.wikipedia.org/w/index.php?title=File:Sdl-logo.png  License: unknown  Contributors: Evercat, Pbroks13, Stannered, Woohookitty, Ysangkok
File:SDL-Workshop-IMG 2612.jpg  Source: http://en.wikipedia.org/w/index.php?title=File:SDL-Workshop-IMG_2612.jpg  License: GNU Free Documentation License  Contributors:
Image:SDL Layers.svg  Source: http://en.wikipedia.org/w/index.php?title=File:SDL_Layers.svg  License: Public Domain  Contributors: Original uploader was Adriatikus at en.wikipedia
Image:OpenTTD-screenshot.png  Source: http://en.wikipedia.org/w/index.php?title=File:OpenTTD-screenshot.png  License: GNU General Public License  Contributors: user:wolfenSilva
Image:Wesnoth-1.6-5.jpg  Source: http://en.wikipedia.org/w/index.php?title=File:Wesnoth-1.6-5.jpg  License: GNU General Public License  Contributors: Battle for Wesnoth development team
Image:Freeciv-2.1.0-beta3-sdl slack11.0.png  Source: http://en.wikipedia.org/w/index.php?title=File:Freeciv-2.1.0-beta3-sdl_slack11.0.png  License: GNU General Public License
 Contributors: Bayo, Qwm, Raphael Frey
Image:OOlite_Mac_OS_X_screenshot.jpg  Source: http://en.wikipedia.org/w/index.php?title=File:OOlite_Mac_OS_X_screenshot.jpg  License: unknown  Contributors: User:Ahruman,

Creative Commons Attribution-Share Alike 3.0 Unported
http:/ / creativecommons. org/ licenses/ by-sa/ 3. 0/